From: OGAWA Hirofumi Subject: Re: [PATCH 2/5] [FAT] Let the block device know when sectors can be discarded Date: Thu, 07 Aug 2008 05:10:23 +0900 Message-ID: <87abfpoqfk.fsf@devron.myhome.or.jp> References: <488B7281.4020007@gmail.com> <20080726130200.f541e604.akpm@linux-foundation.org> <1217900716.3454.667.camel@pmac.infradead.org> <20080805114210.GW20055@kernel.dk> <1217953741.3454.784.camel@pmac.infradead.org> <1217957140.3454.800.camel@pmac.infradead.org> <1218014720.5111.37.camel@pmac.infradead.org> <873aliqepf.fsf@devron.myhome.or.jp> <1218046269.5111.120.camel@pmac.infradead.org> <87promot6v.fsf@devron.myhome.or.jp> <87od45orck.fsf@devron.myhome.or.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jens Axboe , Andrew Morton , Ric Wheeler , linux-fsdevel@vger.kernel.org, gilad@codefidence.com To: David Woodhouse Return-path: Received: from mail.parknet.ad.jp ([210.171.162.6]:36358 "EHLO mail.officemail.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750936AbYHFUK1 (ORCPT ); Wed, 6 Aug 2008 16:10:27 -0400 In-Reply-To: <87od45orck.fsf@devron.myhome.or.jp> (OGAWA Hirofumi's message of "Thu, 07 Aug 2008 04:50:35 +0900") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: OGAWA Hirofumi writes: > OGAWA Hirofumi writes: > >>> On Thu, 2008-08-07 at 02:14 +0900, OGAWA Hirofumi wrote: >>>> Ah, blkdev_issue_discard() assumes blocksize is 512bytes, um... >>> >>> Doesn't everything? I did consider using q->hardsect_size, but decided >>> that was probably the wrong thing to do. I don't know. Jens? >> >> My point is fs-blocksize vs hard sector size. >> >> In FAT patch, it's passing the number of fs-blocks, not number of hard >> sectors. > > Ah, bio->bi_sector has same issue too. I'm not sure whether it's good interface. However, we would have to convert like following from fs-blocksize to 512... int sb_issue_discard(sruct super_block *sb, sector_t blocknr, unsigned blocks) { sector_t sector = blocknr << (sb->s_blocksize_bits - 9); /* * this should check overflow, or caller should? * and there is no point to sectors based on 512 temporarily, * so we should pass bytes directly? */ unsigned nr_sects = blocks << (sb->s_blocksize_bits - 9); return blkdev_issue_discard(sb->s_bdev, sector, nr_sects); } -- OGAWA Hirofumi