Skip to content

Commit 12c0c3a

Browse files
author
Al Viro
committed
orangefs: saner arguments passing in readdir guts
orangefs_dir_fill() doesn't use oi and dentry arguments at all do_readdir() gets dentry, uses only dentry->d_inode; it also gets oi, which is ORANGEFS_I(dentry->d_inode) (i.e. ->d_inode - constant offset). orangefs_dir_mode() gets dentry and oi, uses only to pass those to do_readdir(). orangefs_dir_iterate() uses dentry and oi only to pass those to orangefs_dir_fill() and orangefs_dir_more(). The only thing it really needs is ->d_inode; moreover, that's better expressed as file_inode(file) - no need to go through ->f_path.dentry->d_inode. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent fda4369 commit 12c0c3a

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

fs/orangefs/dir.c

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ struct orangefs_dir {
5858
* first part of the part list.
5959
*/
6060

61-
static int do_readdir(struct orangefs_inode_s *oi,
62-
struct orangefs_dir *od, struct dentry *dentry,
61+
static int do_readdir(struct orangefs_dir *od, struct inode *inode,
6362
struct orangefs_kernel_op_s *op)
6463
{
64+
struct orangefs_inode_s *oi = ORANGEFS_I(inode);
6565
struct orangefs_readdir_response_s *resp;
6666
int bufi, r;
6767

@@ -87,7 +87,7 @@ static int do_readdir(struct orangefs_inode_s *oi,
8787
op->upcall.req.readdir.buf_index = bufi;
8888

8989
r = service_operation(op, "orangefs_readdir",
90-
get_interruptible_flag(dentry->d_inode));
90+
get_interruptible_flag(inode));
9191

9292
orangefs_readdir_index_put(bufi);
9393

@@ -158,8 +158,7 @@ static int parse_readdir(struct orangefs_dir *od,
158158
return 0;
159159
}
160160

161-
static int orangefs_dir_more(struct orangefs_inode_s *oi,
162-
struct orangefs_dir *od, struct dentry *dentry)
161+
static int orangefs_dir_more(struct orangefs_dir *od, struct inode *inode)
163162
{
164163
struct orangefs_kernel_op_s *op;
165164
int r;
@@ -169,7 +168,7 @@ static int orangefs_dir_more(struct orangefs_inode_s *oi,
169168
od->error = -ENOMEM;
170169
return -ENOMEM;
171170
}
172-
r = do_readdir(oi, od, dentry, op);
171+
r = do_readdir(od, inode, op);
173172
if (r) {
174173
od->error = r;
175174
goto out;
@@ -238,9 +237,7 @@ static int fill_from_part(struct orangefs_dir_part *part,
238237
return 1;
239238
}
240239

241-
static int orangefs_dir_fill(struct orangefs_inode_s *oi,
242-
struct orangefs_dir *od, struct dentry *dentry,
243-
struct dir_context *ctx)
240+
static int orangefs_dir_fill(struct orangefs_dir *od, struct dir_context *ctx)
244241
{
245242
struct orangefs_dir_part *part;
246243
size_t count;
@@ -304,15 +301,10 @@ static loff_t orangefs_dir_llseek(struct file *file, loff_t offset,
304301
static int orangefs_dir_iterate(struct file *file,
305302
struct dir_context *ctx)
306303
{
307-
struct orangefs_inode_s *oi;
308-
struct orangefs_dir *od;
309-
struct dentry *dentry;
304+
struct orangefs_dir *od = file->private_data;
305+
struct inode *inode = file_inode(file);
310306
int r;
311307

312-
dentry = file->f_path.dentry;
313-
oi = ORANGEFS_I(dentry->d_inode);
314-
od = file->private_data;
315-
316308
if (od->error)
317309
return od->error;
318310

@@ -342,7 +334,7 @@ static int orangefs_dir_iterate(struct file *file,
342334
*/
343335
while (od->token != ORANGEFS_ITERATE_END &&
344336
ctx->pos > od->end) {
345-
r = orangefs_dir_more(oi, od, dentry);
337+
r = orangefs_dir_more(od, inode);
346338
if (r)
347339
return r;
348340
}
@@ -351,17 +343,17 @@ static int orangefs_dir_iterate(struct file *file,
351343

352344
/* Then try to fill if there's any left in the buffer. */
353345
if (ctx->pos < od->end) {
354-
r = orangefs_dir_fill(oi, od, dentry, ctx);
346+
r = orangefs_dir_fill(od, ctx);
355347
if (r)
356348
return r;
357349
}
358350

359351
/* Finally get some more and try to fill. */
360352
if (od->token != ORANGEFS_ITERATE_END) {
361-
r = orangefs_dir_more(oi, od, dentry);
353+
r = orangefs_dir_more(od, inode);
362354
if (r)
363355
return r;
364-
r = orangefs_dir_fill(oi, od, dentry, ctx);
356+
r = orangefs_dir_fill(od, ctx);
365357
}
366358

367359
return r;

0 commit comments

Comments
 (0)