diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-16 14:14:48 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:56:35 -0400 |
commit | d81a8ef59802d2d8908466d631573a3644c313d5 (patch) | |
tree | 108b4b58e1c518aaa073e375abcf2bbafb34cbf2 /fs/gfs2/file.c | |
parent | 75811d4fdaad3ac6fd27ec36773541ef6bbc104a (diff) |
[readdir] convert gfs2
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/gfs2/file.c')
-rw-r--r-- | fs/gfs2/file.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index ad0dc38d87ab..b3333371aebb 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -82,35 +82,28 @@ static loff_t gfs2_llseek(struct file *file, loff_t offset, int whence) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | /** | 84 | /** |
85 | * gfs2_readdir - Read directory entries from a directory | 85 | * gfs2_readdir - Iterator for a directory |
86 | * @file: The directory to read from | 86 | * @file: The directory to read from |
87 | * @dirent: Buffer for dirents | 87 | * @ctx: What to feed directory entries to |
88 | * @filldir: Function used to do the copying | ||
89 | * | 88 | * |
90 | * Returns: errno | 89 | * Returns: errno |
91 | */ | 90 | */ |
92 | 91 | ||
93 | static int gfs2_readdir(struct file *file, void *dirent, filldir_t filldir) | 92 | static int gfs2_readdir(struct file *file, struct dir_context *ctx) |
94 | { | 93 | { |
95 | struct inode *dir = file->f_mapping->host; | 94 | struct inode *dir = file->f_mapping->host; |
96 | struct gfs2_inode *dip = GFS2_I(dir); | 95 | struct gfs2_inode *dip = GFS2_I(dir); |
97 | struct gfs2_holder d_gh; | 96 | struct gfs2_holder d_gh; |
98 | u64 offset = file->f_pos; | ||
99 | int error; | 97 | int error; |
100 | 98 | ||
101 | gfs2_holder_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh); | 99 | error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &d_gh); |
102 | error = gfs2_glock_nq(&d_gh); | 100 | if (error) |
103 | if (error) { | ||
104 | gfs2_holder_uninit(&d_gh); | ||
105 | return error; | 101 | return error; |
106 | } | ||
107 | 102 | ||
108 | error = gfs2_dir_read(dir, &offset, dirent, filldir, &file->f_ra); | 103 | error = gfs2_dir_read(dir, ctx, &file->f_ra); |
109 | 104 | ||
110 | gfs2_glock_dq_uninit(&d_gh); | 105 | gfs2_glock_dq_uninit(&d_gh); |
111 | 106 | ||
112 | file->f_pos = offset; | ||
113 | |||
114 | return error; | 107 | return error; |
115 | } | 108 | } |
116 | 109 | ||
@@ -1048,7 +1041,7 @@ const struct file_operations gfs2_file_fops = { | |||
1048 | }; | 1041 | }; |
1049 | 1042 | ||
1050 | const struct file_operations gfs2_dir_fops = { | 1043 | const struct file_operations gfs2_dir_fops = { |
1051 | .readdir = gfs2_readdir, | 1044 | .iterate = gfs2_readdir, |
1052 | .unlocked_ioctl = gfs2_ioctl, | 1045 | .unlocked_ioctl = gfs2_ioctl, |
1053 | .open = gfs2_open, | 1046 | .open = gfs2_open, |
1054 | .release = gfs2_release, | 1047 | .release = gfs2_release, |
@@ -1078,7 +1071,7 @@ const struct file_operations gfs2_file_fops_nolock = { | |||
1078 | }; | 1071 | }; |
1079 | 1072 | ||
1080 | const struct file_operations gfs2_dir_fops_nolock = { | 1073 | const struct file_operations gfs2_dir_fops_nolock = { |
1081 | .readdir = gfs2_readdir, | 1074 | .iterate = gfs2_readdir, |
1082 | .unlocked_ioctl = gfs2_ioctl, | 1075 | .unlocked_ioctl = gfs2_ioctl, |
1083 | .open = gfs2_open, | 1076 | .open = gfs2_open, |
1084 | .release = gfs2_release, | 1077 | .release = gfs2_release, |