Re: [PATCH 2/5] [FAT] Let the block device know when sectors can be discarded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> writes:

> OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx> 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 <hirofumi@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux