From: Rui Xiang <rui.xiang@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] romfs: remove an redundant if condition in romfs_readpage
Date: Mon, 16 Dec 2013 16:24:53 +0800 [thread overview]
Message-ID: <52AEB8D5.8020705@huawei.com> (raw)
In-Reply-To: <20131216001027.5e1e0a7e.akpm@linux-foundation.org>
On 2013/12/16 16:10, Andrew Morton wrote:
> On Tue, 26 Nov 2013 16:39:09 +0800 Rui Xiang <rui.xiang@huawei.com> wrote:
>
>> Here ret always equals 0, so SetPageUptodate directly.
>>
>> ...
>>
>> --- a/fs/romfs/super.c
>> +++ b/fs/romfs/super.c
>> @@ -129,8 +129,7 @@ static int romfs_readpage(struct file *file, struct page *page)
>>
>> if (fillsize < PAGE_SIZE)
>> memset(buf + fillsize, 0, PAGE_SIZE - fillsize);
>> - if (ret == 0)
>> - SetPageUptodate(page);
>> + SetPageUptodate(page);
>>
>> flush_dcache_page(page);
>> kunmap(page);
>
> Nope, `ret' can be -EIO:
>
> ret = 0;
> if (offset < size) {
> size -= offset;
> fillsize = size > PAGE_SIZE ? PAGE_SIZE : size;
>
> pos = ROMFS_I(inode)->i_dataoffset + offset;
>
> ret = romfs_dev_read(inode->i_sb, pos, buf, fillsize);
> if (ret < 0) {
> SetPageError(page);
> fillsize = 0;
> -->> ret = -EIO;
> }
> }
>
> if (fillsize < PAGE_SIZE)
> memset(buf + fillsize, 0, PAGE_SIZE - fillsize);
> if (ret == 0)
> SetPageUptodate(page);
>
>
> It was a bit rude to overwrite the romfs_dev_read() return code though.
>
Ah, my fault. Ignore that, please.
prev parent reply other threads:[~2013-12-16 8:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-26 8:39 [PATCH 1/2] romfs: fix returm err while getting inode in fill_super Rui Xiang
2013-11-26 8:39 ` [PATCH 2/2] romfs: remove an redundant if condition in romfs_readpage Rui Xiang
2013-12-16 8:10 ` Andrew Morton
2013-12-16 8:24 ` Rui Xiang [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=52AEB8D5.8020705@huawei.com \
--to=rui.xiang@huawei.com \
--cc=akpm@linux-foundation.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.