From: hujianyang <hujianyang@huawei.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-unionfs@vger.kernel.org
Subject: Re: [PATCH RFC] ovl: discard independent cursor in readdir()
Date: Thu, 11 Dec 2014 10:20:29 +0800 [thread overview]
Message-ID: <5488FF6D.5090402@huawei.com> (raw)
In-Reply-To: <5488222C.6080108@huawei.com>
On 2014/12/10 18:36, hujianyang wrote:
>
> static struct ovl_dir_cache *ovl_cache_get(struct dentry *dentry)
> @@ -361,19 +358,14 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx)
> ovl_seek_cursor(od, ctx->pos);
> }
>
> - while (od->cursor.l_node.next != &od->cache->entries) {
> - struct ovl_cache_entry *p;
> + while (!list_is_last(&od->cursor->l_node, &od->cache->entries)) {
Seems I was mistake here. The entry which cursor points to could be the
last node in the list. We have finished reading one directory until the
cursor points to the head of the entries list.
Here the condition should be:
"""&od->cursor->l_node != &od->cache->entries"""
Sorry for that, I should be more careful.
I will resend this patch with this fix.
> + struct ovl_cache_entry *p = od->cursor;
>
> - p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node);
> - /* Skip cursors */
> - if (!p->is_cursor) {
> - if (!p->is_whiteout) {
> - if (!dir_emit(ctx, p->name, p->len, p->ino, p->type))
> - break;
> - }
> - ctx->pos++;
> - }
> - list_move(&od->cursor.l_node, &p->l_node);
> + if (!p->is_whiteout)
> + if (!dir_emit(ctx, p->name, p->len, p->ino, p->type))
> + break;
> + od->cursor = list_next_entry(p, l_node);
> + ctx->pos++;
> }
> return 0;
> }
prev parent reply other threads:[~2014-12-11 2:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-10 10:36 [PATCH RFC] ovl: discard independent cursor in readdir() hujianyang
2014-12-11 2:04 ` hujianyang
2014-12-11 2:20 ` hujianyang [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=5488FF6D.5090402@huawei.com \
--to=hujianyang@huawei.com \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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.