diff mbox

btrfs-progs:qgroup:make large size aligned

Message ID 1421977849-5822-1-git-send-email-fancn.fnst@cn.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Fan Chengniang Jan. 23, 2015, 1:50 a.m. UTC
problem: when the size is too big, the output format will be unaligned.
the __update__columns_max_len function has been updated to fix this
problem

Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
---
In my patch "[PATCH v3] make btrfs qgroups show human readable sizes"
I forget to update the function __update__columns_max_len which may
cause large size unaligned.

 qgroup.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

David Sterba Jan. 23, 2015, 1:24 p.m. UTC | #1
On Fri, Jan 23, 2015 at 09:50:49AM +0800, Fan Chengniang wrote:
> problem: when the size is too big, the output format will be unaligned.
> the __update__columns_max_len function has been updated to fix this
> problem
> 
> Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
> ---
> In my patch "[PATCH v3] make btrfs qgroups show human readable sizes"
> I forget to update the function __update__columns_max_len which may
> cause large size unaligned.

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

Patch

diff --git a/qgroup.c b/qgroup.c
index 8ec55df..3e4a6ed 100644
--- a/qgroup.c
+++ b/qgroup.c
@@ -915,6 +915,7 @@  static void __update_columns_max_len(struct btrfs_qgroup *bq,
 	struct btrfs_qgroup_list *list = NULL;
 	char tmp[100];
 	int len;
+	unsigned unit_mode = btrfs_qgroup_columns[column].unit_mode;
 
 	switch (column) {
 
@@ -926,26 +927,22 @@  static void __update_columns_max_len(struct btrfs_qgroup *bq,
 			btrfs_qgroup_columns[column].max_len = len;
 		break;
 	case BTRFS_QGROUP_RFER:
-		sprintf(tmp, "%llu", bq->rfer);
-		len = strlen(tmp);
+		len = strlen(pretty_size_mode(bq->rfer, unit_mode));
 		if (btrfs_qgroup_columns[column].max_len < len)
 			btrfs_qgroup_columns[column].max_len = len;
 		break;
 	case BTRFS_QGROUP_EXCL:
-		sprintf(tmp, "%llu", bq->excl);
-		len = strlen(tmp);
+		len = strlen(pretty_size_mode(bq->excl, unit_mode));
 		if (btrfs_qgroup_columns[column].max_len < len)
 			btrfs_qgroup_columns[column].max_len = len;
 		break;
 	case BTRFS_QGROUP_MAX_RFER:
-		sprintf(tmp, "%llu", bq->max_rfer);
-		len = strlen(tmp);
+		len = strlen(pretty_size_mode(bq->max_rfer, unit_mode));
 		if (btrfs_qgroup_columns[column].max_len < len)
 			btrfs_qgroup_columns[column].max_len = len;
 		break;
 	case BTRFS_QGROUP_MAX_EXCL:
-		sprintf(tmp, "%llu", bq->max_excl);
-		len = strlen(tmp);
+		len = strlen(pretty_size_mode(bq->max_excl, unit_mode));
 		if (btrfs_qgroup_columns[column].max_len < len)
 			btrfs_qgroup_columns[column].max_len = len;
 		break;