]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: lustre: llite: pass in __u64 pos for ll_dir_read
authorwang di <di.wang@intel.com>
Fri, 22 Jul 2016 02:44:10 +0000 (22:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2016 16:31:07 +0000 (18:31 +0200)
Some cases we want to preserve the ctx->pos value or use
a different value altogther. So allow the passing in of
a position offset to ll_dir_read.

Signed-off-by: wang di <di.wang@intel.com>
Reviewed-on: http://review.whamcloud.com/10761
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4906
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/dir.c
drivers/staging/lustre/lustre/llite/llite_internal.h
drivers/staging/lustre/lustre/llite/llite_nfs.c

index 2307e70dea2c26133cb9422e95fab587689e6f35..031c9e4a8f038e34af44b7cbc90cd02a1c88572a 100644 (file)
@@ -489,11 +489,11 @@ static __u16 ll_dirent_type_get(struct lu_dirent *ent)
        return type;
 }
 
-int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
+int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,
                struct dir_context *ctx)
 {
        struct ll_sb_info    *sbi       = ll_i2sbi(inode);
-       __u64              pos          = ctx->pos;
+       __u64              pos          = *ppos;
        int                is_api32 = ll_need_32bit_api(sbi);
        int                is_hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
        struct page       *page;
@@ -626,18 +626,21 @@ static int ll_readdir(struct file *filp, struct dir_context *ctx)
        }
 
        ctx->pos = pos;
-       rc = ll_dir_read(inode, op_data, ctx);
+       rc = ll_dir_read(inode, &pos, op_data, ctx);
+       pos = ctx->pos;
        if (lfd)
-               lfd->lfd_pos = ctx->pos;
-       if (ctx->pos == MDS_DIR_END_OFF) {
+               lfd->lfd_pos = pos;
+
+       if (pos == MDS_DIR_END_OFF) {
                if (api32)
-                       ctx->pos = LL_DIR_END_OFF_32BIT;
+                       pos = LL_DIR_END_OFF_32BIT;
                else
-                       ctx->pos = LL_DIR_END_OFF;
+                       pos = LL_DIR_END_OFF;
        } else {
                if (api32 && hash64)
-                       ctx->pos >>= 32;
+                       pos >>= 32;
        }
+       ctx->pos = pos;
        ll_finish_md_op_data(op_data);
        filp->f_version = inode->i_version;
 
index 623455f5c080c1b7156c3a7065645b02405af9b8..e650aeb1b89c3186d2aeb7930f1666da49addc40 100644 (file)
@@ -653,7 +653,7 @@ extern const struct file_operations ll_dir_operations;
 extern const struct inode_operations ll_dir_inode_operations;
 struct page *ll_get_dir_page(struct inode *dir, __u64 hash,
                             struct ll_dir_chain *chain);
-int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
+int ll_dir_read(struct inode *inode, __u64 *ppos, struct md_op_data *op_data,
                struct dir_context *ctx);
 
 int ll_get_mdt_idx(struct inode *inode);
index b74582a9ed04a2ade68598aadf8a318c9a2cd021..74eb1fc4c3070ce043c57bd3e3a878dca18d9d77 100644 (file)
@@ -256,6 +256,7 @@ static int ll_get_name(struct dentry *dentry, char *name,
                .ctx.actor = ll_nfs_get_name_filldir,
        };
        struct md_op_data *op_data;
+       __u64 pos = 0;
 
        if (!dir || !S_ISDIR(dir->i_mode)) {
                rc = -ENOTDIR;
@@ -275,7 +276,7 @@ static int ll_get_name(struct dentry *dentry, char *name,
        }
 
        inode_lock(dir);
-       rc = ll_dir_read(dir, op_data, &lgd.ctx);
+       rc = ll_dir_read(dir, &pos, op_data, &lgd.ctx);
        inode_unlock(dir);
        ll_finish_md_op_data(op_data);
        if (!rc && !lgd.lgd_found)