aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorIsaac Huang <[email protected]>2017-02-24 13:05:42 -0700
committerBrian Behlendorf <[email protected]>2017-02-24 12:05:42 -0800
commitf7e76821c525a7764a01f4a0e16aa9e2b77e3170 (patch)
tree522a536d09c0e8124f8a46115bf0e3d49aaab15f /module/zfs
parent384328e544b1847236a07df231e1b7b10e4cc6ce (diff)
ABD style cleanups
The commit a6255b7fce400d485a0e87cbe369aa0ed7dc5dc4 removed a few assertions which help catch errors and improve code readability. It also duplicated two conditionals, which was unnecessary and made the code confusing to read. This patch cleans it up. Reviewed-by: David Quigley <[email protected]> Reviewed-by: George Melikov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Isaac Huang <[email protected]> Closes #5802
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/vdev_raidz.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/module/zfs/vdev_raidz.c b/module/zfs/vdev_raidz.c
index a92d3cbaa..82e563054 100644
--- a/module/zfs/vdev_raidz.c
+++ b/module/zfs/vdev_raidz.c
@@ -591,20 +591,20 @@ vdev_raidz_generate_parity_pq(raidz_map_t *rm)
ccnt = rm->rm_col[c].rc_size / sizeof (p[0]);
if (c == rm->rm_firstdatacol) {
+ ASSERT(ccnt == pcnt || ccnt == 0);
abd_copy_to_buf(p, src, rm->rm_col[c].rc_size);
(void) memcpy(q, p, rm->rm_col[c].rc_size);
- } else {
- struct pqr_struct pqr = { p, q, NULL };
- (void) abd_iterate_func(src, 0, rm->rm_col[c].rc_size,
- vdev_raidz_pq_func, &pqr);
- }
- if (c == rm->rm_firstdatacol) {
for (i = ccnt; i < pcnt; i++) {
p[i] = 0;
q[i] = 0;
}
} else {
+ struct pqr_struct pqr = { p, q, NULL };
+
+ ASSERT(ccnt <= pcnt);
+ (void) abd_iterate_func(src, 0, rm->rm_col[c].rc_size,
+ vdev_raidz_pq_func, &pqr);
/*
* Treat short columns as though they are full of 0s.
@@ -639,22 +639,23 @@ vdev_raidz_generate_parity_pqr(raidz_map_t *rm)
ccnt = rm->rm_col[c].rc_size / sizeof (p[0]);
if (c == rm->rm_firstdatacol) {
+ ASSERT(ccnt == pcnt || ccnt == 0);
abd_copy_to_buf(p, src, rm->rm_col[c].rc_size);
(void) memcpy(q, p, rm->rm_col[c].rc_size);
(void) memcpy(r, p, rm->rm_col[c].rc_size);
- } else {
- struct pqr_struct pqr = { p, q, r };
- (void) abd_iterate_func(src, 0, rm->rm_col[c].rc_size,
- vdev_raidz_pqr_func, &pqr);
- }
- if (c == rm->rm_firstdatacol) {
for (i = ccnt; i < pcnt; i++) {
p[i] = 0;
q[i] = 0;
r[i] = 0;
}
} else {
+ struct pqr_struct pqr = { p, q, r };
+
+ ASSERT(ccnt <= pcnt);
+ (void) abd_iterate_func(src, 0, rm->rm_col[c].rc_size,
+ vdev_raidz_pqr_func, &pqr);
+
/*
* Treat short columns as though they are full of 0s.
* Note that there's therefore nothing needed for P.