]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: fix non-dcache readdir offset calculation
authorSage Weil <sage@newdream.net>
Tue, 16 Jun 2009 23:14:55 +0000 (16:14 -0700)
committerSage Weil <sage@newdream.net>
Tue, 16 Jun 2009 23:31:38 +0000 (16:31 -0700)
Needs to factor in frag_is_leftmost to account for . and .., just
like the fi->offset calculation in readdir_prepopulate.  Fixes the
problem where an ls on a large dir returns duplicate entries.

src/kernel/dir.c

index c0fca4da626096f7c03c3f797b7bf7bd8af56d74..689ac54db87cc66d1a6ec3fc780aef51f1348a4a 100644 (file)
@@ -279,11 +279,12 @@ more:
        dout(10, "readdir frag %x num %d off %d fragoff %d skew %d\n", frag,
             rinfo->dir_nr, off, fi->off, skew);
        while (off >= skew && off+skew < rinfo->dir_nr) {
-               u64 pos = ceph_make_fpos(frag, rinfo->dir_pos[off+skew]);
+               u64 pos = ceph_make_fpos(frag, rinfo->dir_pos[off+skew] +
+                                        (frag_is_leftmost(frag) ? 2 : 0));
 
-               dout(10, "readdir off %d -> %d / %d %lld name '%.*s'\n",
-                    off, off+skew,
-                    rinfo->dir_nr, pos, rinfo->dir_dname_len[off+skew],
+               dout(10, "readdir off %d (%d/%d) -> %lld '%.*s'\n",
+                    off, off+skew, rinfo->dir_nr, pos,
+                    rinfo->dir_dname_len[off+skew],
                     rinfo->dir_dname[off+skew]);
                ftype = le32_to_cpu(rinfo->dir_in[off+skew].in->mode) >> 12;
                if (filldir(dirent,