diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 20:51:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-01 20:51:54 -0400 |
commit | 20b4fb485227404329e41ad15588afad3df23050 (patch) | |
tree | f3e099f0ab3da8a93b447203e294d2bb22f6dc05 /fs/reiserfs | |
parent | b9394d8a657cd3c064fa432aa0905c1b58b38fe9 (diff) | |
parent | ac3e3c5b1164397656df81b9e9ab4991184d3236 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS updates from Al Viro,
Misc cleanups all over the place, mainly wrt /proc interfaces (switch
create_proc_entry to proc_create(), get rid of the deprecated
create_proc_read_entry() in favor of using proc_create_data() and
seq_file etc).
7kloc removed.
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits)
don't bother with deferred freeing of fdtables
proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
proc: Make the PROC_I() and PDE() macros internal to procfs
proc: Supply a function to remove a proc entry by PDE
take cgroup_open() and cpuset_open() to fs/proc/base.c
ppc: Clean up scanlog
ppc: Clean up rtas_flash driver somewhat
hostap: proc: Use remove_proc_subtree()
drm: proc: Use remove_proc_subtree()
drm: proc: Use minor->index to label things, not PDE->name
drm: Constify drm_proc_list[]
zoran: Don't print proc_dir_entry data in debug
reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show()
proc: Supply an accessor for getting the data from a PDE's parent
airo: Use remove_proc_subtree()
rtl8192u: Don't need to save device proc dir PDE
rtl8187se: Use a dir under /proc/net/r8180/
proc: Add proc_mkdir_data()
proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h}
proc: Move PDE_NET() to fs/proc/proc_net.c
...
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/file.c | 61 | ||||
-rw-r--r-- | fs/reiserfs/procfs.c | 62 |
2 files changed, 29 insertions, 94 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 6165bd4784f6..dcaafcfc23b0 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -234,68 +234,9 @@ int reiserfs_commit_page(struct inode *inode, struct page *page, | |||
234 | return ret; | 234 | return ret; |
235 | } | 235 | } |
236 | 236 | ||
237 | /* Write @count bytes at position @ppos in a file indicated by @file | ||
238 | from the buffer @buf. | ||
239 | |||
240 | generic_file_write() is only appropriate for filesystems that are not seeking to optimize performance and want | ||
241 | something simple that works. It is not for serious use by general purpose filesystems, excepting the one that it was | ||
242 | written for (ext2/3). This is for several reasons: | ||
243 | |||
244 | * It has no understanding of any filesystem specific optimizations. | ||
245 | |||
246 | * It enters the filesystem repeatedly for each page that is written. | ||
247 | |||
248 | * It depends on reiserfs_get_block() function which if implemented by reiserfs performs costly search_by_key | ||
249 | * operation for each page it is supplied with. By contrast reiserfs_file_write() feeds as much as possible at a time | ||
250 | * to reiserfs which allows for fewer tree traversals. | ||
251 | |||
252 | * Each indirect pointer insertion takes a lot of cpu, because it involves memory moves inside of blocks. | ||
253 | |||
254 | * Asking the block allocation code for blocks one at a time is slightly less efficient. | ||
255 | |||
256 | All of these reasons for not using only generic file write were understood back when reiserfs was first miscoded to | ||
257 | use it, but we were in a hurry to make code freeze, and so it couldn't be revised then. This new code should make | ||
258 | things right finally. | ||
259 | |||
260 | Future Features: providing search_by_key with hints. | ||
261 | |||
262 | */ | ||
263 | static ssize_t reiserfs_file_write(struct file *file, /* the file we are going to write into */ | ||
264 | const char __user * buf, /* pointer to user supplied data | ||
265 | (in userspace) */ | ||
266 | size_t count, /* amount of bytes to write */ | ||
267 | loff_t * ppos /* pointer to position in file that we start writing at. Should be updated to | ||
268 | * new current position before returning. */ | ||
269 | ) | ||
270 | { | ||
271 | struct inode *inode = file_inode(file); // Inode of the file that we are writing to. | ||
272 | /* To simplify coding at this time, we store | ||
273 | locked pages in array for now */ | ||
274 | struct reiserfs_transaction_handle th; | ||
275 | th.t_trans_id = 0; | ||
276 | |||
277 | /* If a filesystem is converted from 3.5 to 3.6, we'll have v3.5 items | ||
278 | * lying around (most of the disk, in fact). Despite the filesystem | ||
279 | * now being a v3.6 format, the old items still can't support large | ||
280 | * file sizes. Catch this case here, as the rest of the VFS layer is | ||
281 | * oblivious to the different limitations between old and new items. | ||
282 | * reiserfs_setattr catches this for truncates. This chunk is lifted | ||
283 | * from generic_write_checks. */ | ||
284 | if (get_inode_item_key_version (inode) == KEY_FORMAT_3_5 && | ||
285 | *ppos + count > MAX_NON_LFS) { | ||
286 | if (*ppos >= MAX_NON_LFS) { | ||
287 | return -EFBIG; | ||
288 | } | ||
289 | if (count > MAX_NON_LFS - (unsigned long)*ppos) | ||
290 | count = MAX_NON_LFS - (unsigned long)*ppos; | ||
291 | } | ||
292 | |||
293 | return do_sync_write(file, buf, count, ppos); | ||
294 | } | ||
295 | |||
296 | const struct file_operations reiserfs_file_operations = { | 237 | const struct file_operations reiserfs_file_operations = { |
297 | .read = do_sync_read, | 238 | .read = do_sync_read, |
298 | .write = reiserfs_file_write, | 239 | .write = do_sync_write, |
299 | .unlocked_ioctl = reiserfs_ioctl, | 240 | .unlocked_ioctl = reiserfs_ioctl, |
300 | #ifdef CONFIG_COMPAT | 241 | #ifdef CONFIG_COMPAT |
301 | .compat_ioctl = reiserfs_compat_ioctl, | 242 | .compat_ioctl = reiserfs_compat_ioctl, |
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index 9cc0740adffa..33532f79b4f7 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -394,20 +394,24 @@ static int set_sb(struct super_block *sb, void *data) | |||
394 | return -ENOENT; | 394 | return -ENOENT; |
395 | } | 395 | } |
396 | 396 | ||
397 | struct reiserfs_seq_private { | ||
398 | struct super_block *sb; | ||
399 | int (*show) (struct seq_file *, struct super_block *); | ||
400 | }; | ||
401 | |||
397 | static void *r_start(struct seq_file *m, loff_t * pos) | 402 | static void *r_start(struct seq_file *m, loff_t * pos) |
398 | { | 403 | { |
399 | struct proc_dir_entry *de = m->private; | 404 | struct reiserfs_seq_private *priv = m->private; |
400 | struct super_block *s = de->parent->data; | ||
401 | loff_t l = *pos; | 405 | loff_t l = *pos; |
402 | 406 | ||
403 | if (l) | 407 | if (l) |
404 | return NULL; | 408 | return NULL; |
405 | 409 | ||
406 | if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, s))) | 410 | if (IS_ERR(sget(&reiserfs_fs_type, test_sb, set_sb, 0, priv->sb))) |
407 | return NULL; | 411 | return NULL; |
408 | 412 | ||
409 | up_write(&s->s_umount); | 413 | up_write(&priv->sb->s_umount); |
410 | return s; | 414 | return priv->sb; |
411 | } | 415 | } |
412 | 416 | ||
413 | static void *r_next(struct seq_file *m, void *v, loff_t * pos) | 417 | static void *r_next(struct seq_file *m, void *v, loff_t * pos) |
@@ -426,9 +430,8 @@ static void r_stop(struct seq_file *m, void *v) | |||
426 | 430 | ||
427 | static int r_show(struct seq_file *m, void *v) | 431 | static int r_show(struct seq_file *m, void *v) |
428 | { | 432 | { |
429 | struct proc_dir_entry *de = m->private; | 433 | struct reiserfs_seq_private *priv = m->private; |
430 | int (*show) (struct seq_file *, struct super_block *) = de->data; | 434 | return priv->show(m, v); |
431 | return show(m, v); | ||
432 | } | 435 | } |
433 | 436 | ||
434 | static const struct seq_operations r_ops = { | 437 | static const struct seq_operations r_ops = { |
@@ -440,11 +443,15 @@ static const struct seq_operations r_ops = { | |||
440 | 443 | ||
441 | static int r_open(struct inode *inode, struct file *file) | 444 | static int r_open(struct inode *inode, struct file *file) |
442 | { | 445 | { |
443 | int ret = seq_open(file, &r_ops); | 446 | struct reiserfs_seq_private *priv; |
447 | int ret = seq_open_private(file, &r_ops, | ||
448 | sizeof(struct reiserfs_seq_private)); | ||
444 | 449 | ||
445 | if (!ret) { | 450 | if (!ret) { |
446 | struct seq_file *m = file->private_data; | 451 | struct seq_file *m = file->private_data; |
447 | m->private = PDE(inode); | 452 | priv = m->private; |
453 | priv->sb = proc_get_parent_data(inode); | ||
454 | priv->show = PDE_DATA(inode); | ||
448 | } | 455 | } |
449 | return ret; | 456 | return ret; |
450 | } | 457 | } |
@@ -453,7 +460,7 @@ static const struct file_operations r_file_operations = { | |||
453 | .open = r_open, | 460 | .open = r_open, |
454 | .read = seq_read, | 461 | .read = seq_read, |
455 | .llseek = seq_lseek, | 462 | .llseek = seq_lseek, |
456 | .release = seq_release, | 463 | .release = seq_release_private, |
457 | .owner = THIS_MODULE, | 464 | .owner = THIS_MODULE, |
458 | }; | 465 | }; |
459 | 466 | ||
@@ -479,9 +486,8 @@ int reiserfs_proc_info_init(struct super_block *sb) | |||
479 | *s = '!'; | 486 | *s = '!'; |
480 | 487 | ||
481 | spin_lock_init(&__PINFO(sb).lock); | 488 | spin_lock_init(&__PINFO(sb).lock); |
482 | REISERFS_SB(sb)->procdir = proc_mkdir(b, proc_info_root); | 489 | REISERFS_SB(sb)->procdir = proc_mkdir_data(b, 0, proc_info_root, sb); |
483 | if (REISERFS_SB(sb)->procdir) { | 490 | if (REISERFS_SB(sb)->procdir) { |
484 | REISERFS_SB(sb)->procdir->data = sb; | ||
485 | add_file(sb, "version", show_version); | 491 | add_file(sb, "version", show_version); |
486 | add_file(sb, "super", show_super); | 492 | add_file(sb, "super", show_super); |
487 | add_file(sb, "per-level", show_per_level); | 493 | add_file(sb, "per-level", show_per_level); |
@@ -499,29 +505,17 @@ int reiserfs_proc_info_init(struct super_block *sb) | |||
499 | int reiserfs_proc_info_done(struct super_block *sb) | 505 | int reiserfs_proc_info_done(struct super_block *sb) |
500 | { | 506 | { |
501 | struct proc_dir_entry *de = REISERFS_SB(sb)->procdir; | 507 | struct proc_dir_entry *de = REISERFS_SB(sb)->procdir; |
502 | char b[BDEVNAME_SIZE]; | 508 | if (de) { |
503 | char *s; | 509 | char b[BDEVNAME_SIZE]; |
510 | char *s; | ||
504 | 511 | ||
505 | /* Some block devices use /'s */ | 512 | /* Some block devices use /'s */ |
506 | strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE); | 513 | strlcpy(b, reiserfs_bdevname(sb), BDEVNAME_SIZE); |
507 | s = strchr(b, '/'); | 514 | s = strchr(b, '/'); |
508 | if (s) | 515 | if (s) |
509 | *s = '!'; | 516 | *s = '!'; |
510 | 517 | ||
511 | if (de) { | 518 | remove_proc_subtree(b, proc_info_root); |
512 | remove_proc_entry("journal", de); | ||
513 | remove_proc_entry("oidmap", de); | ||
514 | remove_proc_entry("on-disk-super", de); | ||
515 | remove_proc_entry("bitmap", de); | ||
516 | remove_proc_entry("per-level", de); | ||
517 | remove_proc_entry("super", de); | ||
518 | remove_proc_entry("version", de); | ||
519 | } | ||
520 | spin_lock(&__PINFO(sb).lock); | ||
521 | __PINFO(sb).exiting = 1; | ||
522 | spin_unlock(&__PINFO(sb).lock); | ||
523 | if (proc_info_root) { | ||
524 | remove_proc_entry(b, proc_info_root); | ||
525 | REISERFS_SB(sb)->procdir = NULL; | 519 | REISERFS_SB(sb)->procdir = NULL; |
526 | } | 520 | } |
527 | return 0; | 521 | return 0; |