Re: [PATCH RFC] ovl: discard independent cursor in readdir()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
>  }


--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux