diff options
author | Chao Yu <yuchao0@huawei.com> | 2017-03-23 01:38:26 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2017-03-24 15:10:53 -0400 |
commit | 22588f8773f687449ce6e97dce9f102553440d30 (patch) | |
tree | 4b3fe264daaf5151bf5d3b6dd509f155ff73a4a1 /fs/f2fs/xattr.c | |
parent | 89e9eabd7ded4680f3b0f8ddc7398a3909de57c8 (diff) |
f2fs: don't reserve additional space in xattr block
In this patch, we change xattr block disk layout as below:
Before:
xattr node block layout
+---------------------------------------------+---------------+-------------+
| node block xattr entries | reserved | node footer |
| 4068 Bytes | 4 Bytes | 24 Bytes |
In memory layout
+--------------------+---------------------------------+--------------------+
| inline xattr | node block xattr entries | reserved |
| 200 Bytes | 4068 Bytes | 4 Bytes |
After:
xattr node block layout
+-------------------------------------------------------------+-------------+
| node block xattr entries | node footer |
| 4072 Bytes | 24 Bytes |
In memory layout
+--------------------+---------------------------------+--------------------+
| inline xattr | node block xattr entries | reserved |
| 200 Bytes | 4072 Bytes | 4 Bytes |
With this change, we don't need to reserve additional space in node block,
just keep reserved space in logical in-memory layout. So that it would help
to enlarge valid free space of xattr node block.
As tested, generic/026 shows max stored xattr entires number increases from
531 to 532 when inline_xattr option is enabled.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/xattr.c')
-rw-r--r-- | fs/f2fs/xattr.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 528aed399814..832c5110abab 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c | |||
@@ -256,7 +256,7 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage, | |||
256 | if (!size && !inline_size) | 256 | if (!size && !inline_size) |
257 | return -ENODATA; | 257 | return -ENODATA; |
258 | 258 | ||
259 | txattr_addr = kzalloc(inline_size + size + RESERVED_XATTR_SIZE, | 259 | txattr_addr = kzalloc(inline_size + size + XATTR_PADDING_SIZE, |
260 | GFP_F2FS_ZERO); | 260 | GFP_F2FS_ZERO); |
261 | if (!txattr_addr) | 261 | if (!txattr_addr) |
262 | return -ENOMEM; | 262 | return -ENOMEM; |
@@ -332,7 +332,7 @@ static int read_all_xattrs(struct inode *inode, struct page *ipage, | |||
332 | void *txattr_addr; | 332 | void *txattr_addr; |
333 | int err; | 333 | int err; |
334 | 334 | ||
335 | txattr_addr = kzalloc(inline_size + size + RESERVED_XATTR_SIZE, | 335 | txattr_addr = kzalloc(inline_size + size + XATTR_PADDING_SIZE, |
336 | GFP_F2FS_ZERO); | 336 | GFP_F2FS_ZERO); |
337 | if (!txattr_addr) | 337 | if (!txattr_addr) |
338 | return -ENOMEM; | 338 | return -ENOMEM; |
@@ -451,7 +451,7 @@ static inline int write_all_xattrs(struct inode *inode, __u32 hsize, | |||
451 | } | 451 | } |
452 | 452 | ||
453 | xattr_addr = page_address(xpage); | 453 | xattr_addr = page_address(xpage); |
454 | memcpy(xattr_addr, txattr_addr + inline_size, MAX_XATTR_BLOCK_SIZE); | 454 | memcpy(xattr_addr, txattr_addr + inline_size, VALID_XATTR_BLOCK_SIZE); |
455 | set_page_dirty(xpage); | 455 | set_page_dirty(xpage); |
456 | f2fs_put_page(xpage, 1); | 456 | f2fs_put_page(xpage, 1); |
457 | 457 | ||