diff mbox

[18/25] gfs2: Convert to properly refcounting bdi

Message ID 20170329105623.18241-19-jack@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kara March 29, 2017, 10:56 a.m. UTC
Similarly to set_bdev_super() GFS2 just used block device reference to
bdi. Convert it to properly getting bdi reference. The reference will
get automatically dropped on superblock destruction.

CC: Steven Whitehouse <swhiteho@redhat.com>
CC: Bob Peterson <rpeterso@redhat.com>
CC: cluster-devel@redhat.com
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/gfs2/ops_fstype.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

Comments

Christoph Hellwig April 12, 2017, 8:16 a.m. UTC | #1
On Wed, Mar 29, 2017 at 12:56:16PM +0200, Jan Kara wrote:
> Similarly to set_bdev_super() GFS2 just used block device reference to
> bdi. Convert it to properly getting bdi reference. The reference will
> get automatically dropped on superblock destruction.

Hmm, why iisn't gfs2 simply using the generic mount_bdev code?

Otherwise looks fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Steven Whitehouse April 12, 2017, 8:48 a.m. UTC | #2
Hi,


On 12/04/17 09:16, Christoph Hellwig wrote:
> On Wed, Mar 29, 2017 at 12:56:16PM +0200, Jan Kara wrote:
>> Similarly to set_bdev_super() GFS2 just used block device reference to
>> bdi. Convert it to properly getting bdi reference. The reference will
>> get automatically dropped on superblock destruction.
> Hmm, why iisn't gfs2 simply using the generic mount_bdev code?
>
> Otherwise looks fine:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>

It is more or less. However we landed up copying it because we needed a 
slight modification in order to cope with the metafs mounts. There may 
be scope to factor out the common parts I guess. We cannot select the 
root dentry until after we've parsed the mount command line, so it is 
really just the last part of the function that is different,

Steve.
diff mbox

Patch

diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index b108e7ba81af..e6b6f97d0fc1 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -23,6 +23,7 @@ 
 #include <linux/quotaops.h>
 #include <linux/lockdep.h>
 #include <linux/module.h>
+#include <linux/backing-dev.h>
 
 #include "gfs2.h"
 #include "incore.h"
@@ -1222,12 +1223,8 @@  static int set_gfs2_super(struct super_block *s, void *data)
 {
 	s->s_bdev = data;
 	s->s_dev = s->s_bdev->bd_dev;
-
-	/*
-	 * We set the bdi here to the queue backing, file systems can
-	 * overwrite this in ->fill_super()
-	 */
-	s->s_bdi = bdev_get_queue(s->s_bdev)->backing_dev_info;
+	s->s_bdi = bdi_get(s->s_bdev->bd_bdi);
+	s->s_iflags |= SB_I_DYNBDI;
 	return 0;
 }