From: Badari Pulavarty <pbadari@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 2.6.11-mm1 "nobh" support for ext3 writeback mode
Date: Sat, 05 Mar 2005 09:39:38 -0800 [thread overview]
Message-ID: <4229EEDA.2030307@us.ibm.com> (raw)
In-Reply-To: <20050304171651.013ff333.akpm@osdl.org>
Andrew Morton wrote:
> Badari Pulavarty <pbadari@us.ibm.com> wrote:
>
>> iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits);
>
>
> It would still be nice to add a comment in here...
>
>
>>+ if (test_opt(inode->i_sb, NOBH) && !page_has_buffers(page)) {
>>+ if (!PageUptodate(page)) {
>>+ struct buffer_head map_bh;
>>+ bh = &map_bh;
>>+ bh->b_state = 0;
>>+ clear_buffer_mapped(bh);
>>+ ext3_get_block(inode, iblock, bh, 0);
>>+ if (!buffer_mapped(bh))
>>+ goto unlock;
>>+ err = -EIO;
>>+ set_bh_page(bh, page, 0);
>>+ bh->b_this_page = 0;
>>+ bh->b_size = 1 << inode->i_blkbits;
>>+ ll_rw_block(READ, 1, &bh);
>>+ wait_on_buffer(bh);
>>+ if (!buffer_uptodate(bh))
>>+ goto unlock;
>>+ SetPageMappedToDisk(page);
>>+ }
>>+ kaddr = kmap_atomic(page, KM_USER0);
>>+ memset(kaddr + offset, 0, length);
>>+ flush_dcache_page(page);
>>+ kunmap_atomic(kaddr, KM_USER0);
>>+ set_page_dirty(page);
>>+ err = 0;
>>+ goto unlock;
>>+ }
>>+
>> if (!page_has_buffers(page))
>> create_empty_buffers(page, blocksize, 0);
>
>
> Given that we're about to go add buffers to the page, why not do that
> first, and use the page's own buffer_head rather than cooking up a local
> one? Then we can simply use sb_bread().
>
>
Only reason for cooking up the local one is not to attach the buffer to
the page forever. That will end up forcing other routines (like
writepage/writepages) go thro "confused" code. I was hoping not to
attach buffers if they are not really needed.
But again, doing it the way you suggested will make the code more
readable.
Thanks,
Badari
next prev parent reply other threads:[~2005-03-05 17:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-05 0:02 [PATCH] 2.6.11-mm1 "nobh" support for ext3 writeback mode Badari Pulavarty
2005-03-05 0:23 ` Andrew Morton
2005-03-05 0:29 ` Badari Pulavarty
2005-03-05 0:45 ` Andrew Morton
2005-03-05 0:49 ` Badari Pulavarty
2005-03-05 1:02 ` Badari Pulavarty
2005-03-05 1:16 ` Andrew Morton
2005-03-05 17:39 ` Badari Pulavarty [this message]
2005-03-05 0:31 ` Andrew Morton
2005-03-05 0:46 ` Badari Pulavarty
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=4229EEDA.2030307@us.ibm.com \
--to=pbadari@us.ibm.com \
--cc=akpm@osdl.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox