[PATCH v2 15/18] libfs: remove cond_resched() from scan_positives()
NeilBrown <[email protected]>
| Newsgroups | org.kernel.vger.linux-fsdevel,org.kernel.vger.autofs,org.kernel.vger.ceph-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-nfs |
|---|---|
| Message-ID | <[email protected]> |
From: NeilBrown <[email protected]> Now that d_for_each_positive_child_continue() calls cond_resced() as needed, scan_positives() doesn't need to any more. Signed-off-by: NeilBrown <[email protected]> --- fs/libfs.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 44e8dec51237..15dd470198dd 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -108,7 +108,6 @@ EXPORT_SYMBOL(dcache_dir_close); * the last element of the list and %NULL is returned. */ static struct dentry *scan_positives(struct dentry *dentry, - struct dentry *cursor, struct dentry *last, loff_t count) { @@ -125,13 +124,6 @@ static struct dentry *scan_positives(struct dentry *dentry, break; count = 1; } - if (cursor && need_resched()) { - hlist_move_behind(&cursor->d_sib, &d->d_sib); - d = cursor; - spin_unlock(&dentry->d_lock); - cond_resched(); - spin_lock(&dentry->d_lock); - } } dput(last); return found; @@ -158,7 +150,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) inode_lock_shared(dentry->d_inode); if (offset > 2) - to = scan_positives(dentry, cursor, NULL, offset - 2); + to = scan_positives(dentry, NULL, offset - 2); spin_lock(&dentry->d_lock); if (to) hlist_move_behind(&cursor->d_sib, &to->d_sib); @@ -193,7 +185,7 @@ int dcache_readdir(struct file *file, struct dir_context *ctx) if (ctx->pos > 2) next = dget(cursor); - while ((next = scan_positives(dentry, cursor, next, 1)) != NULL) { + while ((next = scan_positives(dentry, next, 1)) != NULL) { if (!dir_emit(ctx, next->d_name.name, next->d_name.len, d_inode(next)->i_ino, fs_umode_to_dtype(d_inode(next)->i_mode))) @@ -448,7 +440,7 @@ offset_dir_lookup(struct dentry *parent, loff_t offset) MA_STATE(mas, &octx->mt, offset, offset); if (offset == DIR_OFFSET_FIRST) - found = scan_positives(parent, NULL, NULL, 1); + found = scan_positives(parent, NULL, 1); else { rcu_read_lock(); spin_lock(&parent->d_lock); @@ -470,7 +462,7 @@ offset_dir_lookup(struct dentry *parent, loff_t offset) spin_unlock(&parent->d_lock); rcu_read_unlock(); if (found && !simple_positive(found)) - found = scan_positives(parent, NULL, found, 1); + found = scan_positives(parent, found, 1); } return found; } @@ -496,7 +488,7 @@ static void offset_iterate_dir(struct file *file, struct dir_context *ctx) if (!offset_dir_emit(ctx, dentry)) break; - dentry = scan_positives(dir, NULL, dentry, 1); + dentry = scan_positives(dir, dentry, 1); if (!dentry) goto out_eod; -- 2.50.0.107.gf914562f5916.dirty