Skip to content

Commit cd62cda

Browse files
author
Al Viro
committed
reiserfs: switch reiserfs_readdir_dentry to inode
... and clean the callers up a bit Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 99ce416 commit cd62cda

3 files changed

Lines changed: 15 additions & 17 deletions

File tree

‎fs/reiserfs/dir.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ static inline bool is_privroot_deh(struct inode *dir, struct reiserfs_de_head *d
5757
deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid);
5858
}
5959

60-
int reiserfs_readdir_dentry(struct dentry *dentry, struct dir_context *ctx)
60+
int reiserfs_readdir_inode(struct inode *inode, struct dir_context *ctx)
6161
{
62-
struct inode *inode = dentry->d_inode;
6362
struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
6463
INITIALIZE_PATH(path_to_entry);
6564
struct buffer_head *bh;
@@ -243,7 +242,7 @@ int reiserfs_readdir_dentry(struct dentry *dentry, struct dir_context *ctx)
243242

244243
static int reiserfs_readdir(struct file *file, struct dir_context *ctx)
245244
{
246-
return reiserfs_readdir_dentry(file->f_path.dentry, ctx);
245+
return reiserfs_readdir_inode(file_inode(file), ctx);
247246
}
248247

249248
/* compose directory item containing "." and ".." entries (entries are

‎fs/reiserfs/reiserfs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2709,7 +2709,7 @@ extern const struct inode_operations reiserfs_dir_inode_operations;
27092709
extern const struct inode_operations reiserfs_symlink_inode_operations;
27102710
extern const struct inode_operations reiserfs_special_inode_operations;
27112711
extern const struct file_operations reiserfs_dir_operations;
2712-
int reiserfs_readdir_dentry(struct dentry *, struct dir_context *);
2712+
int reiserfs_readdir_inode(struct inode *, struct dir_context *);
27132713

27142714
/* tail_conversion.c */
27152715
int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,

‎fs/reiserfs/xattr.c‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -249,28 +249,27 @@ static int reiserfs_for_each_xattr(struct inode *inode,
249249
reiserfs_write_lock(inode->i_sb);
250250

251251
buf.xadir = dir;
252-
err = reiserfs_readdir_dentry(dir, &buf.ctx);
253-
while ((err == 0 || err == -ENOSPC) && buf.count) {
254-
err = 0;
255-
256-
for (i = 0; i < buf.count && buf.dentries[i]; i++) {
257-
int lerr = 0;
252+
while (1) {
253+
err = reiserfs_readdir_inode(dir->d_inode, &buf.ctx);
254+
if (err)
255+
break;
256+
if (!buf.count)
257+
break;
258+
for (i = 0; !err && i < buf.count && buf.dentries[i]; i++) {
258259
struct dentry *dentry = buf.dentries[i];
259260

260-
if (err == 0 && !S_ISDIR(dentry->d_inode->i_mode))
261-
lerr = action(dentry, data);
261+
if (!S_ISDIR(dentry->d_inode->i_mode))
262+
err = action(dentry, data);
262263

263264
dput(dentry);
264265
buf.dentries[i] = NULL;
265-
err = lerr ?: err;
266266
}
267+
if (err)
268+
break;
267269
buf.count = 0;
268-
if (!err)
269-
err = reiserfs_readdir_dentry(dir, &buf.ctx);
270270
}
271271
mutex_unlock(&dir->d_inode->i_mutex);
272272

273-
/* Clean up after a failed readdir */
274273
cleanup_dentry_buf(&buf);
275274

276275
if (!err) {
@@ -868,7 +867,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
868867
}
869868

870869
mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR);
871-
err = reiserfs_readdir_dentry(dir, &buf.ctx);
870+
err = reiserfs_readdir_inode(dir->d_inode, &buf.ctx);
872871
mutex_unlock(&dir->d_inode->i_mutex);
873872

874873
if (!err)

0 commit comments

Comments
 (0)