From 93292b308178cb885e1b11ca1a270c36f5b08a23 Mon Sep 17 00:00:00 2001 From: Shen Yan Date: Wed, 22 Jan 2014 12:44:35 +0800 Subject: [PATCH] Use enum type(zfetch_dirn_t) instead Fix code with zfetch_dirn_t, which is more readable and clear. Signed-off-by: Brian Behlendorf Closes #2068 --- module/zfs/dmu_zfetch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/module/zfs/dmu_zfetch.c b/module/zfs/dmu_zfetch.c index 876ff357f..9bc919184 100644 --- a/module/zfs/dmu_zfetch.c +++ b/module/zfs/dmu_zfetch.c @@ -138,7 +138,8 @@ dmu_zfetch_colinear(zfetch_t *zf, zstream_t *zh) diff = z_comp->zst_offset - z_walk->zst_offset; if (z_comp->zst_offset + diff == 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 = diff * z_walk->zst_direction; 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; if (z_walk->zst_offset + diff == 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 = diff * z_walk->zst_direction; z_walk->zst_ph_offset =