]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Use enum type(zfetch_dirn_t) instead
authorShen Yan <shenyanxxxy@qq.com>
Wed, 22 Jan 2014 04:44:35 +0000 (12:44 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 23 Jan 2014 20:56:33 +0000 (12:56 -0800)
Fix code with zfetch_dirn_t, which is more readable and clear.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #2068

module/zfs/dmu_zfetch.c

index 876ff357f957362b9620dbbf1afa6a7d28dabb2c..9bc9191848fc3d60f1f72cc52130e7c492331677 100644 (file)
@@ -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 =