diff options
author | Chris Mason <chris.mason@oracle.com> | 2008-03-24 15:02:04 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:01 -0400 |
commit | a9218f6b00ada101c9772ee9c44af04fa5125d2a (patch) | |
tree | 2d4896c8cbbcdf0544576a4af48889501345360a | |
parent | 7d1660d411a24f9b5a2f38e41c9896d7151c934f (diff) |
Add /dev/btrfs-control for device scanning ioctls
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 4 | ||||
-rw-r--r-- | fs/btrfs/super.c | 41 |
2 files changed, 40 insertions, 5 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 5e392804ab15..14eb8fc87015 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -374,10 +374,6 @@ again: | |||
374 | found_group = cache; | 374 | found_group = cache; |
375 | goto found; | 375 | goto found; |
376 | } | 376 | } |
377 | if (full_search) { | ||
378 | printk("failed on cache %Lu used %Lu total %Lu\n", | ||
379 | cache->key.objectid, used, cache->key.offset); | ||
380 | } | ||
381 | cond_resched(); | 377 | cond_resched(); |
382 | } | 378 | } |
383 | if (!full_search) { | 379 | if (!full_search) { |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 4423a91206a1..67ed216df475 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/parser.h> | 36 | #include <linux/parser.h> |
37 | #include <linux/ctype.h> | 37 | #include <linux/ctype.h> |
38 | #include <linux/namei.h> | 38 | #include <linux/namei.h> |
39 | #include <linux/miscdevice.h> | ||
39 | #include "ctree.h" | 40 | #include "ctree.h" |
40 | #include "disk-io.h" | 41 | #include "disk-io.h" |
41 | #include "transaction.h" | 42 | #include "transaction.h" |
@@ -444,6 +445,13 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
444 | return 0; | 445 | return 0; |
445 | } | 446 | } |
446 | 447 | ||
448 | static long btrfs_control_ioctl(struct file *file, unsigned int cmd, | ||
449 | unsigned long arg) | ||
450 | { | ||
451 | printk("btrfs control ioctl %d\n", cmd); | ||
452 | return 0; | ||
453 | } | ||
454 | |||
447 | static struct file_system_type btrfs_fs_type = { | 455 | static struct file_system_type btrfs_fs_type = { |
448 | .owner = THIS_MODULE, | 456 | .owner = THIS_MODULE, |
449 | .name = "btrfs", | 457 | .name = "btrfs", |
@@ -451,6 +459,7 @@ static struct file_system_type btrfs_fs_type = { | |||
451 | .kill_sb = kill_block_super, | 459 | .kill_sb = kill_block_super, |
452 | .fs_flags = FS_REQUIRES_DEV, | 460 | .fs_flags = FS_REQUIRES_DEV, |
453 | }; | 461 | }; |
462 | |||
454 | static void btrfs_write_super_lockfs(struct super_block *sb) | 463 | static void btrfs_write_super_lockfs(struct super_block *sb) |
455 | { | 464 | { |
456 | struct btrfs_root *root = btrfs_sb(sb); | 465 | struct btrfs_root *root = btrfs_sb(sb); |
@@ -482,6 +491,30 @@ static struct super_operations btrfs_super_ops = { | |||
482 | .write_super_lockfs = btrfs_write_super_lockfs, | 491 | .write_super_lockfs = btrfs_write_super_lockfs, |
483 | .unlockfs = btrfs_unlockfs, | 492 | .unlockfs = btrfs_unlockfs, |
484 | }; | 493 | }; |
494 | |||
495 | static const struct file_operations btrfs_ctl_fops = { | ||
496 | .unlocked_ioctl = btrfs_control_ioctl, | ||
497 | .compat_ioctl = btrfs_control_ioctl, | ||
498 | .owner = THIS_MODULE, | ||
499 | }; | ||
500 | |||
501 | static struct miscdevice btrfs_misc = { | ||
502 | .minor = MISC_DYNAMIC_MINOR, | ||
503 | .name = "btrfs-control", | ||
504 | .fops = &btrfs_ctl_fops | ||
505 | }; | ||
506 | |||
507 | static int btrfs_interface_init(void) | ||
508 | { | ||
509 | return misc_register(&btrfs_misc); | ||
510 | } | ||
511 | |||
512 | void btrfs_interface_exit(void) | ||
513 | { | ||
514 | if (misc_deregister(&btrfs_misc) < 0) | ||
515 | printk("misc_deregister failed for control device"); | ||
516 | } | ||
517 | |||
485 | static int __init init_btrfs_fs(void) | 518 | static int __init init_btrfs_fs(void) |
486 | { | 519 | { |
487 | int err; | 520 | int err; |
@@ -503,11 +536,16 @@ static int __init init_btrfs_fs(void) | |||
503 | if (err) | 536 | if (err) |
504 | goto free_extent_io; | 537 | goto free_extent_io; |
505 | 538 | ||
506 | err = register_filesystem(&btrfs_fs_type); | 539 | err = btrfs_interface_init(); |
507 | if (err) | 540 | if (err) |
508 | goto free_extent_map; | 541 | goto free_extent_map; |
542 | err = register_filesystem(&btrfs_fs_type); | ||
543 | if (err) | ||
544 | goto unregister_ioctl; | ||
509 | return 0; | 545 | return 0; |
510 | 546 | ||
547 | unregister_ioctl: | ||
548 | btrfs_interface_exit(); | ||
511 | free_extent_map: | 549 | free_extent_map: |
512 | extent_map_exit(); | 550 | extent_map_exit(); |
513 | free_extent_io: | 551 | free_extent_io: |
@@ -526,6 +564,7 @@ static void __exit exit_btrfs_fs(void) | |||
526 | btrfs_destroy_cachep(); | 564 | btrfs_destroy_cachep(); |
527 | extent_map_exit(); | 565 | extent_map_exit(); |
528 | extent_io_exit(); | 566 | extent_io_exit(); |
567 | btrfs_interface_exit(); | ||
529 | unregister_filesystem(&btrfs_fs_type); | 568 | unregister_filesystem(&btrfs_fs_type); |
530 | btrfs_exit_sysfs(); | 569 | btrfs_exit_sysfs(); |
531 | } | 570 | } |