From: Kinglong Mee <kinglongmee@gmail.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: copy all valid xattr data includes the last zero
Date: Mon, 20 Mar 2017 20:33:28 +0800 [thread overview]
Message-ID: <10384529-5d09-712c-abba-a981be074072@gmail.com> (raw)
In-Reply-To: <20170320030842.GB45667@jaegeuk.local>
On 3/20/2017 11:08, Jaegeuk Kim wrote:
> Hi Kinglong,
>
> On 03/18, Kinglong Mee wrote:
>> It's better coping all valid xattr data includes the last zero.
>
> Why do we need this?
>
> The size of txattr_addr would be larger than the space we need.
>
> Thanks,
>
>>
>> Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
>> ---
>> fs/f2fs/xattr.c | 4 ++--
>> fs/f2fs/xattr.h | 4 ++--
>> 2 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
>> index aff7619..41785c9 100644
>> --- a/fs/f2fs/xattr.c
>> +++ b/fs/f2fs/xattr.c
>> @@ -249,7 +249,7 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage,
>> struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
>> void *cur_addr, *txattr_addr, *last_addr = NULL;
>> nid_t xnid = F2FS_I(inode)->i_xattr_nid;
>> - unsigned int size = xnid ? VALID_XATTR_BLOCK_SIZE : 0;
Here maybe does not copy the last zero.
>> + unsigned int size = xnid ? MAX_XATTR_BLOCK_SIZE : 0;
>> unsigned int inline_size = 0;
>> int err = 0;
>>
>> @@ -328,7 +328,7 @@ static int read_all_xattrs(struct inode *inode, struct page *ipage,
>> {
>> struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
>> struct f2fs_xattr_header *header;
>> - size_t size = PAGE_SIZE, inline_size = 0;
Yes, it's larger.
It's for consistent with the above.
thanks,
Kinglong Mee
>> + size_t size = MAX_XATTR_BLOCK_SIZE, inline_size = 0;
>> void *txattr_addr;
>> int err;
>>
>> diff --git a/fs/f2fs/xattr.h b/fs/f2fs/xattr.h
>> index d5a9492..629c8ae 100644
>> --- a/fs/f2fs/xattr.h
>> +++ b/fs/f2fs/xattr.h
>> @@ -73,9 +73,9 @@ struct f2fs_xattr_entry {
>> !IS_XATTR_LAST_ENTRY(entry);\
>> entry = XATTR_NEXT_ENTRY(entry))
>> #define MAX_XATTR_BLOCK_SIZE (PAGE_SIZE - sizeof(struct node_footer))
>> -#define VALID_XATTR_BLOCK_SIZE (MAX_XATTR_BLOCK_SIZE - sizeof(__u32))
>> +/* A __u32 is reserved for the last entry as zero */
>> #define MIN_OFFSET(i) XATTR_ALIGN(inline_xattr_size(i) + \
>> - VALID_XATTR_BLOCK_SIZE)
>> + MAX_XATTR_BLOCK_SIZE - sizeof(__u32))
>>
>> #define MAX_VALUE_LEN(i) (MIN_OFFSET(i) - \
>> sizeof(struct f2fs_xattr_header) - \
>> --
>> 2.9.3
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
next prev parent reply other threads:[~2017-03-20 12:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-18 1:23 [PATCH] f2fs: copy all valid xattr data includes the last zero Kinglong Mee
2017-03-20 3:08 ` Jaegeuk Kim
2017-03-20 12:33 ` Kinglong Mee [this message]
2017-03-21 16:18 ` Jaegeuk Kim
2017-03-22 8:42 ` Chao Yu
2017-03-22 10:16 ` Chao Yu
2017-03-22 10:26 ` Kinglong Mee
2017-03-22 14:21 ` Jaegeuk Kim
2017-03-23 1:22 ` Chao Yu
2017-03-23 3:53 ` Jaegeuk Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10384529-5d09-712c-abba-a981be074072@gmail.com \
--to=kinglongmee@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).