From mboxrd@z Thu Jan 1 00:00:00 1970 From: Namhyung Kim Subject: Re: A question on block_prepare_write() Date: Sun, 24 Oct 2010 03:00:46 +0900 Message-ID: <1287856846.1681.58.camel@leonhard> References: <1287841482.1681.36.camel@leonhard> <20101023104036.2bec05a0.akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel , LKML To: Andrew Morton Return-path: Received: from mail-pz0-f46.google.com ([209.85.210.46]:43095 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756378Ab0JWSAz (ORCPT ); Sat, 23 Oct 2010 14:00:55 -0400 In-Reply-To: <20101023104036.2bec05a0.akpm@linux-foundation.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 2010-10-23 (=ED=86=A0), 10:40 -0700, Andrew Morton: > On Sat, 23 Oct 2010 22:44:42 +0900 Namhyung Kim = wrote: >=20 > > Hello, > >=20 > > I see block_prepare_write() has local variable wait[2] to keep trac= k of > > buffer_heads which are not up-to-date. But I'm wondering how it cou= ld be > > guaranteed there will be no more than 2 such buffer_heads? Is there= any > > restriction on the usage of the function? Using MAX_BUF_PER_PAGE in= stead > > of the magic number 2 is just useless? I couldn't find any comments= or > > documentation on this. > >=20 > > Any of your comments would be greatly appreciated. TIA. :-) > >=20 >=20 > block_prepare_write() may need to preread any buffer_head which are > being only partially modified by the write(). >=20 > Buffers which aren't being modified at all don't need to be preread.=20 > Buffers which are being fully modified don't need to be preread > (because all their data is being overwritten). >=20 > page: |-----------------------| > buffer_heads: |-----|-----|-----|-----| > area we're writing to: |---------| >=20 > There can only be a maximum of two partially-modified buffers in the = page. I see. It considers both edges of the to-be-written data. Thanks for your clear and kindly explanation. :-) --=20 Regards, Namhyung Kim -- 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