[PATCH v1 12/12] libfs: remove cond_resched() from scan_positives()
NeilBrown <[email protected]> Mon, 3 Aug 2026 11:21:21 +1000
| Newsgroups | org.kernel.vger.autofs,org.kernel.vger.ceph-devel,org.kernel.vger.linux-fsdevel,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 | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index c0771e8b645c..b4c9cfdc1907 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -105,7 +105,6 @@ EXPORT_SYMBOL(dcache_dir_close); * If no such element exists, NULL is returned. */ static struct dentry *scan_positives(struct dentry *dentry, - struct dentry *cursor, struct dentry *last, loff_t count) { @@ -122,15 +121,6 @@ static struct dentry *scan_positives(struct dentry *dentry, break; count = 1; } - if (cursor && need_resched()) { - if (!hlist_unhashed(&cursor->d_sib)) - __hlist_del(&cursor->d_sib); - hlist_add_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; @@ -157,7 +147,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); hlist_del_init(&cursor->d_sib); if (to) @@ -191,7 +181,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))) @@ -445,7 +435,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); @@ -467,7 +457,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; } @@ -493,7 +483,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