f2fs: remove unneeded memset when updating xattr
Chao Yu
maintainerPATCH 2/4 f2fs: remove unneeded memset when updating xattr
From: Chao Yu <[email protected]>
Each of fields in struct f2fs_xattr_entry will be assigned later, so previously we don't need to memset the struct.
Signed-off-by Chao Yu <[email protected]>
--- fs/f2fs/xattr.c | 1 - 1 file changed, 1 deletion(-)
fs/f2fs/xattr.c +0 -1
@@ -528,7 +528,6 @@ static int __f2fs_setxattr(struct inode *inode, int index,* Before we come here, old entry is removed. * We just write new entry. */ -memset (last,0 , newsize); last->e_name_index = index; last->e_name_len = len;memcpy (last->e_name, name, len);
Signature · 1 line
2.7.2
Chao Yu
maintainerPATCH 3/4 f2fs: reuse get_extent_info
From: Chao Yu <[email protected]>
Reuse get_extent_info for readability.
Signed-off-by Chao Yu <[email protected]>
--- fs/f2fs/extent_cache.c | 3 +-- fs/f2fs/f2fs.h | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-)
fs/f2fs/extent_cache.c +1 -2
@@ -196,8 +196,7 @@ bool f2fs_init_extent_tree(struct inode *inode, struct f2fs_extent *i_ext)if (!i_ext || !i_ext->len)return false; -set_extent_info (&ei,le32_to_cpu (i_ext->fofs), -le32_to_cpu (i_ext->blk),le32_to_cpu (i_ext->len)); +get_extent_info (&ei, i_ext);write_lock (&et->lock);if (atomic_read (&et->node_cnt))
fs/f2fs/f2fs.h +4 -4
@@ -417,11 +417,11 @@ struct f2fs_inode_info { };static inline void get_extent_info (struct extent_info *ext, -struct f2fs_extent i_ext) +struct f2fs_extent *i_ext) { - ext->fofs =le32_to_cpu (i_ext.fofs); - ext->blk =le32_to_cpu (i_ext.blk); - ext->len =le32_to_cpu (i_ext.len); + ext->fofs =le32_to_cpu (i_ext->fofs); + ext->blk =le32_to_cpu (i_ext->blk); + ext->len =le32_to_cpu (i_ext->len); } static inline void set_raw_extent(struct extent_info *ext,
Signature · 1 line
2.7.2
Chao Yu
maintainerPATCH 4/4 f2fs: shrink size of struct seg_entry
In reply to Chao YuFrom: Chao Yu <[email protected]>
Restructure struct seg_entry to eliminate holes in it, after that, in 32-bits machine, it reduces size from 32 bytes to 24 bytes; in 64-bits machine, it reduces size from 56 bytes to 40 bytes.
Signed-off-by Chao Yu <[email protected]>
--- fs/f2fs/segment.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/f2fs/segment.h +5 -4
@@ -158,16 +158,17 @@ struct victim_sel_policy { };struct seg_entry { -unsigned short valid_blocks;/* # of valid blocks */ +unsigned int type:6 ;/* segment type like CURSEG_XXX_TYPE */ +unsigned int valid_blocks:10 ;/* # of valid blocks */ +unsigned int ckpt_valid_blocks:10 ;/* # of valid blocks last cp */ +unsigned int padding:6 ;/* padding */ unsigned char *cur_valid_map;/* validity bitmap of blocks */ /* * # of valid blocks and the validity bitmap stored in the the last * checkpoint pack. This information is used by the SSR mode. */ -unsigned short ckpt_valid_blocks; -unsigned char *ckpt_valid_map; +unsigned char *ckpt_valid_map;/* validity bitmap of blocks last cp */ unsigned char *discard_map; -unsigned char type;/* segment type like CURSEG_XXX_TYPE */ unsigned long long mtime;/* modification time of the segment */ };
Signature · 1 line
2.7.2