From 72ab53e8bbec970be33a26e3dd0578aedfa37ec3 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Fri, 22 Aug 2008 18:23:22 +0300 Subject: [PATCH] --- yaml --- r: 109720 b: refs/heads/master c: 9bbb5726efb64e2cfed42f6eec07db80cd87e63b h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ubifs/super.c | 6 ++++++ trunk/fs/ubifs/ubifs.h | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index ffe03c7e7b4e..1f9c04ca4338 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 131130b9a1e6e523c64b34137b14f88ae1382a6a +refs/heads/master: 9bbb5726efb64e2cfed42f6eec07db80cd87e63b diff --git a/trunk/fs/ubifs/super.c b/trunk/fs/ubifs/super.c index 1018053519e6..be23fd3cfd84 100644 --- a/trunk/fs/ubifs/super.c +++ b/trunk/fs/ubifs/super.c @@ -530,6 +530,12 @@ static int init_constants_early(struct ubifs_info *c) c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size); c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size); + /* + * Calculate how many bytes would be wasted at the end of LEB if it was + * fully filled with data nodes of maximum size. This is used in + * calculations when reporting free space. + */ + c->leb_overhead = c->leb_size % UBIFS_MAX_DATA_NODE_SZ; return 0; } diff --git a/trunk/fs/ubifs/ubifs.h b/trunk/fs/ubifs/ubifs.h index 681d46e16286..57e58541de28 100644 --- a/trunk/fs/ubifs/ubifs.h +++ b/trunk/fs/ubifs/ubifs.h @@ -995,6 +995,9 @@ struct ubifs_mount_opts { * @max_idx_node_sz: maximum indexing node aligned on 8-bytes boundary * @max_inode_sz: maximum possible inode size in bytes * @max_znode_sz: size of znode in bytes + * + * @leb_overhead: how many bytes are wasted in an LEB when it is filled with + * data nodes of maximum size - used in free space reporting * @dead_wm: LEB dead space watermark * @dark_wm: LEB dark space watermark * @block_cnt: count of 4KiB blocks on the FS @@ -1226,6 +1229,8 @@ struct ubifs_info { int max_idx_node_sz; long long max_inode_sz; int max_znode_sz; + + int leb_overhead; int dead_wm; int dark_wm; int block_cnt;