[PATCH v2 2/5] handle null pointers in btrfs_prepare_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When calling the function from `btrfs device zero-super` we don't need
the additional information returned and don't want the "SMALL VOLUME"
warning printed.

Signed-off-by: Hubert Kario <kario@xxxxxxxxxx>

diff --git a/utils.c b/utils.c
index ee7fa1b..6773be0 100644
--- a/utils.c
+++ b/utils.c
@@ -557,7 +557,7 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret,
 	}
 	zero_end = 1;
 
-	if (block_count < 1024 * 1024 * 1024 && !(*mixed)) {
+	if (mixed && block_count < 1024 * 1024 * 1024 && !(*mixed)) {
 		printf("SMALL VOLUME: forcing mixed metadata/data groups\n");
 		*mixed = 1;
 	}
@@ -588,7 +588,9 @@ int btrfs_prepare_device(int fd, char *file, int zero_end, u64 *block_count_ret,
 			exit(1);
 		}
 	}
-	*block_count_ret = block_count;
+
+	if (block_count_ret)
+		*block_count_ret = block_count;
 	return 0;
 }
 
-- 
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux