From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyungmin Park Subject: Re: [PATCH v6] fat: Batched discard support for fat Date: Tue, 24 May 2011 14:21:50 +0900 Message-ID: References: <20110328103431.GA22323@july> <201103301620.50263.arnd@arndb.de> <201103301706.36214.arnd@arndb.de> <87wrhgk8lp.fsf@devron.myhome.or.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Arnd Bergmann , Lukas Czerner , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: OGAWA Hirofumi Return-path: In-Reply-To: <87wrhgk8lp.fsf@devron.myhome.or.jp> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Tue, May 24, 2011 at 1:47 PM, OGAWA Hirofumi wrote: > Kyungmin Park writes: > >> Hi again, > > Hi > >> Do you still object to merge this feature for .40? As I said the >> batched discard design is out-of-scope of this patch. >> It's implemented at other batched discard, ext4, xfs and so on. >> >> I hope fat is also support the batched discard. >> >> Any opinions? > > I'm also thinking implementing this is good though. Sorry, I'm not go= ing > to apply this for now, and would like to wait to be used by real > userland (I hope guys notice the problem, or userland tackles it some= how > sadly). > > I think, to expose the wrong behavior like this would be worse. > > E.g. one of problems, userland might do like this (trim chunk from 0 = to > number of block) > > for chunk in number_of_blocks > =A0 =A0 =A0 =A0do_trim chunk > done It's handled at trim implementation. It just trim the fat aware block. Not trim the blocks which fat doesn't know. As fat don't use the block 0, 1, it adjust the start block at kernel. + if (start < FAT_START_ENT) + start =3D FAT_START_ENT; and don't exceed the max cluster size. + len =3D (len > sbi->max_cluster) ? sbi->max_cluster : len; + for (count =3D start; count <=3D len; count++) { > > But this is actually wrong, this interface doesn't map blocks to 0-ma= x, > so userland have to know real maximum-block-number somehow for each F= S > (and maybe have to know real minimum-block-number). > > So, how to fix this? The solutions would be userland workaround, or f= ix > kernel. If it was userland, userland have to know FS internal sadly. = If > it was kernel, we would have backward compatible nightmare, or ignore > compatible :(. I think basic concept of batched discard is trim at once instead of deleted entries at filesystem (original one). So it can set the specific start address or any start (usually 0) with maximum length. > > I really think we have to rethink this and have agreement about commo= n > interface. Or there was real userland app, I think FAT can implement = to > work that app. IMO, we should use the same user space application. user program doesn't know the which filesystem are underlying. So sample user space program used at ext4, xfs should be used. and I te= sted it. Thank you, Kyungmin Park