Re: cephfs set_layout behaviour

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

 



On Tue, 12 Mar 2013, Varun Chandramouli wrote:
> Hi All,
> I was running some experiments on my 3-node ceph cluster (mounted at
> /mnt/ceph), and noticed unexpected behavior regarding cephfs set_layout
> command.
> 
> root@varunc-virtual-machine:/mnt/ceph/folder1# touch test3
> root@varunc-virtual-machine:/mnt/ceph/folder1# cephfs test3 set_layout -p 3
> -s 41943040
> root@varunc-virtual-machine:/mnt/ceph/folder1# cephfs test3 show_layout
> layout.data_pool:     3
> layout.object_size:   41943040
> layout.stripe_unit:   4194304
> layout.stripe_count:  1
> root@varunc-virtual-machine:/mnt/ceph/folder1# vi test3
> root@varunc-virtual-machine:/mnt/ceph/folder1# cephfs test3 show_layout
> layout.data_pool:     0
> layout.object_size:   4194304
> layout.stripe_unit:   4194304
> layout.stripe_count:  1
> 
> I create an empty file and set its layout (which it displays correctly in
> the corresponding show_layout). Then, I open the file and write something to
> it (a single line of text), and again use the show_layout command, and it
> reverts to the default layout. What is the reason for this? Is it that I can
> not write to the file simply using vi editor? Because when I do the same
> process again, but instead use cat command to redirect the input into the
> new file, the layout set by me persists.

I think this is because vi is doing something like:

vi foo:
 copy foo to foo.swp
 ...edit foo.swp...
 on save, rename foo.swp to foo

which means it's basically a different file.  You can verify this by 
looking at the ino field from 'stat test3' before and after editing with 
vi.

> root@varunc-virtual-machine:/mnt/ceph/folder1# touch test4
> root@varunc-virtual-machine:/mnt/ceph/folder1# cephfs test4 set_layout -p 3
> -s 41943040
> root@varunc-virtual-machine:/mnt/ceph/folder1# cephfs test4 show_layout
> layout.data_pool:     3
> layout.object_size:   41943040
> layout.stripe_unit:   4194304
> layout.stripe_count:  1
> root@varunc-virtual-machine:/mnt/ceph/folder1# cat file1.txt > test4
> root@varunc-virtual-machine:/mnt/ceph/folder1# cephfs test4 show_layout
> layout.data_pool:     3
> layout.object_size:   41943040
> layout.stripe_unit:   4194304
> layout.stripe_count:  1
> 
> Also, how do I set the layout for an entire directory. I tried the
> following:
> root@varunc-virtual-machine:/mnt/ceph# cephfs folder2/ set_layout -p 3 -s
> 4194304
> Error setting layout: Invalid argument
> root@varunc-virtual-machine:/mnt/ceph# cephfs folder1/ set_layout -p 0 -s
> 4194304
> Error setting layout: Invalid argument
> 
> (folder1 contains around 1000 files, folder2 is empty)

Can you try using the virtual xattr interface instead?

 getfattr -d -m - mydir
 setfattr -n ceph.dir.layout.pool -v mypool mydir
 ...

sage
_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux