]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ceph: simplify 'offset in frag'
authorYan, Zheng <zyan@redhat.com>
Wed, 27 Apr 2016 09:32:34 +0000 (17:32 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 25 May 2016 23:15:34 +0000 (01:15 +0200)
don't distinguish leftmost frag from other frags. always use 2 as
first entry's offset.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
fs/ceph/dir.c
fs/ceph/inode.c

index 734508be1526bbe4ccf9c8294c2be108d4880872..31a2cdf39210342e0a5085af62fb6ab63f1e48ac 100644 (file)
@@ -414,10 +414,7 @@ more:
                if (req->r_reply_info.dir_end) {
                        kfree(fi->last_name);
                        fi->last_name = NULL;
-                       if (ceph_frag_is_rightmost(frag))
-                               fi->next_offset = 2;
-                       else
-                               fi->next_offset = 0;
+                       fi->next_offset = 2;
                } else {
                        err = note_last_dentry(fi,
                                       rinfo->dir_dname[rinfo->dir_nr-1],
@@ -468,7 +465,7 @@ more:
        /* more frags? */
        if (!ceph_frag_is_rightmost(frag)) {
                frag = ceph_frag_next(frag);
-               off = 0;
+               off = 2;
                ctx->pos = ceph_make_fpos(frag, off);
                dout("readdir next frag is %x\n", frag);
                goto more;
@@ -511,10 +508,7 @@ static void reset_readdir(struct ceph_file_info *fi, unsigned frag)
        fi->last_name = NULL;
        fi->dir_release_count = 0;
        fi->readdir_cache_idx = -1;
-       if (ceph_frag_is_leftmost(frag))
-               fi->next_offset = 2;  /* compensate for . and .. */
-       else
-               fi->next_offset = 0;
+       fi->next_offset = 2;  /* compensate for . and .. */
        fi->flags &= ~CEPH_F_ATEND;
 }
 
index b906e02cddada9af6cc3f2a11dc25ec4f40b51fa..51ce5ce59f040088fdb3a94e60c0813bb9080704 100644 (file)
@@ -1405,10 +1405,7 @@ int ceph_readdir_prepopulate(struct ceph_mds_request *req,
                dout("readdir_prepopulate got new frag %x -> %x\n",
                     frag, le32_to_cpu(rinfo->dir_dir->frag));
                frag = le32_to_cpu(rinfo->dir_dir->frag);
-               if (ceph_frag_is_leftmost(frag))
-                       req->r_readdir_offset = 2;
-               else
-                       req->r_readdir_offset = 0;
+               req->r_readdir_offset = 2;
        }
 
        if (le32_to_cpu(rinfo->head->op) == CEPH_MDS_OP_LSSNAP) {