So st_blocks on FUSE mount is different from st_blocks on backend for the
same file?

Yes. Just a quick example: I create a file with 5 Bytes in size. I theory 
Gluster should report 8 x 512 Byte blocks, because the underlying XFS uses a 4K 
block size. Instead, it reports the minimum count of blocks the file size would 
fit in:

client> echo test > /gluster/tmp/test.txt

client> stat /gluster/tmp/test.txt
 File: `/gluster/tmp/test.txt'
 Size: 5                Blocks: 1          IO Block: 131072 regular file
Device: 14h/20d Inode: 12072747239032953097  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-11-26 12:09:22.960828776 +0100
Modify: 2013-11-26 12:09:22.964828962 +0100
Change: 2013-11-26 12:09:22.964828962 +0100
Birth: -

gluster> stat /bricks/0/tmp/test.txt
 File: `/bricks/0/tmp/test.txt'
 Size: 5                Blocks: 8          IO Block: 4096   regular file
Device: ca03h/51715d    Inode: 859069733   Links: 2
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-11-26 12:09:22.957683891 +0100
Modify: 2013-11-26 12:09:22.961684089 +0100
Change: 2013-11-26 12:09:22.961684089 +0100
Birth: -


On Nov 25, 2013 8:50 AM, "Maik Kulbe" <[email protected]>
wrote:

From man (2) stat:

blksize_t st_blksize; /* blocksize for file system I/O */
blkcnt_t  st_blocks;  /* number of 512B blocks allocated */

The 128K  you are seeing is "st_blksize" which is the recommended I/O
transfer size. The number of consumed blocks is always reported as 512
byte blocks. The actual block size with which storage allocation
happens
depends on the backend filesystem.

This is what was confusing me. On the file systems one of our
programmers tested the latter one it was always showing the blocks
allocated. So if you had a 1k file and 4k block size it would report 8
512-byte blocks, gluster just reports 2 blocks.

Avati

On Mon, Nov 25, 2013 at 7:18 AM, Maik Kulbe
<[email protected]> wrote:

Hi,

I've come to notice that the file system block size reported from stat
on a client is 128k, which is pretty high for the small files I use.
On
the other hand, I tested copying smaller files to the volume and it
seems those 128k are not the real block size - when I copy two 64k
files
to the volume `df` reports only a change after both files have been
copied.

So my question would be what is the real block size for the Gluster
volume? The block size of the underlying xfs? Or something else? And
is
it possible to read the real block size? We wanted to use the block
size
reported by stat to calculate the real file size use on disk but it
seems that is not possible with Gluster..

Thank you in advance,
Maik
_______________________________________________
Gluster-users mailing list
[email protected]
http://supercolony.gluster.org/mailman/listinfo/gluster-users
_______________________________________________
Gluster-users mailing list
[email protected]
http://supercolony.gluster.org/mailman/listinfo/gluster-users

Reply via email to