]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fs: Get proper reference for s_bdi
authorJan Kara <jack@suse.cz>
Wed, 12 Apr 2017 10:24:29 +0000 (12:24 +0200)
committerJens Axboe <axboe@fb.com>
Thu, 20 Apr 2017 18:09:55 +0000 (12:09 -0600)
So far we just relied on block device to hold a bdi reference for us
while the filesystem is mounted. While that works perfectly fine, it is
a bit awkward that we have a pointer to a refcounted structure in the
superblock without proper reference. So make s_bdi hold a proper
reference to block device's BDI. No filesystem using mount_bdev()
actually changes s_bdi so this is safe and will make bdev filesystems
work the same way as filesystems needing to set up their private bdi.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
fs/super.c

index 0f51a437c269a7517389154db5d0e81d93fa44da..e267d3a00144ae0123136ea5bb28eaf9cd46c512 100644 (file)
@@ -1054,12 +1054,9 @@ static int set_bdev_super(struct super_block *s, void *data)
 {
        s->s_bdev = data;
        s->s_dev = s->s_bdev->bd_dev;
+       s->s_bdi = bdi_get(s->s_bdev->bd_bdi);
+       s->s_iflags |= SB_I_DYNBDI;
 
-       /*
-        * 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;
        return 0;
 }