diff mbox

[v2,16/35] ubifs: fill ->s_dev in ubifs_fill_super

Message ID 1438235311-23788-17-git-send-email-yangds.fnst@cn.fujitsu.com
State Superseded
Headers show

Commit Message

Dongsheng Yang July 30, 2015, 5:48 a.m. UTC
Some tools in userspace, such as quota-tools, are using
stat() to get the st_dev of a mount point then to find
out the device mounted on this mount point.

So we have to fill ->s_dev here to tell them which device
is mounted on this point.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 fs/ubifs/super.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Richard Weinberger Aug. 3, 2015, 9 p.m. UTC | #1
Am 30.07.2015 um 07:48 schrieb Dongsheng Yang:
> Some tools in userspace, such as quota-tools, are using
> stat() to get the st_dev of a mount point then to find
> out the device mounted on this mount point.
> 
> So we have to fill ->s_dev here to tell them which device
> is mounted on this point.
> 
> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
> ---
>  fs/ubifs/super.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 27e1739..161b1a6 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -36,6 +36,7 @@
>  #include <linux/mount.h>
>  #include <linux/math64.h>
>  #include <linux/writeback.h>
> +#include <linux/cdev.h>
>  #include "ubifs.h"
>  
>  /*
> @@ -2033,6 +2034,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
>  
>  	sb->s_bdi = &c->bdi;
>  	sb->s_cdev = ubi_get_volume_cdev(c->ubi);
> +	sb->s_dev = sb->s_cdev->dev;
>  	sb->s_fs_info = c;
>  	sb->s_magic = UBIFS_SUPER_MAGIC;
>  	sb->s_blocksize = UBIFS_BLOCK_SIZE;
> 

As long userspace is fine with the fact that UBI device nodes are dynamically allocated it should work. :)

Reviewed-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard
diff mbox

Patch

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 27e1739..161b1a6 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -36,6 +36,7 @@ 
 #include <linux/mount.h>
 #include <linux/math64.h>
 #include <linux/writeback.h>
+#include <linux/cdev.h>
 #include "ubifs.h"
 
 /*
@@ -2033,6 +2034,7 @@  static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
 
 	sb->s_bdi = &c->bdi;
 	sb->s_cdev = ubi_get_volume_cdev(c->ubi);
+	sb->s_dev = sb->s_cdev->dev;
 	sb->s_fs_info = c;
 	sb->s_magic = UBIFS_SUPER_MAGIC;
 	sb->s_blocksize = UBIFS_BLOCK_SIZE;