From: Chao Yu <yuchao0@huawei.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: <linux-f2fs-devel@lists.sourceforge.net>,
<linux-kernel@vger.kernel.org>, <chao@kernel.org>
Subject: Re: [PATCH] f2fs: enhance lookup xattr
Date: Tue, 7 Feb 2017 15:26:46 +0800 [thread overview]
Message-ID: <2b9eb490-238a-1ad6-5a84-3d6eec96cf6b@huawei.com> (raw)
In-Reply-To: <20170129035831.GA65555@jaegeuk.local>
Hi Jaegeuk,
On 2017/1/29 11:58, Jaegeuk Kim wrote:
> Hi Chao,
>
> On 01/24, Chao Yu wrote:
>
> ...
>
>>
>> - error = read_all_xattrs(inode, ipage, &base_addr);
>> + error = lookup_all_xattrs(inode, ipage, index, len, name,
>> + &entry, &base_addr);
>> if (error)
>> return error;
>>
>> - entry = __find_xattr(base_addr, index, len, name);
>> - if (IS_XATTR_LAST_ENTRY(entry)) {
>> - error = -ENODATA;
>> - goto cleanup;
>> - }
>> -
>> - size = le16_to_cpu(entry->e_value_size);
>> + size = __le16_to_cpu(entry->e_value_size);
>
> Looks good to me, except __le16_to_cpu() here.
> Do we need to use this instead of le16_to_cpu()?
Indeed, no needed. :)
Thanks,
>
> Thanks,
>
>>
>> if (buffer && size > buffer_size) {
>> error = -ERANGE;
>> - goto cleanup;
>> + goto out;
>> }
>>
>> + pval = entry->e_name + entry->e_name_len;
>> +
>> if (buffer) {
>> char *pval = entry->e_name + entry->e_name_len;
>> memcpy(buffer, pval, size);
>> }
>> error = size;
>> -
>> -cleanup:
>> +out:
>> kzfree(base_addr);
>> return error;
>> }
>> diff --git a/fs/f2fs/xattr.h b/fs/f2fs/xattr.h
>> index f990de20cdcd..d5a94928c116 100644
>> --- a/fs/f2fs/xattr.h
>> +++ b/fs/f2fs/xattr.h
>> @@ -72,9 +72,10 @@ struct f2fs_xattr_entry {
>> for (entry = XATTR_FIRST_ENTRY(addr);\
>> !IS_XATTR_LAST_ENTRY(entry);\
>> entry = XATTR_NEXT_ENTRY(entry))
>> -
>> -#define MIN_OFFSET(i) XATTR_ALIGN(inline_xattr_size(i) + PAGE_SIZE - \
>> - sizeof(struct node_footer) - sizeof(__u32))
>> +#define MAX_XATTR_BLOCK_SIZE (PAGE_SIZE - sizeof(struct node_footer))
>> +#define VALID_XATTR_BLOCK_SIZE (MAX_XATTR_BLOCK_SIZE - sizeof(__u32))
>> +#define MIN_OFFSET(i) XATTR_ALIGN(inline_xattr_size(i) + \
>> + VALID_XATTR_BLOCK_SIZE)
>>
>> #define MAX_VALUE_LEN(i) (MIN_OFFSET(i) - \
>> sizeof(struct f2fs_xattr_header) - \
>> --
>> 2.8.2.295.g3f1c1d0
>
> .
>
prev parent reply other threads:[~2017-02-07 7:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 12:39 Chao Yu
2017-01-29 3:58 ` Jaegeuk Kim
2017-02-07 7:26 ` Chao Yu [this message]
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=2b9eb490-238a-1ad6-5a84-3d6eec96cf6b@huawei.com \
--to=yuchao0@huawei.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®