Re: [PATCH 1/5] Add support for read-only subvolumes.

2011-04-25 Thread Li Zefan
>> +subvol = argv[optind+1]; >> +dst = argv[optind+2]; >> +struct btrfs_ioctl_vol_args_v2 args; > > Does the "standard C" allow to define a variable in the middle in a > function instead of in the begin ? > Anyway, even not required, I suggest to fill "args" by zero. > > + memset

Re: [PATCH 1/5] Add support for read-only subvolumes.

2011-04-25 Thread Li Zefan
> + while(1) { > + int c = getopt(argc, argv, "r"); > + if (c < 0) > + break; > + switch(c) { > + case 'r': > + optind++; > + readonly = 1; > +

Re: [PATCH 1/5] Add support for read-only subvolumes.

2011-04-25 Thread Li Zefan
Andreas Philipp wrote: > Use BTRFS_IOC_CREATE_SNAP_V2 instead of BTRFS_IOC_CREATE_SNAP and add > an option for the creation of a readonly snapshot. > > Signed-off-by: Andreas Philipp > --- > btrfs_cmds.c | 44 > 1 files changed, 36 insertions(+), 8

Re: [PATCH 0/5] Add user-space support for read-only snapshot creation.

2011-04-25 Thread Li Zefan
Andreas Philipp wrote: > There is kernel side support for the creation of read-only snapshots > for some time now, but I did not find any patches for the userspace > btrfs utilites. Thus I created this patchset which is tested and > working with kernel version 2.6.39-rc2. > > Andreas Philipp (5):

Re: [PATCH V6 3/3] btrfs: delay to insert the initial inode

2011-04-25 Thread Miao Xie
On Mon, 25 Apr 2011 16:50:43 -0400, Chris Mason wrote: > Excerpts from Miao Xie's message of 2011-04-22 06:12:24 -0400: >> Since we have implemented the delayed update of the inode, we can also >> delayed to insert the initial inode, then we can merge the inode update >> and the initial inode inser

Re: Bug#624131: linux-image-2.6.39-rc4-686-pae: Can somewhat reliably produce kernel panic in btrfs code

2011-04-25 Thread Ben Hutchings
On Mon, 2011-04-25 at 15:05 -0600, cwillu wrote: > On Mon, Apr 25, 2011 at 2:50 PM, Peter Stuge wrote: > > Maik Zumstrull wrote: > >> >> Bug at fs/btrfs/free-space-cache.c:1246 > >> >> Bug type: invalid opcode: > >> >> Kernel not tainted, running on an ASUSTek 1005HAG > >> >> EIP is at btrfs_

Re: [PATCH 1/5] Add support for read-only subvolumes.

2011-04-25 Thread Chris Mason
Excerpts from Goffredo Baroncelli's message of 2011-04-25 17:34:46 -0400: > Hi Andreas, > > On 04/25/2011 03:47 PM, Andreas Philipp wrote: > > Use BTRFS_IOC_CREATE_SNAP_V2 instead of BTRFS_IOC_CREATE_SNAP and add > > an option for the creation of a readonly snapshot. > > > > Signed-off-by: Andrea

Re: [PATCH 1/5] Add support for read-only subvolumes.

2011-04-25 Thread Goffredo Baroncelli
Hi Andreas, On 04/25/2011 03:47 PM, Andreas Philipp wrote: > Use BTRFS_IOC_CREATE_SNAP_V2 instead of BTRFS_IOC_CREATE_SNAP and add > an option for the creation of a readonly snapshot. > > Signed-off-by: Andreas Philipp > --- > btrfs_cmds.c | 44 >

Re: Bug#624131: linux-image-2.6.39-rc4-686-pae: Can somewhat reliably produce kernel panic in btrfs code

2011-04-25 Thread cwillu
On Mon, Apr 25, 2011 at 2:50 PM, Peter Stuge wrote: > Maik Zumstrull wrote: >> >> Bug at fs/btrfs/free-space-cache.c:1246 >> >> Bug type: invalid opcode: >> >> Kernel not tainted, running on an ASUSTek 1005HAG >> >> EIP is at btrfs_add_free_space+0x285/0x39a [btrfs] >> > >> > You will probabl

Re: [PATCH V6 3/3] btrfs: delay to insert the initial inode

2011-04-25 Thread Chris Mason
Excerpts from Miao Xie's message of 2011-04-22 06:12:24 -0400: > Since we have implemented the delayed update of the inode, we can also > delayed to insert the initial inode, then we can merge the inode update > and the initial inode insertions to one insertion. Awesome. With things separate from

Re: Bug#624131: linux-image-2.6.39-rc4-686-pae: Can somewhat reliably produce kernel panic in btrfs code

2011-04-25 Thread Peter Stuge
Maik Zumstrull wrote: > >> Bug at fs/btrfs/free-space-cache.c:1246 > >> Bug type: invalid opcode: > >> Kernel not tainted, running on an ASUSTek 1005HAG > >> EIP is at btrfs_add_free_space+0x285/0x39a [btrfs] > > > > You will probably need to provide a more complete copy of the panic > > messa

Re: [PATCH v2 0/7] Btrfs: New inode number allocator

2011-04-25 Thread Chris Mason
Excerpts from Chris Mason's message of 2011-04-25 13:15:58 -0400: > Excerpts from Li Zefan's message of 2011-04-25 04:57:47 -0400: > > Currently btrfs stores the highest objectid of the fs tree, and it always > > returns (highest+1) inode number when we create a file, so inode numbers > > won't be

Re: Bug#624131: linux-image-2.6.39-rc4-686-pae: Can somewhat reliably produce kernel panic in btrfs code

2011-04-25 Thread Maik Zumstrull
On Mon, Apr 25, 2011 at 22:15, Ben Hutchings wrote: > On Mon, 2011-04-25 at 22:05 +0200, Maik Zumstrull wrote: >> By simply stressing the system with some I/O, I can make it crash within >> seconds. I'm not setting a higher severity because the bug is in an >> experimental file system in an exper

Re: Bug#624131: linux-image-2.6.39-rc4-686-pae: Can somewhat reliably produce kernel panic in btrfs code

2011-04-25 Thread Ben Hutchings
On Mon, 2011-04-25 at 22:05 +0200, Maik Zumstrull wrote: > Package: linux-image-2.6.39-rc4-686-pae > Version: 2.6.39~rc4-1~experimental.1 > Severity: normal > Tags: experimental > > By simply stressing the system with some I/O, I can make it crash within > seconds. I'm not setting a higher severit

Re: [PATCH v2 0/7] Btrfs: New inode number allocator

2011-04-25 Thread Chris Mason
Excerpts from Li Zefan's message of 2011-04-25 04:57:47 -0400: > Currently btrfs stores the highest objectid of the fs tree, and it always > returns (highest+1) inode number when we create a file, so inode numbers > won't be reclaimed when we delete files, so we'll run out of inode numbers > as we

Re: [PATCH 1/2] fs: add SEEK_HOLE and SEEK_DATA flags

2011-04-25 Thread Eric Blake
On 04/25/2011 09:02 AM, Nick Bowler wrote: Hi Nick, > * File A (sparse file created by lseek/write beyond end-of-file): > > data | hole 0 | data || hole 1 (virtual) > > * File B (sparse file created by truncate beyond end-of-file): > > data | hole 0 || hole 1 (virtual) > > Excluding th

Re: [PATCH 1/2] fs: add SEEK_HOLE and SEEK_DATA flags

2011-04-25 Thread Nick Bowler
Hi Eric, On 2011-04-22 07:06 -0600, Eric Blake wrote: > I've created a request to standardize SEEK_HOLE and SEEK_DATA in the > next revision of POSIX; comments are welcome to make sure that everyone > is happy with wording: > http://austingroupbugs.net/view.php?id=415 Reading through your proposa

Re: [PATCH 1/2] fs: add SEEK_HOLE and SEEK_DATA flags

2011-04-25 Thread Jamie Lokier
Eric Blake wrote: > On 04/24/2011 11:49 AM, Jamie Lokier wrote: > >> My problem with FIND_* is that we are messing with the well understood > >> semantics of lseek(). > > > > fcntl() looks a better fit for FIND_HOLE/DATA anyway. > > With fcntl(), it would have to be something like: > > off_t off

[PATCH 5/5] Updated documentation for btrfs subvolume snapshot.

2011-04-25 Thread Andreas Philipp
Signed-off-by: Andreas Philipp --- man/btrfs.8.in | 11 ++- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/man/btrfs.8.in b/man/btrfs.8.in index 26ef982..b59bc6f 100644 --- a/man/btrfs.8.in +++ b/man/btrfs.8.in @@ -5,7 +5,7 @@ .SH NAME btrfs \- control a btrfs filesyst

[PATCH 3/5] Added support for an additional ioctl.

2011-04-25 Thread Andreas Philipp
Added BTRFS_IOC_SNAP_CREATE_V2 and struct btrfs_ioctl_vol_args_v2 as defined in fs/btrfs/ioctl.h in the kernel sources. Signed-off-by: Andreas Philipp --- ioctl.h | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/ioctl.h b/ioctl.h index 776d7a9..358f814 10064

[PATCH 4/5] Test the additional ioctl.

2011-04-25 Thread Andreas Philipp
Signed-off-by: Andreas Philipp --- ioctl-test.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/ioctl-test.c b/ioctl-test.c index 7cf3bc2..1c27d61 100644 --- a/ioctl-test.c +++ b/ioctl-test.c @@ -22,6 +22,7 @@ unsigned long ioctls[] = { BTRFS_IOC_INO_LOOKUP,

[PATCH 2/5] Support the new parameters in do_clone(int argc, char** argv).

2011-04-25 Thread Andreas Philipp
Now 'btrfs subvolume snapshot' takes not two but only at least two parameters. Additionally, the help message is updated accordingly. Signed-off-by: Andreas Philipp --- btrfs.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/btrfs.c b/btrfs.c index 46314cf..f70d64b

[PATCH 1/5] Add support for read-only subvolumes.

2011-04-25 Thread Andreas Philipp
Use BTRFS_IOC_CREATE_SNAP_V2 instead of BTRFS_IOC_CREATE_SNAP and add an option for the creation of a readonly snapshot. Signed-off-by: Andreas Philipp --- btrfs_cmds.c | 44 1 files changed, 36 insertions(+), 8 deletions(-) diff --git a/btrfs_cmds

[PATCH 0/5] Add user-space support for read-only snapshot creation.

2011-04-25 Thread Andreas Philipp
There is kernel side support for the creation of read-only snapshots for some time now, but I did not find any patches for the userspace btrfs utilites. Thus I created this patchset which is tested and working with kernel version 2.6.39-rc2. Andreas Philipp (5): Add support for read-only subvolu

Re: [PATCH 1/2] fs: add SEEK_HOLE and SEEK_DATA flags

2011-04-25 Thread Eric Blake
On 04/24/2011 11:49 AM, Jamie Lokier wrote: >> My problem with FIND_* is that we are messing with the well understood >> semantics of lseek(). > > fcntl() looks a better fit for FIND_HOLE/DATA anyway. With fcntl(), it would have to be something like: off_t offset = start; if (fcntl (fd, F_FIND_H

Re: Read Only snapshots

2011-04-25 Thread Chris Mason
Excerpts from David Morgado's message of 2011-04-24 21:24:16 -0400: > Hi, btrfs-progs patches for read only snapshots aren't in Chris > repository yet but btrfs already has support for that in place so, > someone forgot about this? > > It appears that some new patches are coming to Chris btrfs-pro

Re: [PATCH 05/12] btrfs: remove useless mutex lock/unlock sequences

2011-04-25 Thread Chris Mason
Excerpts from Tsutomu Itoh's message of 2011-04-25 02:25:58 -0400: > (2011/04/22 18:41), David Sterba wrote: > > Signed-off-by: David Sterba > > --- > > fs/btrfs/extent-tree.c |6 -- > > 1 files changed, 0 insertions(+), 6 deletions(-) > > > > diff --git a/fs/btrfs/extent-tree.c b/fs/btr

Re: [RFC PATCH] Btrfs: do not flush csum items of unchanged file data during treelog

2011-04-25 Thread liubo
On 04/22/2011 09:28 AM, Chris Mason wrote: > Excerpts from Li Zefan's message of 2011-04-21 20:55:40 -0400: >> Chris Mason wrote: >>> Excerpts from liubo's message of 2011-04-21 03:58:21 -0400: The current code relogs the entire inode every time during fsync log, and it is much better sui

Re: [PATCH v2 0/7] Btrfs: New inode number allocator

2011-04-25 Thread Li Zefan
Li Zefan wrote: > Currently btrfs stores the highest objectid of the fs tree, and it always > returns (highest+1) inode number when we create a file, so inode numbers > won't be reclaimed when we delete files, so we'll run out of inode numbers > as we keep create/delete files in 32bits machines. >

[PATCH v2 7/7] Btrfs: Support reading/writing on disk free ino cache

2011-04-25 Thread Li Zefan
This is similar to block group caching. We dedicate a special inode in fs tree to save free ino cache. At the very first time we create/delete a file after mount, the free ino cache will be loaded from disk into memory. When the fs tree is commited, the cache will be written back to disk. To kee

[PATCH v2 6/7] Btrfs: Always use 64bit inode number

2011-04-25 Thread Li Zefan
There's a potential problem in 32bit system when we exhaust 32bit inode numbers and start to allocate big inode numbers, because btrfs uses inode->i_ino in many places. So here we always use BTRFS_I(inode)->location.objectid, which is an u64 variable. There are 2 exceptions that BTRFS_I(inode)->l

[PATCH v2 5/7] Btrfs: Make the code for reading/writing free space cache generic

2011-04-25 Thread Li Zefan
Extract out block group specific code from lookup_free_space_inode(), create_free_space_inode(), load_free_space_cache() and btrfs_write_out_cache(), so the code can be used to read/write free ino cache. Signed-off-by: Li Zefan --- fs/btrfs/free-space-cache.c | 358 -

[PATCH v2 4/7] Btrfs: Cache free inode numbers in memory

2011-04-25 Thread Li Zefan
Currently btrfs stores the highest objectid of the fs tree, and it always returns (highest+1) inode number when we create a file, so inode numbers won't be reclaimed when we delete files, so we'll run out of inode numbers as we keep create/delete files in 32bits machines. This fixes it, and it wor

[PATCH v2 3/7] Btrfs: Make free space cache code generic

2011-04-25 Thread Li Zefan
So we can re-use the code to cache free inode numbers. The change is quite straightforward. Two new structures are introduced. - struct btrfs_free_space_ctl We move those variables that are used for caching free space from struct btrfs_block_group_cache to this new struct. - struct btrfs_fr

[PATCH v2 2/7] Btrfs: Use bitmap_set/clear()

2011-04-25 Thread Li Zefan
No functional change. Signed-off-by: Li Zefan --- fs/btrfs/free-space-cache.c | 20 1 files changed, 8 insertions(+), 12 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 3af64c6..0e23bba 100644 --- a/fs/btrfs/free-space-cache.c +++

[PATCH v2 1/7] Btrfs: Remove unused btrfs_block_group_free_space()

2011-04-25 Thread Li Zefan
We've already recorded the value in block_group->frees_space. Signed-off-by: Li Zefan --- fs/btrfs/free-space-cache.c | 15 --- fs/btrfs/free-space-cache.h |1 - 2 files changed, 0 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-ca

[PATCH v2 0/7] Btrfs: New inode number allocator

2011-04-25 Thread Li Zefan
Currently btrfs stores the highest objectid of the fs tree, and it always returns (highest+1) inode number when we create a file, so inode numbers won't be reclaimed when we delete files, so we'll run out of inode numbers as we keep create/delete files in 32bits machines. This patchset aims to fix