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

Re: [Nbd] Issues with the blocksize



Hi again,

one more strangeness regarding blocksize:

% nbd-client localhost /dev/nbd0 -block-size 4096 -name test
Negotiation: ..size = 16MB
bs=4096, sz=16777216 bytes

% mkfs.ext4 -b 4096 /dev/nbd0
mke2fs 1.42-WIP (20-Nov-2011)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
4096 inodes, 4096 blocks
204 blocks (4.98%) reserved for the super user
First data block=0
1 block group
32768 blocks per group, 32768 fragments per group
4096 inodes per group

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (1024 blocks): done
Writing superblocks and filesystem accounting information: done

% mount /dev/nbd0 /mnt/tmp   

This causes the following NBD request to be send to the server:

0000  25 60 95 13 00 00 00 00  a8 9a c3 04 00 88 ff ff  |%`..............|
0010  00 00 00 00 00 00 04 00  00 00 04 00              |............|
nbd_req: read 00000400 0400

The offset is not aligned to the blocksize and the length isn't a
multiple of the blocksize.


With dd on the other hand I get:

% dd if=/dev/zero of=/dev/nbd0 bs=1 count=1 seek=17000
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.00149828 s, 0.7 kB/s

0000  25 60 95 13 00 00 00 00  88 d2 a1 0a 00 88 ff ff  |%`..............|
0010  00 00 00 00 00 00 40 00  00 00 10 00              |......@...1013...|
nbd_req: read 00004000 1000

% sync

0000  25 60 95 13 00 00 00 01  48 cd 72 02 00 88 ff ff  |%`......H.r.....|
0010  00 00 00 00 00 00 40 00  00 00 10 00              |......@...1013...|
nbd_req: write 00004000 1000 [flags=0]

The kernel corectly reads in the block, writes the one byte to the
block and on sync writes the block back out.



So what is to blame for ignoring the blocksize on mount? Is the client
allowed to do unaligned requests?

MfG
        Goswin



Reply to: