From ad081f1430515d0b727eba99ec435a526c61a599 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 12 Jun 2009 14:43:40 +0200 Subject: btrfs: properly register fs backing device btrfs assigns this bdi to all inodes on that file system, so make sure it's registered. This isn't really important now, but will be when we put dirty inodes there. Even now, we miss the stats when the bdi isn't visible. Also fixes failure to check bdi_init() return value, and bad inherit of ->capabilities flags from the default bdi. Acked-by: Chris Mason Signed-off-by: Jens Axboe --- fs/btrfs/disk-io.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'fs') diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 0d50d49d990a..d28d29c95f7c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -42,6 +42,8 @@ static struct extent_io_ops btree_extent_io_ops; static void end_workqueue_fn(struct btrfs_work *work); +static atomic_t btrfs_bdi_num = ATOMIC_INIT(0); + /* * end_io_wq structs are used to do processing in task context when an IO is * complete. This is used during reads to verify checksums, and it is used @@ -1342,12 +1344,25 @@ static void btrfs_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) free_extent_map(em); } +/* + * If this fails, caller must call bdi_destroy() to get rid of the + * bdi again. + */ static int setup_bdi(struct btrfs_fs_info *info, struct backing_dev_info *bdi) { - bdi_init(bdi); + int err; + + bdi->capabilities = BDI_CAP_MAP_COPY; + err = bdi_init(bdi); + if (err) + return err; + + err = bdi_register(bdi, NULL, "btrfs-%d", + atomic_inc_return(&btrfs_bdi_num)); + if (err) + return err; + bdi->ra_pages = default_backing_dev_info.ra_pages; - bdi->state = 0; - bdi->capabilities = default_backing_dev_info.capabilities; bdi->unplug_io_fn = btrfs_unplug_io_fn; bdi->unplug_io_data = info; bdi->congested_fn = btrfs_congested_fn; @@ -1569,7 +1584,8 @@ struct btrfs_root *open_ctree(struct super_block *sb, fs_info->sb = sb; fs_info->max_extent = (u64)-1; fs_info->max_inline = 8192 * 1024; - setup_bdi(fs_info, &fs_info->bdi); + if (setup_bdi(fs_info, &fs_info->bdi)) + goto fail_bdi; fs_info->btree_inode = new_inode(sb); fs_info->btree_inode->i_ino = 1; fs_info->btree_inode->i_nlink = 1; @@ -1946,8 +1962,8 @@ fail_iput: btrfs_close_devices(fs_info->fs_devices); btrfs_mapping_tree_free(&fs_info->mapping_tree); +fail_bdi: bdi_destroy(&fs_info->bdi); - fail: kfree(extent_root); kfree(tree_root); -- cgit v1.2.3-59-g8ed1b From a979eff1811a07f5fd331c5f6f727370747b42ad Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 29 May 2009 09:19:23 +0200 Subject: ubifs: register backing_dev_info Signed-off-by: Jens Axboe --- fs/ubifs/super.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs') diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 3589eab02a2f..3260b73abe29 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1937,6 +1937,9 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) err = bdi_init(&c->bdi); if (err) goto out_close; + err = bdi_register(&c->bdi, NULL, "ubifs"); + if (err) + goto out_bdi; err = ubifs_parse_options(c, data, 0); if (err) -- cgit v1.2.3-59-g8ed1b From e212d6f25084e8e9b02a04ba514d7bb1e4a4924a Mon Sep 17 00:00:00 2001 From: Li Zefan Date: Tue, 16 Jun 2009 11:19:36 +0200 Subject: block: remove some includings of blktrace_api.h When porting blktrace to tracepoints, we changed to trace/block.h for trace prober declarations. Signed-off-by: Li Zefan Signed-off-by: Jens Axboe --- block/blk-core.c | 1 - drivers/block/cciss.c | 1 - drivers/md/dm.c | 1 - fs/bio.c | 1 - mm/bounce.c | 1 - mm/highmem.c | 1 - 6 files changed, 6 deletions(-) (limited to 'fs') diff --git a/block/blk-core.c b/block/blk-core.c index 94d88fabc4bd..b06cf5c2a829 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #define CREATE_TRACE_POINTS diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index b22cec97ea19..c7a527c08a09 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -38,7 +38,6 @@ #include #include #include -#include #include #include diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 3fd8b1e65483..48db308fae67 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -19,7 +19,6 @@ #include #include #include -#include #include diff --git a/fs/bio.c b/fs/bio.c index 5f80848c320c..24c914043532 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -25,7 +25,6 @@ #include #include #include -#include #include /* for struct sg_iovec */ #include diff --git a/mm/bounce.c b/mm/bounce.c index 4ebe3ea83795..a2b76a588e34 100644 --- a/mm/bounce.c +++ b/mm/bounce.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/mm/highmem.c b/mm/highmem.c index 68eb1d9b63fa..25878cc49daa 100644 --- a/mm/highmem.c +++ b/mm/highmem.c @@ -26,7 +26,6 @@ #include #include #include -#include #include /* -- cgit v1.2.3-59-g8ed1b