From: Gao Xiang <gaoxiang25@huawei.com>
To: Chao Yu <yuchao0@huawei.com>
Cc: hch@infradead.org, darrick.wong@oracle.com,
linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
chao@kernel.org
Subject: Re: [PATCH RFC] iomap: introduce IOMAP_TAIL
Date: Mon, 1 Jul 2019 15:03:27 +0800 [thread overview]
Message-ID: <58511d64-aa7a-8ac2-0255-affe0e8d49de@huawei.com> (raw)
In-Reply-To: <a27e3502-db75-22fa-4545-e588abbbfbf2@huawei.com>
On 2019/7/1 14:40, Chao Yu wrote:
> Hi Xiang,
>
> On 2019/6/29 17:34, Gao Xiang wrote:
>> Hi Chao,
>>
>> On 2019/6/29 15:30, Chao Yu wrote:
>>> Some filesystems like erofs/reiserfs have the ability to pack tail
>>> data into metadata, however iomap framework can only support mapping
>>> inline data with IOMAP_INLINE type, it restricts that:
>>> - inline data should be locating at page #0.
>>> - inline size should equal to .i_size
>>> So we can not use IOMAP_INLINE to handle tail-packing case.
>>>
>>> This patch introduces new mapping type IOMAP_TAIL to map tail-packed
>>> data for further use of erofs.
>>>
>>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>>> ---
>>> fs/iomap.c | 22 ++++++++++++++++++++++
>>> include/linux/iomap.h | 1 +
>>> 2 files changed, 23 insertions(+)
>>>
>>> diff --git a/fs/iomap.c b/fs/iomap.c
>>> index 12654c2e78f8..ae7777ce77d0 100644
>>> --- a/fs/iomap.c
>>> +++ b/fs/iomap.c
>>> @@ -280,6 +280,23 @@ iomap_read_inline_data(struct inode *inode, struct page *page,
>>> SetPageUptodate(page);
>>> }
>>>
>>> +static void
>>> +iomap_read_tail_data(struct inode *inode, struct page *page,
>>> + struct iomap *iomap)
>>> +{
>>> + size_t size = i_size_read(inode) & (PAGE_SIZE - 1);
>>> + void *addr;
>>> +
>>> + if (PageUptodate(page))
>>> + return;
>>> +
>>> + addr = kmap_atomic(page);
>>> + memcpy(addr, iomap->inline_data, size);
>>> + memset(addr + size, 0, PAGE_SIZE - size);
>>
>> need flush_dcache_page(page) here for new page cache page since
>> it's generic iomap code (althrough not necessary for x86, arm), I am not sure...
>> see commit d2b2c6dd227b and c01778001a4f...
>
> Thanks for your reminding, these all codes were copied from
> iomap_read_inline_data(), so I think we need a separated patch to fix this issue
> if necessary.
Yes, just a reminder, it is good as it-is.
Thanks,
Gao Xiang
>
> Thanks,
>
>>
>> Thanks,
>> Gao Xiang
>>
>>> + kunmap_atomic(addr);
>>> + SetPageUptodate(page);
>>> +}
>>> +
>>> static loff_t
>>> iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
>>> struct iomap *iomap)
>>> @@ -298,6 +315,11 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
>>> return PAGE_SIZE;
>>> }
>>>
>>> + if (iomap->type == IOMAP_TAIL) {
>>> + iomap_read_tail_data(inode, page, iomap);
>>> + return PAGE_SIZE;
>>> + }
>>> +
>>> /* zero post-eof blocks as the page may be mapped */
>>> iomap_adjust_read_range(inode, iop, &pos, length, &poff, &plen);
>>> if (plen == 0)
>>> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
>>> index 2103b94cb1bf..7e1ee48e3db7 100644
>>> --- a/include/linux/iomap.h
>>> +++ b/include/linux/iomap.h
>>> @@ -25,6 +25,7 @@ struct vm_fault;
>>> #define IOMAP_MAPPED 0x03 /* blocks allocated at @addr */
>>> #define IOMAP_UNWRITTEN 0x04 /* blocks allocated at @addr in unwritten state */
>>> #define IOMAP_INLINE 0x05 /* data inline in the inode */
>>> +#define IOMAP_TAIL 0x06 /* tail data packed in metdata */
>>>
>>> /*
>>> * Flags for all iomap mappings:
>>>
>> .
>>
next prev parent reply other threads:[~2019-07-01 7:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-29 7:30 [PATCH RFC] iomap: introduce IOMAP_TAIL Chao Yu
2019-06-29 9:34 ` Gao Xiang
2019-07-01 6:40 ` Chao Yu
2019-07-01 7:03 ` Gao Xiang [this message]
2019-07-01 9:49 ` Andreas Grünbacher
2019-07-01 10:07 ` Chao Yu
2019-07-01 10:13 ` Andreas Grünbacher
2019-07-01 10:22 ` Chao Yu
2019-06-30 23:19 ` Darrick J. Wong
2019-07-01 6:08 ` Christoph Hellwig
2019-07-01 7:38 ` Chao Yu
2019-07-01 7:28 ` Chao Yu
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=58511d64-aa7a-8ac2-0255-affe0e8d49de@huawei.com \
--to=gaoxiang25@huawei.com \
--cc=chao@kernel.org \
--cc=darrick.wong@oracle.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=yuchao0@huawei.com \
/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