Skip to content

Commit

Permalink
bdi: convert bdi_debug_register to int
Browse files Browse the repository at this point in the history
Convert bdi_debug_register to int and then do error handle for it.

Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: weiping zhang <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
weiping zhang authored and axboe committed Nov 19, 2017
1 parent 0192f17 commit 97f0769
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions mm/backing-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
{
Expand Down

0 comments on commit 97f0769

Please sign in to comment.