Skip to contentSkip to conversation

btrfs-progs: v4, move out print in cmd_df to another function

PATCH RESEND Anand Jain 1 participant 1 message Sep 13, 2013 Btrfs file system

lore
Share & tools
lore

Anand Jain

author
#0 lore raw

all of them were considered, v5 sent out.

Thanks, Anand

Review

Quoted 10 lines
(quoted diff) +9 -1
-	path = argv[1];
+	switch (flag & BTRFS_BLOCK_GROUP_TYPE_MASK) {
+	case BTRFS_BLOCK_GROUP_DATA:
+		return "data";
+	case BTRFS_BLOCK_GROUP_SYSTEM:
+		return "system";
+	case BTRFS_BLOCK_GROUP_METADATA:
+		return "metadata";
+	case BTRFS_BLOCK_GROUP_DATA|BTRFS_BLOCK_GROUP_METADATA:
+		return "mixed";

I think the profile names should stay unchanged, ie Data, System etc, and Data+Metadata instead of mixed. We can change the output format later, but for this preparatory patch I'd stick with what it is.

Quoted 4 lines
(quoted diff) +4 -0
+	default:
+		return "unknown";
+	}
+}

Review

Quoted 10 lines
(quoted diff) +5 -4
 
-	fd = open_file_or_dir(path, &dirstream);
-	if (fd < 0) {
-		fprintf(stderr, "ERROR: can't access to '%s'\n", path);
-		return 12;
+static char *group_profile_str(u64 flag)
+{
+	switch (flag & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
+	case 0:
+		return "single";

The 'single' profile was not explicitly mentioned before, I tend to think that it's better to be consistent with the rest and add it as you do in this patch.

Sample output:

$ ./btrfs fi df /mnt/enospc/mnt
data, single: total=5.92GiB, used=4.41GiB
system, DUP: total=8.00MiB, used=4.00KiB
system, single: total=4.00MiB, used=0.00
metadata, DUP: total=1.02GiB, used=828.10MiB
metadata, single: total=8.00MiB, used=0.00

looks imho ok.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html