Skip to contentSkip to conversation

libquota: fix quota usage compute

PATCH Applied Niu 2 participants 2 messages Nov 6, 2011 – Nov 14, 2011

lore
Share & tools
lore

Niu

author
#0 lore raw

PATCH 3/3 libquota: fix quota usage compute

In quota_compute_usage(), the space usage should be in bytes but not quota block.

---
 lib/quota/mkquota.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
lib/quota/mkquota.c +1 -2
index 2abb2d4..832b135 100644
@@ -402,8 +402,7 @@ errcode_t quota_compute_usage(quota_ctx_t qctx)
 		if (ino == 0)
 			break;
 		if (inode.i_links_count) {
-			/* Convert i_blocks to # of 1k blocks */
-			space = (ext2fs_inode_i_blocks(fs, &inode) + 1) >> 1;
+			space = ext2fs_inode_i_blocks(fs, &inode) << 9;
 			quota_data_add(qctx, &inode, ino, space);
 			quota_data_inodes(qctx, &inode, ino, +1);
 		}

-- 1.7.1