[PATCH][RFC]ext4 on 4k-sector drives without read-modify-write support

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

 



I have a proposal about 4k-sector hard drives support in fs drivers.
Toshiba MK1231GAL is an 1.8" LIF IDE drive. It has 4096-byte physical
and 512-byte logical sectors [1]. Unlike others drives with Advanced
Format, it has not read-modify-write logic, so it can only operate
with 4k blocks. Fortunately some filesystems in linux (I tested jfs, 
reiserfs and btrfs) read and write data by 4096-byte blocks. But 
when I tried to mount ext4, it fails:

[ 2595.093595] ata2.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x0
[ 2595.097302] ata2.00: BMDMA stat 0x5
[ 2595.100427] ata2.00: failed command: READ DMA
[ 2595.103191] ata2.00: cmd c8/00:02:02:c0:d1/00:00:00:00:00/ed tag 0 dma 1024 in
[ 2595.103196]          res 51/10:02:02:c0:d1/00:00:00:00:00/ed Emask 0x81 (invalid argument)
[ 2595.108796] ata2.00: status: { DRDY ERR }
[ 2595.111981] ata2.00: error: { IDNF }
[ 2595.128438] ata2.00: configured for UDMA/100
[ 2595.131964] ata2: EH complete


Before ext4 reads superblock it calls `sb_min_blocksize', remembers its value and
then use it. By default it returns 1024 (=EXT4_MIN_BLOCK_SIZE).
I propose to return physical block size instead of logical one. With such change 
filesystems that honor `sb_min_blocksize' return value are able to mount and operate.
(At least ext2/3/4, hfs and hfsplus.)
For 512-byte drives nothing changes.

Is such approach correct?


diff -ur linux-2.6.37-rc5-orig/fs/block_dev.c linux-2.6.37-rc5/fs/block_dev.c
--- linux-2.6.37-rc5-orig/fs/block_dev.c	2010-12-07 04:09:04.000000000 +0000
+++ linux-2.6.37-rc5/fs/block_dev.c	2010-12-15 20:11:19.311387630 +0000
@@ -121,7 +121,7 @@
 
 int sb_min_blocksize(struct super_block *sb, int size)
 {
-	int minsize = bdev_logical_block_size(sb->s_bdev);
+	int minsize = bdev_physical_block_size(sb->s_bdev);
 	if (size < minsize)
 		size = minsize;
 	return sb_set_blocksize(sb, size);


Please add linux-fsdevel@ to CC list, I'm subscribed to it only.

[1] http://storage.toshiba.eu/cms/en/hdd/multimedia/product_detail.jsp?productid=258



--
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