ext4: zero out inline data using memset() instead of empty_zero_page

Not all architectures (in particular, sparc64) have empty_zero_page.
So instead of copying from empty_zero_page, use memset to clear the
inline data by signalling to ext4_xattr_set_entry() via a magic
pointer value, EXT4_ZERO_ATTR_VALUE, which is defined by casting -1 to
a pointer.

This fixes a build failure on sparc64, and the memset() should be more
efficient than using memcpy() anyway.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
Theodore Ts'o
2012-12-11 03:31:49 -05:00
parent 9a4c801947
commit bd9926e803
3 changed files with 18 additions and 7 deletions

View File

@@ -268,7 +268,7 @@ static int ext4_create_inline_data(handle_t *handle,
goto out;
if (len > EXT4_MIN_INLINE_DATA_SIZE) {
value = (void *)empty_zero_page;
value = EXT4_ZERO_XATTR_VALUE;
len -= EXT4_MIN_INLINE_DATA_SIZE;
} else {
value = "";