add patch make-sure-all-temp-bh-fields-are-initialized
[ext4-patch-queue.git] / ext4_xattr_value_same-should-return-false-for-external-data
blob06d6dc743e4f44e0fa6e231106174220a4bf1c51
1 ext4: ext4_xattr_value_same() should return false for external data
3 From: Tahsin Erdogan <tahsin@google.com>
5 ext4_xattr_value_same() is used as a quick optimization in case the new
6 xattr value is identical to the previous value. When xattr value is
7 stored in a xattr inode the check becomes expensive so it is better to
8 just assume that they are not equal.
10 Signed-off-by: Tahsin Erdogan <tahsin@google.com>
11 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
12 ---
13  fs/ext4/xattr.c | 3 +++
14  1 file changed, 3 insertions(+)
16 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
17 index 4dd8be16d175..681a9b5eefd8 100644
18 --- a/fs/ext4/xattr.c
19 +++ b/fs/ext4/xattr.c
20 @@ -1428,6 +1428,9 @@ static int ext4_xattr_value_same(struct ext4_xattr_search *s,
21  {
22         void *value;
24 +       /* When e_value_inum is set the value is stored externally. */
25 +       if (s->here->e_value_inum)
26 +               return 0;
27         if (le32_to_cpu(s->here->e_value_size) != i->value_len)
28                 return 0;
29         value = ((void *)s->base) + le16_to_cpu(s->here->e_value_offs);
30 -- 
31 2.13.1.611.g7e3b11ae1-goog