ceph: fix broken comparison in readdir loop
authorSage Weil <sage@newdream.net>
Thu, 12 May 2011 22:28:11 +0000 (15:28 -0700)
committerSage Weil <sage@newdream.net>
Thu, 19 May 2011 18:25:04 +0000 (11:25 -0700)
Both off and fi->offset are unsigned, so the difference is always >= 0.
Compare them directly instead of the sign of the difference.

Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/dir.c

index 53a5eb417856026593c682150f2b727748948e4b..33729e822bb96dc0e1197cca57106fb64a9f0abe 100644 (file)
@@ -360,7 +360,7 @@ more:
        rinfo = &fi->last_readdir->r_reply_info;
        dout("readdir frag %x num %d off %d chunkoff %d\n", frag,
             rinfo->dir_nr, off, fi->offset);
-       while (off - fi->offset >= 0 && off - fi->offset < rinfo->dir_nr) {
+       while (off >= fi->offset && off - fi->offset < rinfo->dir_nr) {
                u64 pos = ceph_make_fpos(frag, off);
                struct ceph_mds_reply_inode *in =
                        rinfo->dir_in[off - fi->offset].in;