From: boxi liu <boxi10liu@gmail.com>
Date: Mon, 1 Jul 2013 12:12:37 +0000 (-0400)
Subject: ext4: improve free space calculation for inline_data
X-Git-Tag: firefly_0821_release~176^2~5664^2~23
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c4932dbe63dae2d23b4f596caa5d286ebfe042cf;p=firefly-linux-kernel-4.4.55.git

ext4: improve free space calculation for inline_data

In ext4 feature inline_data,it use the xattr's space to store the
inline data in inode.When we calculate the inline data as the xattr,we
add the pad.But in get_max_inline_xattr_value_size() function we count
the free space without pad.It cause some contents are moved to a block
even if it can be
stored in the inode.

Signed-off-by: liulei <lewis.liulei@huawei.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Tao Ma <boyu.mt@taobao.com>
---

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 33331b4c2178..b8a07466144f 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -72,7 +72,7 @@ static int get_max_inline_xattr_value_size(struct inode *inode,
 		entry = (struct ext4_xattr_entry *)
 			((void *)raw_inode + EXT4_I(inode)->i_inline_off);
 
-		free += le32_to_cpu(entry->e_value_size);
+		free += EXT4_XATTR_SIZE(le32_to_cpu(entry->e_value_size));
 		goto out;
 	}