summaryrefslogtreecommitdiffstats
path: root/fs/reiserfs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-05-17 22:42:17 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 04:56:49 -0400
commit4acf381e1b6c01d6058d353191259c952bd6f3e7 (patch)
tree18be352e5f1494593e4f2555e8f9699cbee612ce /fs/reiserfs
parent956ce2083c93c6ce0a8504d000746b1bea4fe111 (diff)
[readdir] convert reiserfs
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/reiserfs')
-rw-r--r--fs/reiserfs/dir.c26
-rw-r--r--fs/reiserfs/reiserfs.h2
-rw-r--r--fs/reiserfs/xattr.c14
3 files changed, 19 insertions, 23 deletions
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
index 6c2d136561cb..cba70165e9c5 100644
--- a/fs/reiserfs/dir.c
+++ b/fs/reiserfs/dir.c
@@ -13,14 +13,14 @@
13 13
14extern const struct reiserfs_key MIN_KEY; 14extern const struct reiserfs_key MIN_KEY;
15 15
16static int reiserfs_readdir(struct file *, void *, filldir_t); 16static int reiserfs_readdir(struct file *, struct dir_context *);
17static int reiserfs_dir_fsync(struct file *filp, loff_t start, loff_t end, 17static int reiserfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
18 int datasync); 18 int datasync);
19 19
20const struct file_operations reiserfs_dir_operations = { 20const struct file_operations reiserfs_dir_operations = {
21 .llseek = generic_file_llseek, 21 .llseek = generic_file_llseek,
22 .read = generic_read_dir, 22 .read = generic_read_dir,
23 .readdir = reiserfs_readdir, 23 .iterate = reiserfs_readdir,
24 .fsync = reiserfs_dir_fsync, 24 .fsync = reiserfs_dir_fsync,
25 .unlocked_ioctl = reiserfs_ioctl, 25 .unlocked_ioctl = reiserfs_ioctl,
26#ifdef CONFIG_COMPAT 26#ifdef CONFIG_COMPAT
@@ -58,8 +58,7 @@ static inline bool is_privroot_deh(struct dentry *dir,
58 deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid); 58 deh->deh_objectid == INODE_PKEY(privroot->d_inode)->k_objectid);
59} 59}
60 60
61int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent, 61int reiserfs_readdir_dentry(struct dentry *dentry, struct dir_context *ctx)
62 filldir_t filldir, loff_t *pos)
63{ 62{
64 struct inode *inode = dentry->d_inode; 63 struct inode *inode = dentry->d_inode;
65 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */ 64 struct cpu_key pos_key; /* key of current position in the directory (key of directory entry) */
@@ -81,7 +80,7 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
81 80
82 /* form key for search the next directory entry using f_pos field of 81 /* form key for search the next directory entry using f_pos field of
83 file structure */ 82 file structure */
84 make_cpu_key(&pos_key, inode, *pos ?: DOT_OFFSET, TYPE_DIRENTRY, 3); 83 make_cpu_key(&pos_key, inode, ctx->pos ?: DOT_OFFSET, TYPE_DIRENTRY, 3);
85 next_pos = cpu_key_k_offset(&pos_key); 84 next_pos = cpu_key_k_offset(&pos_key);
86 85
87 path_to_entry.reada = PATH_READA; 86 path_to_entry.reada = PATH_READA;
@@ -126,7 +125,6 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
126 entry_num++, deh++) { 125 entry_num++, deh++) {
127 int d_reclen; 126 int d_reclen;
128 char *d_name; 127 char *d_name;
129 off_t d_off;
130 ino_t d_ino; 128 ino_t d_ino;
131 129
132 if (!de_visible(deh)) 130 if (!de_visible(deh))
@@ -158,8 +156,7 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
158 if (is_privroot_deh(dentry, deh)) 156 if (is_privroot_deh(dentry, deh))
159 continue; 157 continue;
160 158
161 d_off = deh_offset(deh); 159 ctx->pos = deh_offset(deh);
162 *pos = d_off;
163 d_ino = deh_objectid(deh); 160 d_ino = deh_objectid(deh);
164 if (d_reclen <= 32) { 161 if (d_reclen <= 32) {
165 local_buf = small_buf; 162 local_buf = small_buf;
@@ -187,9 +184,9 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
187 * the write lock here for other waiters 184 * the write lock here for other waiters
188 */ 185 */
189 reiserfs_write_unlock(inode->i_sb); 186 reiserfs_write_unlock(inode->i_sb);
190 if (filldir 187 if (!dir_emit
191 (dirent, local_buf, d_reclen, d_off, d_ino, 188 (ctx, local_buf, d_reclen, d_ino,
192 DT_UNKNOWN) < 0) { 189 DT_UNKNOWN)) {
193 reiserfs_write_lock(inode->i_sb); 190 reiserfs_write_lock(inode->i_sb);
194 if (local_buf != small_buf) { 191 if (local_buf != small_buf) {
195 kfree(local_buf); 192 kfree(local_buf);
@@ -237,7 +234,7 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
237 } /* while */ 234 } /* while */
238 235
239end: 236end:
240 *pos = next_pos; 237 ctx->pos = next_pos;
241 pathrelse(&path_to_entry); 238 pathrelse(&path_to_entry);
242 reiserfs_check_path(&path_to_entry); 239 reiserfs_check_path(&path_to_entry);
243out: 240out:
@@ -245,10 +242,9 @@ out:
245 return ret; 242 return ret;
246} 243}
247 244
248static int reiserfs_readdir(struct file *file, void *dirent, filldir_t filldir) 245static int reiserfs_readdir(struct file *file, struct dir_context *ctx)
249{ 246{
250 struct dentry *dentry = file->f_path.dentry; 247 return reiserfs_readdir_dentry(file->f_path.dentry, ctx);
251 return reiserfs_readdir_dentry(dentry, dirent, filldir, &file->f_pos);
252} 248}
253 249
254/* compose directory item containing "." and ".." entries (entries are 250/* compose directory item containing "." and ".." entries (entries are
diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
index 157e474ab303..27e0ba000334 100644
--- a/fs/reiserfs/reiserfs.h
+++ b/fs/reiserfs/reiserfs.h
@@ -2709,7 +2709,7 @@ extern const struct inode_operations reiserfs_dir_inode_operations;
2709extern const struct inode_operations reiserfs_symlink_inode_operations; 2709extern const struct inode_operations reiserfs_symlink_inode_operations;
2710extern const struct inode_operations reiserfs_special_inode_operations; 2710extern const struct inode_operations reiserfs_special_inode_operations;
2711extern const struct file_operations reiserfs_dir_operations; 2711extern const struct file_operations reiserfs_dir_operations;
2712int reiserfs_readdir_dentry(struct dentry *, void *, filldir_t, loff_t *); 2712int reiserfs_readdir_dentry(struct dentry *, struct dir_context *);
2713 2713
2714/* tail_conversion.c */ 2714/* tail_conversion.c */
2715int direct2indirect(struct reiserfs_transaction_handle *, struct inode *, 2715int direct2indirect(struct reiserfs_transaction_handle *, struct inode *,
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 821bcf70e467..26648a451e87 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -171,6 +171,7 @@ static struct dentry *open_xa_dir(const struct inode *inode, int flags)
171 * modifying extended attributes. This includes operations such as permissions 171 * modifying extended attributes. This includes operations such as permissions
172 * or ownership changes, object deletions, etc. */ 172 * or ownership changes, object deletions, etc. */
173struct reiserfs_dentry_buf { 173struct reiserfs_dentry_buf {
174 struct dir_context ctx;
174 struct dentry *xadir; 175 struct dentry *xadir;
175 int count; 176 int count;
176 struct dentry *dentries[8]; 177 struct dentry *dentries[8];
@@ -223,9 +224,8 @@ static int reiserfs_for_each_xattr(struct inode *inode,
223{ 224{
224 struct dentry *dir; 225 struct dentry *dir;
225 int i, err = 0; 226 int i, err = 0;
226 loff_t pos = 0;
227 struct reiserfs_dentry_buf buf = { 227 struct reiserfs_dentry_buf buf = {
228 .count = 0, 228 .ctx.actor = fill_with_dentries,
229 }; 229 };
230 230
231 /* Skip out, an xattr has no xattrs associated with it */ 231 /* Skip out, an xattr has no xattrs associated with it */
@@ -249,7 +249,7 @@ static int reiserfs_for_each_xattr(struct inode *inode,
249 reiserfs_write_lock(inode->i_sb); 249 reiserfs_write_lock(inode->i_sb);
250 250
251 buf.xadir = dir; 251 buf.xadir = dir;
252 err = reiserfs_readdir_dentry(dir, &buf, fill_with_dentries, &pos); 252 err = reiserfs_readdir_dentry(dir, &buf.ctx);
253 while ((err == 0 || err == -ENOSPC) && buf.count) { 253 while ((err == 0 || err == -ENOSPC) && buf.count) {
254 err = 0; 254 err = 0;
255 255
@@ -266,8 +266,7 @@ static int reiserfs_for_each_xattr(struct inode *inode,
266 } 266 }
267 buf.count = 0; 267 buf.count = 0;
268 if (!err) 268 if (!err)
269 err = reiserfs_readdir_dentry(dir, &buf, 269 err = reiserfs_readdir_dentry(dir, &buf.ctx);
270 fill_with_dentries, &pos);
271 } 270 }
272 mutex_unlock(&dir->d_inode->i_mutex); 271 mutex_unlock(&dir->d_inode->i_mutex);
273 272
@@ -800,6 +799,7 @@ int reiserfs_removexattr(struct dentry *dentry, const char *name)
800} 799}
801 800
802struct listxattr_buf { 801struct listxattr_buf {
802 struct dir_context ctx;
803 size_t size; 803 size_t size;
804 size_t pos; 804 size_t pos;
805 char *buf; 805 char *buf;
@@ -845,8 +845,8 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
845{ 845{
846 struct dentry *dir; 846 struct dentry *dir;
847 int err = 0; 847 int err = 0;
848 loff_t pos = 0;
849 struct listxattr_buf buf = { 848 struct listxattr_buf buf = {
849 .ctx.actor = listxattr_filler,
850 .dentry = dentry, 850 .dentry = dentry,
851 .buf = buffer, 851 .buf = buffer,
852 .size = buffer ? size : 0, 852 .size = buffer ? size : 0,
@@ -868,7 +868,7 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size)
868 } 868 }
869 869
870 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR); 870 mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_XATTR);
871 err = reiserfs_readdir_dentry(dir, &buf, listxattr_filler, &pos); 871 err = reiserfs_readdir_dentry(dir, &buf.ctx);
872 mutex_unlock(&dir->d_inode->i_mutex); 872 mutex_unlock(&dir->d_inode->i_mutex);
873 873
874 if (!err) 874 if (!err)