[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <646157ce-5aa5-44e7-b3a2-b3d39f83d349@linux.alibaba.com>
Date: Thu, 17 Oct 2024 10:45:53 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: Kefeng Wang <wangkefeng.wang@...wei.com>, akpm@...ux-foundation.org,
hughd@...gle.com
Cc: willy@...radead.org, david@...hat.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] mm: shmem: update iocb->ki_pos directly to simplify
tmpfs read logic
On 2024/10/16 20:34, Kefeng Wang wrote:
>
>
> On 2024/10/16 18:09, Baolin Wang wrote:
>> Use iocb->ki_pos to check if the read bytes exceeds the file size and to
>> calculate the bytes to be read can help simplify the code logic.
>> Meanwhile,
>> this is also a preparation for improving tmpfs large folios read
>> performace
>> in the following patch.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@...ux.alibaba.com>
>> ---
>> mm/shmem.c | 36 ++++++++++++------------------------
>> 1 file changed, 12 insertions(+), 24 deletions(-)
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 66eae800ffab..edab02a26aac 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -3106,26 +3106,18 @@ static ssize_t shmem_file_read_iter(struct
>> kiocb *iocb, struct iov_iter *to)
>> unsigned long offset;
>> int error = 0;
>> ssize_t retval = 0;
>> - loff_t *ppos = &iocb->ki_pos;
>> - index = *ppos >> PAGE_SHIFT;
>> - offset = *ppos & ~PAGE_MASK;
>> + index = iocb->ki_pos >> PAGE_SHIFT;
>
> index calculate could be moved before shmem_get_folio(), then...
Yes. Will do.
Powered by blists - more mailing lists