summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorweiping zhang <zhangweiping@didichuxing.com>2017-10-31 18:37:54 +0800
committerJens Axboe <axboe@kernel.dk>2017-11-19 11:02:13 -0700
commit97f07697932e6faf2a708f7aef7cba8e6b0cab96 (patch)
treeec10aec46015360c8f753e068f58f179f421b886
parent0192f17529fa3f8d78ca0181a2b2aaa7cbb0784d (diff)
downloadlinux-stable-97f07697932e6faf2a708f7aef7cba8e6b0cab96.tar.gz
linux-stable-97f07697932e6faf2a708f7aef7cba8e6b0cab96.tar.bz2
linux-stable-97f07697932e6faf2a708f7aef7cba8e6b0cab96.zip
bdi: convert bdi_debug_register to int
Convert bdi_debug_register to int and then do error handle for it. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: weiping zhang <zhangweiping@didichuxing.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--mm/backing-dev.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 74b52dfd5852..b5f940ce0143 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -113,11 +113,23 @@ static const struct file_operations bdi_debug_stats_fops = {
.release = single_release,
};
-static void bdi_debug_register(struct backing_dev_info *bdi, const char *name)
+static int bdi_debug_register(struct backing_dev_info *bdi, const char *name)
{
+ if (!bdi_debug_root)
+ return -ENOMEM;
+
bdi->debug_dir = debugfs_create_dir(name, bdi_debug_root);
+ if (!bdi->debug_dir)
+ return -ENOMEM;
+
bdi->debug_stats = debugfs_create_file("stats", 0444, bdi->debug_dir,
bdi, &bdi_debug_stats_fops);
+ if (!bdi->debug_stats) {
+ debugfs_remove(bdi->debug_dir);
+ return -ENOMEM;
+ }
+
+ return 0;
}
static void bdi_debug_unregister(struct backing_dev_info *bdi)
@@ -129,9 +141,10 @@ static void bdi_debug_unregister(struct backing_dev_info *bdi)
static inline void bdi_debug_init(void)
{
}
-static inline void bdi_debug_register(struct backing_dev_info *bdi,
+static inline int bdi_debug_register(struct backing_dev_info *bdi,
const char *name)
{
+ return 0;
}
static inline void bdi_debug_unregister(struct backing_dev_info *bdi)
{