From: Jeff Mahoney <jeffm@suse.com>
Subject: btrfs: provide super_operations->inode_get_dev
References: bsc#927455
Patch-mainline: Never, rejected,
upstream solutions have been met with heavy resistance in
preference of unworkable fixes
In order to ensure that the per-subvolume anonymous dev_t gets published
to userspace, we need to provide the super_operations->get_inode_dev
operation.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/btrfs/btrfs_inode.h | 2 +-
fs/btrfs/super.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -211,7 +211,7 @@ struct btrfs_inode {
extern unsigned char btrfs_filetype_table[];
-static inline struct btrfs_inode *BTRFS_I(struct inode *inode)
+static inline struct btrfs_inode *BTRFS_I(const struct inode *inode)
{
return container_of(inode, struct btrfs_inode, vfs_inode);
}
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2260,6 +2260,11 @@ static int btrfs_show_devname(struct seq
return 0;
}
+static dev_t btrfs_get_inode_dev(const struct inode *inode)
+{
+ return BTRFS_I(inode)->root->anon_dev;
+}
+
static const struct super_operations btrfs_super_ops = {
.drop_inode = btrfs_drop_inode,
.evict_inode = btrfs_evict_inode,
@@ -2274,6 +2279,7 @@ static const struct super_operations btr
.remount_fs = btrfs_remount,
.freeze_fs = btrfs_freeze,
.unfreeze_fs = btrfs_unfreeze,
+ .get_inode_dev = btrfs_get_inode_dev,
};
static const struct file_operations btrfs_ctl_fops = {