> Ibragimov, the problem with your patch is that it means that users who > had previously created a 1k block file system on an advanced format > disk with 4k physical sectors but 512 byte logical sectors would no > longer be able to mount that file system. Yes, it was stupid for them > to do so, and they are deserving of plenty of mocking. But > technically, it is something that should work, even if it's not > advisable from a performance point of view. I haven't found anyone with AF disk who agreed to run test of 1k-block fs mount with modified kernel, so I tried to emulate such disk on available hardware. AF disk with 4kb sector reports its size in 106th word of ATA ID. This is the only difference, except write performace. So if I change 106th word, I will get emulated AF disk. As you can see below, it reports 4096-byte physical block size. ext4 with 1k block size mounts and operates on such disk without any notable problem. diff -ur linux-2.6.38-rc4-orig/drivers/ata/libata-core.c linux-2.6.38-rc4/drivers/ata/libata-core.c --- linux-2.6.38-rc4-orig/drivers/ata/libata-core.c 2011-02-08 00:03:55.000000000 +0000 +++ linux-2.6.38-rc4/drivers/ata/libata-core.c 2011-03-01 18:01:31.859956475 +0000 @@ -1907,6 +1907,8 @@ else err_mask = ata_do_dev_read_id(dev, &tf, id); + id[106] = 0x6003; // 4kb imitation + if (err_mask) { if (err_mask & AC_ERR_NODEV_HINT) { ata_dev_printk(dev, KERN_DEBUG, diff -ur linux-2.6.38-rc4-orig/fs/block_dev.c linux-2.6.38-rc4/fs/block_dev.c --- linux-2.6.38-rc4-orig/fs/block_dev.c 2011-02-08 00:03:55.000000000 +0000 +++ linux-2.6.38-rc4/fs/block_dev.c 2011-03-01 18:43:50.126957299 +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); =============== Script started on Срд 02 Мар 2011 00:45:22 root@debv:~# dmesg | grep sdb [ 3.778499] sd 3:0:0:0: [sdb] 2097152 512-byte logical blocks: (1.07 GB/1.00 GiB) [ 3.778505] sd 3:0:0:0: [sdb] 4096-byte physical blocks [ 3.778647] sd 3:0:0:0: [sdb] Write Protect is off [ 3.778653] sd 3:0:0:0: [sdb] Mode Sense: 00 3a 00 00 [ 3.778712] sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [ 3.779394] sdb: sdb1 [ 3.795441] sd 3:0:0:0: [sdb] Attached SCSI disk [ 62.307185] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: (null) root@debv:~# tune2fs -l /dev/sdb1 | grep "Block size" Block size: 1024 root@debv:~# umount /mnt root@debv:~# mount /dev/sdb1 /mnt root@debv:~# ls /mnt archives lost+found root@debv:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 7.4G 3.4G 3.7G 49% / tmpfs 506M 0 506M 0% /lib/init/rw udev 501M 156K 500M 1% /dev tmpfs 506M 0 506M 0% /dev/shm /dev/sdb1 1007M 480M 477M 51% /mnt root@debv:~# exit -- 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