linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Changli Gao <xiaosuo@gmail.com>
To: Borislav Petkov <bp@alien8.de>, Changli Gao <xiaosuo@gmail.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] fs: optimize mpage_readpage()
Date: Sat, 29 May 2010 21:26:47 +0800	[thread overview]
Message-ID: <AANLkTimtX4HSql73IEAwOBqC2-R25713IgfihGR-fQm9@mail.gmail.com> (raw)
In-Reply-To: <20100529121019.GA25092@liondog.tnic>

On Sat, May 29, 2010 at 8:10 PM, Borislav Petkov <bp@alien8.de> wrote:
> From: Changli Gao <xiaosuo@gmail.com>
> Date: Sat, May 29, 2010 at 09:18:46AM +0800
>
>> optimize mpage_readpage()
>>
>> we don't need to initialize bio, and pass it to do_mpage_readpage() as
>> parameter, as it is returned by do_mpage_readpage().
>>
>> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
>> ----
>>  fs/mpage.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> diff --git a/fs/mpage.c b/fs/mpage.c
>> index fd56ca2..94ff0d1 100644
>> --- a/fs/mpage.c
>> +++ b/fs/mpage.c
>> @@ -409,14 +409,14 @@ EXPORT_SYMBOL(mpage_readpages);
>>   */
>>  int mpage_readpage(struct page *page, get_block_t get_block)
>>  {
>> -     struct bio *bio = NULL;
>> +     struct bio *bio;
>>       sector_t last_block_in_bio = 0;
>>       struct buffer_head map_bh;
>>       unsigned long first_logical_block = 0;
>>
>>       map_bh.b_state = 0;
>>       map_bh.b_size = 0;
>> -     bio = do_mpage_readpage(bio, page, 1, &last_block_in_bio,
>> +     bio = do_mpage_readpage(NULL, page, 1, &last_block_in_bio,
>>                       &map_bh, &first_logical_block, get_block);
>>       if (bio)
>>               mpage_bio_submit(READ, bio);
>
> Nope, I don't think that's a good idea.
>
> On the one hand, this is a trick to shut up gcc:
>
> fs/mpage.c: In function ‘mpage_readpage’:
> fs/mpage.c:419: warning: ‘bio’ is used uninitialized in this function
>
> and, on the other hand, make sure bio is NULL and not some random stack
> value since bio is explicitly checked for NULL in do_mpage_readpage().
>

Did the compiler warning appear after applying my patch? It doesn't
happen when I testing it.  And I don't pass bio to
do_mpage_readpage(), but I pass NULL instead.

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-05-29 13:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-29  1:18 [PATCH 1/2] fs: optimize mpage_readpage() Changli Gao
2010-05-29 12:10 ` Borislav Petkov
2010-05-29 13:26   ` Changli Gao [this message]
2010-05-29 13:46     ` Borislav Petkov
2010-05-29 14:17       ` Changli Gao
2010-06-04  7:19   ` Al Viro
2010-06-04  8:13     ` Borislav Petkov
2010-06-04  8:30       ` Al Viro
2010-06-04 10:18         ` Borislav Petkov

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=AANLkTimtX4HSql73IEAwOBqC2-R25713IgfihGR-fQm9@mail.gmail.com \
    --to=xiaosuo@gmail.com \
    --cc=bp@alien8.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).