dm persistent data: create new dm_block_manager struct

This patch introduces a separate struct for the block_manager.
It also uses IS_ERR to check the return value of dm_bufio_client_create
instead of testing incorrectly for NULL.

Prior to this patch a struct dm_block_manager was really an alias for
a struct dm_bufio_client.  We want to add some functionality to the
block manager that will require extra fields, so this one to one
mapping is no longer valid.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 82b82c3..afd84ca 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -681,10 +681,11 @@
 	bm = dm_block_manager_create(bdev, THIN_METADATA_BLOCK_SIZE,
 				     THIN_METADATA_CACHE_SIZE,
 				     THIN_MAX_CONCURRENT_LOCKS);
-	if (!bm) {
+	if (IS_ERR(bm)) {
+		r = PTR_ERR(bm);
 		DMERR("could not create block manager");
 		kfree(pmd);
-		return ERR_PTR(-ENOMEM);
+		return ERR_PTR(r);
 	}
 
 	r = superblock_all_zeroes(bm, &create);
@@ -694,7 +695,6 @@
 		return ERR_PTR(r);
 	}
 
-
 	r = init_pmd(pmd, bm, 0, create);
 	if (r) {
 		dm_block_manager_destroy(bm);