diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2009-09-16 09:02:33 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-09-16 09:18:51 -0400 |
commit | 32a88aa1b6dfb901cec64e1898cac78d0f25028a (patch) | |
tree | 51aa6f56ccfca53f495d015645373317bdee3647 | |
parent | c4a77a6c7dcff04a2abc7fe4b6b2ae605be41c5b (diff) |
fs: Assign bdi in super_block
We do this automatically in get_sb_bdev() from the set_bdev_super()
callback. Filesystems that have their own private backing_dev_info
must assign that in ->fill_super().
Note that ->s_bdi assignment is required for proper writeback!
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r-- | fs/btrfs/disk-io.c | 1 | ||||
-rw-r--r-- | fs/fuse/inode.c | 2 | ||||
-rw-r--r-- | fs/nfs/super.c | 2 | ||||
-rw-r--r-- | fs/super.c | 6 | ||||
-rw-r--r-- | fs/sync.c | 9 | ||||
-rw-r--r-- | fs/ubifs/super.c | 1 | ||||
-rw-r--r-- | include/linux/fs.h | 1 |
7 files changed, 21 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 15831d5c7367..8b8192790011 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1600,6 +1600,7 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1600 | 1600 | ||
1601 | sb->s_blocksize = 4096; | 1601 | sb->s_blocksize = 4096; |
1602 | sb->s_blocksize_bits = blksize_bits(4096); | 1602 | sb->s_blocksize_bits = blksize_bits(4096); |
1603 | sb->s_bdi = &fs_info->bdi; | ||
1603 | 1604 | ||
1604 | /* | 1605 | /* |
1605 | * we set the i_size on the btree inode to the max possible int. | 1606 | * we set the i_size on the btree inode to the max possible int. |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 4567db6f9430..e5dbecd87b0f 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -894,6 +894,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
894 | if (err) | 894 | if (err) |
895 | goto err_put_conn; | 895 | goto err_put_conn; |
896 | 896 | ||
897 | sb->s_bdi = &fc->bdi; | ||
898 | |||
897 | /* Handle umasking inside the fuse code */ | 899 | /* Handle umasking inside the fuse code */ |
898 | if (sb->s_flags & MS_POSIXACL) | 900 | if (sb->s_flags & MS_POSIXACL) |
899 | fc->dont_mask = 1; | 901 | fc->dont_mask = 1; |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index 867f70504531..de935692d40d 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -1918,6 +1918,8 @@ static inline void nfs_initialise_sb(struct super_block *sb) | |||
1918 | if (server->flags & NFS_MOUNT_NOAC) | 1918 | if (server->flags & NFS_MOUNT_NOAC) |
1919 | sb->s_flags |= MS_SYNCHRONOUS; | 1919 | sb->s_flags |= MS_SYNCHRONOUS; |
1920 | 1920 | ||
1921 | sb->s_bdi = &server->backing_dev_info; | ||
1922 | |||
1921 | nfs_super_set_maxbytes(sb, server->maxfilesize); | 1923 | nfs_super_set_maxbytes(sb, server->maxfilesize); |
1922 | } | 1924 | } |
1923 | 1925 | ||
diff --git a/fs/super.c b/fs/super.c index 9cda337ddae2..b03fea8fbfb6 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -707,6 +707,12 @@ static int set_bdev_super(struct super_block *s, void *data) | |||
707 | { | 707 | { |
708 | s->s_bdev = data; | 708 | s->s_bdev = data; |
709 | s->s_dev = s->s_bdev->bd_dev; | 709 | s->s_dev = s->s_bdev->bd_dev; |
710 | |||
711 | /* | ||
712 | * We set the bdi here to the queue backing, file systems can | ||
713 | * overwrite this in ->fill_super() | ||
714 | */ | ||
715 | s->s_bdi = &bdev_get_queue(s->s_bdev)->backing_dev_info; | ||
710 | return 0; | 716 | return 0; |
711 | } | 717 | } |
712 | 718 | ||
@@ -27,6 +27,13 @@ | |||
27 | */ | 27 | */ |
28 | static int __sync_filesystem(struct super_block *sb, int wait) | 28 | static int __sync_filesystem(struct super_block *sb, int wait) |
29 | { | 29 | { |
30 | /* | ||
31 | * This should be safe, as we require bdi backing to actually | ||
32 | * write out data in the first place | ||
33 | */ | ||
34 | if (!sb->s_bdi) | ||
35 | return 0; | ||
36 | |||
30 | /* Avoid doing twice syncing and cache pruning for quota sync */ | 37 | /* Avoid doing twice syncing and cache pruning for quota sync */ |
31 | if (!wait) { | 38 | if (!wait) { |
32 | writeout_quota_sb(sb, -1); | 39 | writeout_quota_sb(sb, -1); |
@@ -101,7 +108,7 @@ restart: | |||
101 | spin_unlock(&sb_lock); | 108 | spin_unlock(&sb_lock); |
102 | 109 | ||
103 | down_read(&sb->s_umount); | 110 | down_read(&sb->s_umount); |
104 | if (!(sb->s_flags & MS_RDONLY) && sb->s_root) | 111 | if (!(sb->s_flags & MS_RDONLY) && sb->s_root && sb->s_bdi) |
105 | __sync_filesystem(sb, wait); | 112 | __sync_filesystem(sb, wait); |
106 | up_read(&sb->s_umount); | 113 | up_read(&sb->s_umount); |
107 | 114 | ||
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 51763aa8f4de..c4af069df1ad 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -1980,6 +1980,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) | |||
1980 | if (err) | 1980 | if (err) |
1981 | goto out_bdi; | 1981 | goto out_bdi; |
1982 | 1982 | ||
1983 | sb->s_bdi = &c->bdi; | ||
1983 | sb->s_fs_info = c; | 1984 | sb->s_fs_info = c; |
1984 | sb->s_magic = UBIFS_SUPER_MAGIC; | 1985 | sb->s_magic = UBIFS_SUPER_MAGIC; |
1985 | sb->s_blocksize = UBIFS_BLOCK_SIZE; | 1986 | sb->s_blocksize = UBIFS_BLOCK_SIZE; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index db29588874ac..90162fb3bf04 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1342,6 +1342,7 @@ struct super_block { | |||
1342 | int s_nr_dentry_unused; /* # of dentry on lru */ | 1342 | int s_nr_dentry_unused; /* # of dentry on lru */ |
1343 | 1343 | ||
1344 | struct block_device *s_bdev; | 1344 | struct block_device *s_bdev; |
1345 | struct backing_dev_info *s_bdi; | ||
1345 | struct mtd_info *s_mtd; | 1346 | struct mtd_info *s_mtd; |
1346 | struct list_head s_instances; | 1347 | struct list_head s_instances; |
1347 | struct quota_info s_dquot; /* Diskquota specific options */ | 1348 | struct quota_info s_dquot; /* Diskquota specific options */ |