From: Alex Elder <elder@ieee.org>
To: "Yan, Zheng" <zheng.z.yan@intel.com>, ceph-devel@vger.kernel.org
Subject: Re: [PATCH] ceph: fix reset_readdir()
Date: Fri, 28 Feb 2014 08:07:29 -0600 [thread overview]
Message-ID: <53109821.50501@ieee.org> (raw)
In-Reply-To: <1393578791-19917-1-git-send-email-zheng.z.yan@intel.com>
On 02/28/2014 03:13 AM, Yan, Zheng wrote:
> When changing readdir postion, fi->next_offset should be set to 0
> if the new postion is not in the first dirfrag.
Again, looks like this would have been a problem if any
fragment other than the first was being seeked to.
Looks good to me.
Reviewed-by: Alex Elder <elder@linaro.org>
> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
> ---
> fs/ceph/dir.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
> index a7eaf96..8ce8833 100644
> --- a/fs/ceph/dir.c
> +++ b/fs/ceph/dir.c
> @@ -454,7 +454,7 @@ more:
> return 0;
> }
>
> -static void reset_readdir(struct ceph_file_info *fi)
> +static void reset_readdir(struct ceph_file_info *fi, unsigned frag)
> {
> if (fi->last_readdir) {
> ceph_mdsc_put_request(fi->last_readdir);
> @@ -462,7 +462,10 @@ static void reset_readdir(struct ceph_file_info *fi)
> }
> kfree(fi->last_name);
> fi->last_name = NULL;
> - fi->next_offset = 2; /* compensate for . and .. */
> + if (ceph_frag_is_leftmost(frag))
> + fi->next_offset = 2; /* compensate for . and .. */
> + else
> + fi->next_offset = 0;
> if (fi->dentry) {
> dput(fi->dentry);
> fi->dentry = NULL;
> @@ -507,7 +510,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence)
> fpos_frag(offset) != fi->frag ||
> fpos_off(offset) < fi->offset) {
> dout("dir_llseek dropping %p content\n", file);
> - reset_readdir(fi);
> + reset_readdir(fi, fpos_frag(offset));
> }
>
> /* bump dir_release_count if we did a forward seek */
>
prev parent reply other threads:[~2014-02-28 14:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 9:13 [PATCH] ceph: fix reset_readdir() Yan, Zheng
2014-02-28 14:07 ` Alex Elder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53109821.50501@ieee.org \
--to=elder@ieee.org \
--cc=ceph-devel@vger.kernel.org \
--cc=zheng.z.yan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.