/* 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)
/* 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)
{
	int err;
	bdi->name = "btrfs";
	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) {
		bdi_destroy(bdi);
		return err;
	}
	bdi->ra_pages	= default_backing_dev_info.ra_pages;
	bdi->unplug_io_fn	= btrfs_unplug_io_fn;
	bdi->unplug_io_data	= info;
	bdi->congested_fn	= btrfs_congested_fn;
	bdi->congested_data	= info;
	return 0;
}