diff options
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 96eb9fef7bd2..0eb9a4da069e 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include "version.h" | 54 | #include "version.h" |
55 | #include "export.h" | 55 | #include "export.h" |
56 | #include "compression.h" | 56 | #include "compression.h" |
57 | #include "rcu-string.h" | ||
57 | 58 | ||
58 | #define CREATE_TRACE_POINTS | 59 | #define CREATE_TRACE_POINTS |
59 | #include <trace/events/btrfs.h> | 60 | #include <trace/events/btrfs.h> |
@@ -1482,12 +1483,44 @@ static void btrfs_fs_dirty_inode(struct inode *inode, int flags) | |||
1482 | "error %d\n", btrfs_ino(inode), ret); | 1483 | "error %d\n", btrfs_ino(inode), ret); |
1483 | } | 1484 | } |
1484 | 1485 | ||
1486 | static int btrfs_show_devname(struct seq_file *m, struct dentry *root) | ||
1487 | { | ||
1488 | struct btrfs_fs_info *fs_info = btrfs_sb(root->d_sb); | ||
1489 | struct btrfs_fs_devices *cur_devices; | ||
1490 | struct btrfs_device *dev, *first_dev = NULL; | ||
1491 | struct list_head *head; | ||
1492 | struct rcu_string *name; | ||
1493 | |||
1494 | mutex_lock(&fs_info->fs_devices->device_list_mutex); | ||
1495 | cur_devices = fs_info->fs_devices; | ||
1496 | while (cur_devices) { | ||
1497 | head = &cur_devices->devices; | ||
1498 | list_for_each_entry(dev, head, dev_list) { | ||
1499 | if (!first_dev || dev->devid < first_dev->devid) | ||
1500 | first_dev = dev; | ||
1501 | } | ||
1502 | cur_devices = cur_devices->seed; | ||
1503 | } | ||
1504 | |||
1505 | if (first_dev) { | ||
1506 | rcu_read_lock(); | ||
1507 | name = rcu_dereference(first_dev->name); | ||
1508 | seq_escape(m, name->str, " \t\n\\"); | ||
1509 | rcu_read_unlock(); | ||
1510 | } else { | ||
1511 | WARN_ON(1); | ||
1512 | } | ||
1513 | mutex_unlock(&fs_info->fs_devices->device_list_mutex); | ||
1514 | return 0; | ||
1515 | } | ||
1516 | |||
1485 | static const struct super_operations btrfs_super_ops = { | 1517 | static const struct super_operations btrfs_super_ops = { |
1486 | .drop_inode = btrfs_drop_inode, | 1518 | .drop_inode = btrfs_drop_inode, |
1487 | .evict_inode = btrfs_evict_inode, | 1519 | .evict_inode = btrfs_evict_inode, |
1488 | .put_super = btrfs_put_super, | 1520 | .put_super = btrfs_put_super, |
1489 | .sync_fs = btrfs_sync_fs, | 1521 | .sync_fs = btrfs_sync_fs, |
1490 | .show_options = btrfs_show_options, | 1522 | .show_options = btrfs_show_options, |
1523 | .show_devname = btrfs_show_devname, | ||
1491 | .write_inode = btrfs_write_inode, | 1524 | .write_inode = btrfs_write_inode, |
1492 | .dirty_inode = btrfs_fs_dirty_inode, | 1525 | .dirty_inode = btrfs_fs_dirty_inode, |
1493 | .alloc_inode = btrfs_alloc_inode, | 1526 | .alloc_inode = btrfs_alloc_inode, |