2014-11-11 09:59:17 +01:00
|
|
|
From f775e02b0210e5128f980a19a5490c58d80bfc27 Mon Sep 17 00:00:00 2001
|
2014-05-06 13:39:23 +02:00
|
|
|
From: David Sterba <dsterba@suse.cz>
|
|
|
|
Date: Thu, 24 Apr 2014 18:57:12 +0200
|
2014-11-11 09:59:17 +01:00
|
|
|
Subject: [PATCH 14/42] btrfs-progs: compare unallocated space against the
|
2014-05-06 13:39:23 +02:00
|
|
|
correct value
|
|
|
|
|
|
|
|
The device may not be fully occupied by the filesystem, the value of
|
|
|
|
Unallocated should not be calculated against the device size but the
|
|
|
|
size provided by DEV_INFO.
|
|
|
|
|
|
|
|
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
|
|
---
|
|
|
|
cmds-device.c | 6 ++----
|
2014-11-11 09:59:17 +01:00
|
|
|
cmds-fi-disk_usage.c | 6 +++---
|
2014-05-06 13:39:23 +02:00
|
|
|
cmds-fi-disk_usage.h | 2 +-
|
2014-11-11 09:59:17 +01:00
|
|
|
3 files changed, 6 insertions(+), 8 deletions(-)
|
2014-05-06 13:39:23 +02:00
|
|
|
|
|
|
|
diff --git a/cmds-device.c b/cmds-device.c
|
2014-11-11 09:59:17 +01:00
|
|
|
index f9a23ac644c0..1de7f007ed43 100644
|
2014-05-06 13:39:23 +02:00
|
|
|
--- a/cmds-device.c
|
|
|
|
+++ b/cmds-device.c
|
2014-11-11 09:59:17 +01:00
|
|
|
@@ -489,10 +489,8 @@ static int _cmd_device_usage(int fd, char *path, int mode)
|
2014-05-06 13:39:23 +02:00
|
|
|
printf("%s, ID: %llu\n", device_info_ptr[i].path,
|
|
|
|
device_info_ptr[i].devid);
|
|
|
|
print_device_sizes(fd, &device_info_ptr[i], mode);
|
|
|
|
- print_device_chunks(fd, device_info_ptr[i].devid,
|
|
|
|
- device_info_ptr[i].size,
|
|
|
|
- info_ptr, info_count,
|
|
|
|
- mode);
|
|
|
|
+ print_device_chunks(fd, &device_info_ptr[i],
|
|
|
|
+ info_ptr, info_count, mode);
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git a/cmds-fi-disk_usage.c b/cmds-fi-disk_usage.c
|
2014-11-11 09:59:17 +01:00
|
|
|
index 83a3c6d52cc5..0ee6e6bb5dc4 100644
|
2014-05-06 13:39:23 +02:00
|
|
|
--- a/cmds-fi-disk_usage.c
|
|
|
|
+++ b/cmds-fi-disk_usage.c
|
|
|
|
@@ -847,7 +847,7 @@ int cmd_filesystem_usage(int argc, char **argv)
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
-void print_device_chunks(int fd, u64 devid, u64 total_size,
|
|
|
|
+void print_device_chunks(int fd, struct device_info *devinfo,
|
|
|
|
struct chunk_info *chunks_info_ptr,
|
|
|
|
int chunks_info_count, int mode)
|
|
|
|
{
|
|
|
|
@@ -860,7 +860,7 @@ void print_device_chunks(int fd, u64 devid, u64 total_size,
|
|
|
|
u64 flags;
|
|
|
|
u64 size;
|
|
|
|
|
|
|
|
- if (chunks_info_ptr[i].devid != devid)
|
|
|
|
+ if (chunks_info_ptr[i].devid != devinfo->devid)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
flags = chunks_info_ptr[i].type;
|
|
|
|
@@ -879,7 +879,7 @@ void print_device_chunks(int fd, u64 devid, u64 total_size,
|
|
|
|
}
|
|
|
|
printf(" Unallocated: %*s%10s\n",
|
|
|
|
(int)(20 - strlen("Unallocated")), "",
|
|
|
|
- df_pretty_sizes(total_size - allocated, mode));
|
|
|
|
+ df_pretty_sizes(devinfo->size - allocated, mode));
|
|
|
|
}
|
|
|
|
|
|
|
|
void print_device_sizes(int fd, struct device_info *devinfo, int mode)
|
|
|
|
diff --git a/cmds-fi-disk_usage.h b/cmds-fi-disk_usage.h
|
|
|
|
index 79cc2a115bc5..dbc2a10f31eb 100644
|
|
|
|
--- a/cmds-fi-disk_usage.h
|
|
|
|
+++ b/cmds-fi-disk_usage.h
|
|
|
|
@@ -50,7 +50,7 @@ int load_device_info(int fd, struct device_info **device_info_ptr,
|
|
|
|
int *device_info_count);
|
|
|
|
int load_chunk_info(int fd, struct chunk_info **info_ptr, int *info_count);
|
|
|
|
char *df_pretty_sizes(u64 size, int mode);
|
|
|
|
-void print_device_chunks(int fd, u64 devid, u64 total_size,
|
|
|
|
+void print_device_chunks(int fd, struct device_info *devinfo,
|
|
|
|
struct chunk_info *chunks_info_ptr,
|
|
|
|
int chunks_info_count, int mode);
|
|
|
|
void print_device_sizes(int fd, struct device_info *devinfo, int mode);
|
|
|
|
--
|
2014-11-11 09:59:17 +01:00
|
|
|
2.1.1
|
2014-05-06 13:39:23 +02:00
|
|
|
|