Use enum type(zfetch_dirn_t) instead

Fix code with zfetch_dirn_t, which is more readable and clear.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2068
This commit is contained in:
Shen Yan 2014-01-22 12:44:35 +08:00 committed by Brian Behlendorf
parent 4461aa6118
commit 93292b3081

View File

@ -138,7 +138,8 @@ dmu_zfetch_colinear(zfetch_t *zf, zstream_t *zh)
diff = z_comp->zst_offset - z_walk->zst_offset; diff = z_comp->zst_offset - z_walk->zst_offset;
if (z_comp->zst_offset + diff == zh->zst_offset) { if (z_comp->zst_offset + diff == zh->zst_offset) {
z_walk->zst_offset = zh->zst_offset; z_walk->zst_offset = zh->zst_offset;
z_walk->zst_direction = diff < 0 ? -1 : 1; z_walk->zst_direction = diff < 0 ?
ZFETCH_BACKWARD : ZFETCH_FORWARD;
z_walk->zst_stride = z_walk->zst_stride =
diff * z_walk->zst_direction; diff * z_walk->zst_direction;
z_walk->zst_ph_offset = z_walk->zst_ph_offset =
@ -156,7 +157,8 @@ dmu_zfetch_colinear(zfetch_t *zf, zstream_t *zh)
diff = z_walk->zst_offset - z_comp->zst_offset; diff = z_walk->zst_offset - z_comp->zst_offset;
if (z_walk->zst_offset + diff == zh->zst_offset) { if (z_walk->zst_offset + diff == zh->zst_offset) {
z_walk->zst_offset = zh->zst_offset; z_walk->zst_offset = zh->zst_offset;
z_walk->zst_direction = diff < 0 ? -1 : 1; z_walk->zst_direction = diff < 0 ?
ZFETCH_BACKWARD : ZFETCH_FORWARD;
z_walk->zst_stride = z_walk->zst_stride =
diff * z_walk->zst_direction; diff * z_walk->zst_direction;
z_walk->zst_ph_offset = z_walk->zst_ph_offset =