http://osdir.com/ml/2007/msg00040.html
Jari Ruusu wrote:
> Both device sizes are integer multiples of 4096 bytes. When you shrink the
> the device size by non-4096 byte amount, that is no longer true. 976773160
> and 976773168 sector size devices can be fully accessed using 4096 soft
> block size. It is the default smaller soft block size that causes the
> slowdown.

Just to clarify this: Default soft block size is set to such value that full
device can be accessed using X amount of such soft block size chunks. File
system mount knows that it won't access any less-than-block-size leftovers
at the end of the device, so it can set to more sane value.

In following examples, /dev/hdd2, /dev/loop3 and /dev/loop6 sizes are
interger multiple of 4096 bytes, and as such, can be fully accessed using
4096 byte soft block size. /dev/hdd9, /dev/loop4 and /dev/loop5 are not, and
are accessed using 512 byte soft block size. Prior to mount, that is.
Meaning that any mkfs, fsck, and other direct access will not perform as
fast and efficiently as for /dev/hdd2, /dev/loop3 and /dev/loop6. After
mount, /dev/hdd2 and /dev/hdd9 should perform identically, as should
/dev/loop3, /dev/loop4, /dev/loop5 and /dev/loop6.

# blockdev --getsize /dev/hdd2
102816

(device size is integer multiple of 4096 bytes)

# losetup -e AES128 -K loop-AES/gpgkey3.asc /dev/loop3 /dev/hdd2
Password:
# blockdev --getbsz /dev/loop3
4096

(default soft block size is 4096 bytes)

# losetup -e AES128 -K loop-AES/gpgkey3.asc -o 512 /dev/loop5 /dev/hdd2
Password:
# blockdev --getbsz /dev/loop5
512

(default soft block size is *LESS THAN* 4096 bytes)

# blockdev --getsize /dev/hdd9
102753

(device size is *NOT* integer multiple of 4096 bytes)

# losetup -e AES128 -K loop-AES/gpgkey3.asc /dev/loop4 /dev/hdd9
Password:
# blockdev --getbsz /dev/loop4
512

(default soft block size is *LESS THAN* 4096 bytes)

# losetup -e AES128 -K loop-AES/gpgkey3.asc -o 512 /dev/loop6 /dev/hdd9
Password:
# blockdev --getbsz /dev/loop6
4096

(default soft block size is 4096 bytes)

Reply via email to