[PATCH] async-thread: fix possible memory leak

2008-07-24 Thread Li Zefan
When kthread_run() returns failure, this worker hasn't been added to the list, so btrfs_stop_workers() won't free it. Signed-off-by: Li Zefan [EMAIL PROTECTED] --- async-thread.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/async-thread.c b/async-thread.c index

[PATCH v2 0/5] Btrfs: Readonly snapshots

2010-12-09 Thread Li Zefan
This patchset adds readonly-snapshots support. You can create a readonly snapshot, and you can also set a snapshot (subvolume also) readonly/writable on the fly. A few readonly checks are added in setattr, permission, remove_xattr and set_xattr callbacks, as well as in some ioctls. The patchset

[PATCH v2 1/5] Btrfs: Make async snapshot ioctl more generic

2010-12-09 Thread Li Zefan
So we don't have to add new structures as we create more ioctls for snapshots/subvolumes. Now to create async snapshot, set BTRFS_SUBVOL_CREATE_SNAP_ASYNC bit of vol_arg_v2-flags, and then call ioctl(BTRFS_IOCT_SNAP_CREATE_V2). Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c

[PATCH v2 3/5] Btrfs: Add helper __setup_root_post()

2010-12-09 Thread Li Zefan
Eliminate duplicate code in btrfs_read_fs_root_no_radix() and find_and_setup_root(). Also prepare for the next patch. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/disk-io.c | 31 +++ 1 files changed, 15 insertions(+), 16 deletions(-) diff --git a/fs

[PATCH v2 4/5] Btrfs: Add readonly snapshots support

2010-12-09 Thread Li Zefan
, btrfs_set/remove_xattr and some ioctls. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ctree.h |3 +++ fs/btrfs/disk-io.c |5 + fs/btrfs/inode.c |8 fs/btrfs/ioctl.c | 40 +++- fs/btrfs/ioctl.h

[PATCH v2 5/5] Btrfs: Add BTRFS_IOC_SUBVOL_GETFLAGS/SETFLAGS ioctl

2010-12-09 Thread Li Zefan
. - Change the name from _SNAP_SETFLAGS to _SUBVOL_SETFLAGS. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 92 ++ fs/btrfs/ioctl.h |4 ++ 2 files changed, 96 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs

Re: [PATCH] Btrfs: fix sync subvol/snapshot creation

2010-12-09 Thread Li Zefan
...@newdream.net Reviewed-by: Li Zefan l...@cn.fujitsu.com -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH v3] Btrfs: Make async snapshot ioctl more generic

2010-12-09 Thread Li Zefan
. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- I rebased the patch on Sage's fix, so you don't have to rebase it by yourself. --- fs/btrfs/ioctl.c | 44 +++- fs/btrfs/ioctl.h | 14 +- 2 files changed, 36 insertions(+), 22 deletions(-) diff

Re: [PATCH v2 4/5] Btrfs: Add readonly snapshots support

2010-12-09 Thread Li Zefan
+#define BTRFS_ROOT_SNAP_RDONLY (1ULL 0) + struct btrfs_root_item { struct btrfs_inode_item inode; __le64 generation; @@ -1116,6 +1118,7 @@ struct btrfs_root { int defrag_running; char *name; int in_sysfs; +bool readonly; Does make sense to store

Re: [PATCH v2 5/5] Btrfs: Add BTRFS_IOC_SUBVOL_GETFLAGS/SETFLAGS ioctl

2010-12-09 Thread Li Zefan
Goffredo Baroncelli wrote: Hi Li, On Thursday, 09 December, 2010, Li Zefan wrote: This allows us to set a snapshot or a subvolume readonly or writable on the fly. Usage: Set BTRFS_SUBVOL_RDONLY of btrfs_ioctl_vol_arg_v2-flags, and then call ioctl(BTRFS_IOCTL_SUBVOL_SETFLAGS

Re: [PATCH] Btrfs: do not BUG if we fail to remove the orphan item for dead snapshots

2010-12-09 Thread Li Zefan
01:25, Josef Bacik wrote: Not being able to delete an orphan item isn't a horrible thing. The worst that happens is the next time around we try and do the orphan cleanup and we can't find the referenced object and just delete the item and move on. Thanks, Would be better to add code

Re: btrfs subvolume list fails to show all snapshots

2010-12-13 Thread Li Zefan
After creating snapshot 10 from snapshot 9, snapshot 6 vanished from the output of btrfs subvolume list /dev/sdf1: # btrfs subv list /mnt/sdf1 ID 256 top level 5 path snap01 ID 257 top level 5 path snap02 ID 258 top level 5 path snap03 ID 259 top level 5

[PATCH 2/3] Btrfs: Don't return items more than user specified

2010-12-13 Thread Li Zefan
We check if num_found = sk-nr_items every time we find an expected item, but num_found is not incremented, so we may return items more than the user asked. Also return -EINVAL if the user specified 0 nr_items. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c |7 --- 1

[PATCH 3/3] Btrfs: Clean up tree search ioctl code

2010-12-13 Thread Li Zefan
- Check if the key is within specified range before checking the item length. - Advance to the next key a bit more efficiently. - Remove redundant code. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 30 -- 1 files changed, 12 insertions(+), 18

Re: Bug in the design of the tree search ioctl API ? [was Re: [PATCH 1/3] Btrfs: Really return keys within specified range]

2010-12-13 Thread Li Zefan
Goffredo Baroncelli wrote: Hi Li, On Monday, 13 December, 2010, Li Zefan wrote: The keys returned by tree search ioctl should be restricted to: key.objectid = [min_objectid, max_objectid] key.offset = [min_offset, max_offset] key.type = [min_type, max_type

Re: Bug in the design of the tree search ioctl API ? [was Re: [PATCH 1/3] Btrfs: Really return keys within specified range]

2010-12-14 Thread Li Zefan
Goffredo Baroncelli wrote: On Tuesday, 14 December, 2010, Li Zefan wrote: Goffredo Baroncelli wrote: Hi Li, On Monday, 13 December, 2010, Li Zefan wrote: The keys returned by tree search ioctl should be restricted to: key.objectid = [min_objectid, max_objectid] key.offset

Re: Bug in the design of the tree search ioctl API ? [was Re: [PATCH 1/3] Btrfs: Really return keys within specified range]

2010-12-14 Thread Li Zefan
Goffredo Baroncelli wrote: On Wednesday, 15 December, 2010, Li Zefan wrote: h4) objectid asis, type asis, offset++ - we should get the correct result. This fix the problem of the missing subvolume. But for the other case (searching for more than one type) the problem still here. I don't

Re: Bug in the design of the tree search ioctl API ? [was Re: [PATCH 1/3] Btrfs: Really return keys within specified range]

2010-12-15 Thread Li Zefan
02:48, Goffredo Baroncelli wrote: On Wednesday, 15 December, 2010, Li Zefan wrote: Goffredo Baroncelli wrote: On Wednesday, 15 December, 2010, Li Zefan wrote: h4) objectid asis, type asis, offset++ - we should get the correct result. This fix the problem of the missing subvolume

[PATCH v3 0/3] Btrfs: Readonly snapshots

2010-12-23 Thread Li Zefan
This patchset adds readonly-snapshots support. You can create a readonly snapshot, and you can also set a snapshot (subvolume also) readonly/writable on the fly. A few readonly checks are added in setattr, permission, remove_xattr and set_xattr callbacks, as well as in some ioctls. The patchset

[PATCH v3 1/3] Btrfs: Refactor btrfs_ioctl_snap_create()

2010-12-23 Thread Li Zefan
Split it into two functions for two different ioctls, since they share no common code. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 84 + 1 files changed, 40 insertions(+), 44 deletions(-) diff --git a/fs/btrfs/ioctl.c

[PATCH v3 2/3] Btrfs: Add readonly snapshots support

2010-12-23 Thread Li Zefan
. Changelog for v3: - Eliminate btrfs_root-readonly, but check btrfs_root-root_item.flags. - Rename BTRFS_ROOT_SNAP_RDONLY to BTRFS_ROOT_SUBVOL_RDONLY. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ctree.h |7 +++ fs/btrfs/inode.c |8 fs/btrfs/ioctl.c

[PATCH v3 3/3] Btrfs: Add BTRFS_IOC_SUBVOL_GETFLAGS/SETFLAGS ioctls

2010-12-23 Thread Li Zefan
ioctl. - Check if the passed fd is the root of a subvolume. - Change the name from _SNAP_SETFLAGS to _SUBVOL_SETFLAGS. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 83 ++ fs/btrfs/ioctl.h |2 + 2 files changed, 85

Re: [GIT PULL][PATCH v2 0/6] btrfs: Add lzo compression support

2010-12-23 Thread Li Zefan
cwillu wrote: On Wed, Nov 17, 2010 at 8:08 PM, Li Zefan l...@cn.fujitsu.com wrote: Hi Chris, Here's the updated patchset. As I still haven't got a kernel.org account, I have set up a git tree in another public git repository, and I'll use it for now. You can pull from: git

Re: Reproducible kernel BUG while using VirtualBox:

2010-12-29 Thread Li Zefan
Kenneth Lakin wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 All, I believe that I can pretty reliably reproduce the BUG mentioned in the attached dmesg output. (This doesn't mean that you can, but I'll detail what I've done here.) [This BUG is the same one that I reported last

Re: btrfs build failure in latest git

2011-01-11 Thread Li Zefan
Jeff Garzik wrote: Tree as of commit 7bc4a4ce68f8c6d064ea949446852e996526f692 dies during btrfs build on x86-64: CC [M] fs/btrfs/ctree.o In file included from fs/btrfs/ctree.c:21:0: fs/btrfs/ctree.h:1003:17: error: field ‘super_kobj’ has incomplete type fs/btrfs/ctree.h:1074:17:

Re: btrfs subvolume list fails to show all snapshots

2011-01-20 Thread Li Zefan
07:01, Ian! D. Allen wrote: Still getting btrfs subvolume list errors with this source: git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-progs-unstable.git Just because the fix hasn't been merged into the git tree.. I create ten snapshots, and after creating the tenth one, the

Re: [RFC][PATCH] Btrfs: New inode number allocator

2011-01-26 Thread Li Zefan
Chris Mason wrote: Excerpts from Li Zefan's message of 2011-01-25 20:53:00 -0500: (WARNING: this patch is not completed or well-tested) We used to allocate inode number by searching through inode items, but it made the allocation slower and slower as more and more files created. The

[PATCH 01/12] btrfs: Fix threshold calculation for block groups smaller than 1GB

2011-01-27 Thread Li Zefan
...@redhat.com Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 60d6842..42f4015 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs

[PATCH 02/12] btrfs: Add helper function free_bitmap()

2011-01-27 Thread Li Zefan
Remove some duplicated code. This prepares for the next patch. Reviewed-by: Josef Bacik jo...@redhat.com Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c | 37 - 1 files changed, 16 insertions(+), 21 deletions(-) diff --git a/fs

[PATCH 03/12] btrfs: Free fully occupied bitmap in cluster

2011-01-27 Thread Li Zefan
If there's no more free space in a bitmap, we should free it. Reviewed-by: Josef Bacik jo...@redhat.com Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs

[PATCH 05/12] btrfs: Add a helper try_merge_free_space()

2011-01-27 Thread Li Zefan
trying to drop it into bitmap. This also prepares for the next patch. Reviewed-by: Josef Bacik jo...@redhat.com Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c | 75 -- 1 files changed, 43 insertions(+), 32 deletions(-) diff

[PATCH 07/12] Btrfs: Fix memory leak at umount

2011-01-27 Thread Li Zefan
fs_info, which is allocated in open_ctree(), should be freed in close_ctree(). Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/disk-io.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index a5d2249..089871e 100644

[PATCH 09/12] Btrfs: Free correct pointer after using strsep

2011-01-27 Thread Li Zefan
From: Tero Roponen tero.ropo...@gmail.com We must save and free the original kstrdup()'ed pointer because strsep() modifies its first argument. Signed-off-by: Tero Roponen tero.ropo...@gmail.com Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/super.c |5 +++-- 1 files changed, 3

[PATCH 12/12] Btrfs: Fix file clone when source offset is not 0

2011-01-27 Thread Li Zefan
wrong. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index f87552a..1b61dab 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1788,7 +1788,10 @@ static noinline

Re: btrfs: issues with SUBVOL_SETFLAGS

2011-02-09 Thread Li Zefan
Dan Rosenberg wrote: Commit 0caa102da82799efaba88e234484786a9591c797 introduced the SUBVOL_SETFLAGS ioctl, which contains the following check: if (flags ~BTRFS_SUBVOL_CREATE_ASYNC) Oops, should be: if (flags BTRFS_SUBVOL_CREATE_ASYNC) return -EINVAL; if

[PATCH 1/2] Btrfs: Fix BTRFS_IOC_SUBVOL_SETFLAGS ioctl

2011-02-15 Thread Li Zefan
- Check user-specified flags correctly - Check the inode owership - Search root item in root tree but not fs tree Reported-by: Dan Rosenberg drosenb...@vsecurity.com Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c |7 +-- 1 files changed, 5 insertions(+), 2 deletions

[PATCH 2/2] Btrfs: Avoid accessing unmapped kernel address

2011-02-15 Thread Li Zefan
case. Reported-by: Juan Francisco Cantero Hurtado i...@juanfra.info Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/lzo.c | 21 ++--- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index cc9b450..a178f5e 100644 --- a/fs

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

2011-03-16 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 32bit machines. This patchset aims to fix

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

2011-03-16 Thread Li Zefan
Signed-off-by: Li Zefan l...@cn.fujitsu.com --- 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-cache.c index a039065..4e27eaa 100644

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

2011-03-16 Thread Li Zefan
Signed-off-by: Li Zefan l...@cn.fujitsu.com --- 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 4e27eaa..bc60114 100644 --- a/fs/btrfs/free-space-cache.c +++ b

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

2011-03-16 Thread Li Zefan
-transaction case. The rb-tree is a hybrid extent+bitmap tree, so if we have too many small chunks of inode numbers, we'll use bitmaps. Initially we allow 16K ram of extents, and a bitmap will be used if we exceed this threshold. The extents threshold is adjusted in runtime. Signed-off-by: Li Zefan l

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

2011-03-16 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 l...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c | 317

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

2011-03-16 Thread Li Zefan
. To keep compatibility, we check the root generation against the generation of the special inode when loading the cache, so the loading will fail if the btrfs filesystem was mounted in an older kernel before. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ctree.h|7 +++ fs

Re: [PATCH] btrfs scrub: extent_map reference not freed

2011-03-17 Thread Li Zefan
Arne Jansen wrote: scrub_chunk failed to free all extent_maps it referenced, leading to a leak of these maps on unmount. Reported-by: Ilya Dryomov idryo...@gmail.com Signed-off-by: Arne Jansen sensi...@gmx.net I think it's better to fold those fix-up patches into your original scrub

Re: [PATCH] Btrfs: don't be as aggressive about using bitmaps

2011-03-20 Thread Li Zefan
04:18, Josef Bacik wrote: We have been creating bitmaps for small extents unconditionally forever. This was great when testing to make sure the bitmap stuff was working, but is overkill normally. So instead of always adding small chunks of free space to bitmaps, only start doing it if we go

Re: [PATCH] Btrfs: check free space in block group before searching for a cluster

2011-03-20 Thread Li Zefan
Josef Bacik wrote: The free space cluster stuff is heavy duty, so there is no sense in going through the entire song and dance if there isn't enough space in the block group to begin with. Thanks, Signed-off-by: Josef Bacik jo...@redhat.com Reviewed-by: Li Zefan l...@cn.fujitsu.com

Re: read-only subvolumes?

2011-03-23 Thread Li Zefan
Hi all, When I am creating subvolumes I get this strange behavior. If I create a subvolume with a name longer than 4 characters it is read-only, if the name is shorter than 5 characters the subvolume is writeable as expected. I think it is since I upgraded to kernel version 2.6.38 (I do

Re: read-only subvolumes?

2011-03-24 Thread Li Zefan
When I am creating subvolumes I get this strange behavior. If I create a subvolume with a name longer than 4 characters it is read-only, if the name is shorter than 5 characters the subvolume is writeable as expected. I think it is since I upgraded to kernel version 2.6.38 (I do not create

Re: read-only subvolumes?

2011-03-24 Thread Li Zefan
IMHO, this is related to how the debug options of the kernel are configured. Attached you find two config files, both for kernel version 2.6.38, with the one named 2.6.38-debug everything works and with the other one newly created subvolumes are read only. I've figured out what's wrong.

[RFC][PATCH] Btrfs: Fix uninitialized root flags for subvolumes

2011-03-27 Thread Li Zefan
-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ctree.h |4 fs/btrfs/disk-io.c |4 +++- fs/btrfs/ioctl.c |4 fs/btrfs/root-tree.c | 18 ++ fs/btrfs/transaction.c |1 + 5 files changed, 30 insertions(+), 1 deletions(-) diff --git a/fs

[PATCH] Btrfs: Fix oops for defrag with compression turned on

2011-03-28 Thread Li Zefan
Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/inode.c | 17 - 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index db67821..fa9fd5e 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -108,6 +108,7 @@ static int

Re: [GIT PULL] Btrfs updates for 2.6.39

2011-03-28 Thread Li Zefan
David Sterba wrote: Hi, Chris, you did not add my sign-of on the unaligned fix I've posted, nor the tested-by or reported-by. Looking again into the mail, it seems like some automated-misprocessing picked the first part of the mail altough there was properly formated patch after '--' marker

Re: [PATCH] Btrfs: fix free space cache when there are pinned extents and clusters

2011-04-01 Thread Li Zefan
+ spin_lock(block_group-tree_lock); + if (btrfs_block_group_free_space(block_group) != This function call can be replaced by block_group-free_space, so we don't have to iterate the tree. (This function gets removed in my patchset for inode number caching) +

Re: [PATCH 2/2 v2] Btrfs: Per file/directory controls for COW and compression

2011-04-05 Thread Li Zefan
liubo wrote: On 04/04/2011 05:31 PM, Konstantinos Skarlatos wrote: Hello, I would like to ask about the status of this feature/patch, is it accepted into btrfs code, and how can I use it? Yes, it is now in the latest 2.6.39-rc1. I am interested in enabling compression in a specific

Re: files on not mounted subvolumes - mysql complains read only

2011-04-05 Thread Li Zefan
krz...@gmail.com wrote: When I've used btrfs subvolume, without separately mouting it, for mysql database dir I've got Fatal error: Can't open and lock privilege tables: Table 'host' is read only when starting mysql. When I've put mysql database dir in root of btrfs, not a subvolume, mysql

Re: [PATCH V2] Btrfs: fix subvolume mount by name problem when default mount subvolume is set

2011-04-06 Thread Li Zefan
13:27, Zhong, Xin wrote: We create two subvolumes (meego_root and meego_home) in btrfs root directory. And set meego_root as default mount subvolume. After we remount btrfs, meego_root is mounted to top directory by default. Then when we try to mount meego_home (subvol=meego_home) to a

Re: [PATCH v4 1/8] btrfs: Balance progress monitoring

2011-04-07 Thread Li Zefan
01:06, Hugo Mills wrote: This patch introduces a basic form of progress monitoring for balance operations, by counting the number of block groups remaining. The information is exposed to userspace by an ioctl. Signed-off-by: Hugo Mills h...@carfax.org.uk --- fs/btrfs/ctree.h |9

Re: [PATCH] Btrfs: fix memory leaks in btrfs_new_inode()

2011-04-10 Thread Li Zefan
Yoshinori Sano wrote: This patch fixes memory leaks in btrfs_new_inode(). Signed-off-by: Yoshinori Sano yoshinori.s...@gmail.com --- fs/btrfs/inode.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index aa116dc..d8c93c1

[PATCH 0/4] Btrfs: A few small bug fixes

2011-04-13 Thread Li Zefan
Hi Chris, Those bugs are small, and the fixes are simple and straitforward. You can pull from: git://repo.or.cz/linux-btrfs-devel.git for-chris Li Zefan (2): Btrfs: Check if btrfs_next_leaf() returns error in btrfs_listxattr() Btrfs: Check if btrfs_next_leaf() returns

[PATCH 1/4] Btrfs: Check if btrfs_next_leaf() returns error in btrfs_listxattr()

2011-04-13 Thread Li Zefan
btrfs_next_leaf() can return -errno, and we should propagate it to userspace. This also simplifies how we walk the btree path. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/xattr.c | 33 - 1 files changed, 12 insertions(+), 21 deletions(-) diff

[PATCH 2/4] Btrfs: Check if btrfs_next_leaf() returns error in btrfs_real_readdir()

2011-04-13 Thread Li Zefan
btrfs_next_leaf() can return -errno, and we should propagate it to userspace. This also simplifies how we walk the btree path. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/inode.c | 28 ++-- 1 files changed, 10 insertions(+), 18 deletions(-) diff --git

[PATCH 3/4] Btrfs: Fix incorrect inode nlink in btrfs_link()

2011-04-13 Thread Li Zefan
From: Miao Xie mi...@cn.fujitsu.com Link count of the inode is not decreased if btrfs_set_inode_index() fails. Signed-off-by: Miao Xie mi...@cn.fujitsu.com Singed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/inode.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff

[PATCH 1/3] fs: remove FS_COW_FL

2011-04-14 Thread Li Zefan
, a newly created file will be set with the FS_NOCOW_FL flag. So to turn on COW for it, we can just clear the FS_NOCOW_FL flag. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 15 ++- include/linux/fs.h |1 - 2 files changed, 6 insertions(+), 10 deletions(-) diff

[PATCH 3/3] Btrfs: fix FS_IOC_SETFLAGS ioctl

2011-04-14 Thread Li Zefan
Steps to reproduce the bug: - Call FS_IOC_SETLFAGS ioctl with flags=FS_COMPR_FL - Call FS_IOC_SETFLAGS ioctl with flags=0 - Call FS_IOC_GETFLAGS ioctl, and you'll see FS_COMPR_FL is still set! Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c |2 ++ 1 files changed, 2

[PATCH 2/3] Btrfs: fix FS_IOC_GETFLAGS ioctl

2011-04-14 Thread Li Zefan
As we've added per file compression/cow support. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 3240dd9..aeabf6b 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs

[PATCH] Btrfs: Free free_space item properly in btrfs_trim_block_group()

2011-04-20 Thread Li Zefan
Since commit dc89e9824464e91fa0b06267864ceabe3186fd8b, we've changed to use a specific slab for alocation of free_space items. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/free-space

Re: [PATCH] Btrfs: free bitmaps properly when evicting the cache

2011-04-20 Thread Li Zefan
us from panicing when we check to make sure we don't have too many bitmaps. Thanks, Signed-off-by: Josef Bacik jo...@redhat.com Reviewed-by: Li Zefan l...@cn.fujitsu.com -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord

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

2011-04-21 Thread Li Zefan
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 suited to small files rather than large ones. During my performance test, the fsync performace of large files sucks, and

[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

[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 l...@cn.fujitsu.com --- 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

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

2011-04-25 Thread Li Zefan
No functional change. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- 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

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

2011-04-25 Thread Li Zefan
btrfs_free_space_op We do block group specific work (e.g. calculation of extents threshold) through functions registered in this struct. And then we can remove references to struct btrfs_block_group_cache. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ctree.h|7 +- fs

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

2011-04-25 Thread Li Zefan
-transaction case. The rb-tree is a hybrid extent+bitmap tree, so if we have too many small chunks of inode numbers, we'll use bitmaps. Initially we allow 16K ram of extents, and a bitmap will be used if we exceed this threshold. The extents threshold is adjusted in runtime. Signed-off-by: Li Zefan 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 l...@cn.fujitsu.com --- fs/btrfs/free-space-cache.c | 358

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

2011-04-25 Thread Li Zefan
)-location.objectid != inode-i_ino: the btree inode (0 vs 1) and empty subvol dirs (256 vs 2), and inode-i_ino will be used in those cases. Another reason to make this change is I'm going to use a special inode to save free ino cache, and the inode number must be (u64)-256. Signed-off-by: Li Zefan l

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

2011-04-25 Thread Li Zefan
. To keep compatibility, we check the root generation against the generation of the special inode when loading the cache, so the loading will fail if the btrfs filesystem was mounted in an older kernel before. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ctree.h|7 +++ fs

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

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 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 philipp.andr...@gmail.com --- btrfs_cmds.c | 44 1 files changed,

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-26 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(args, 0,

Re: [PATCH 1/3] fs: remove FS_COW_FL

2011-05-03 Thread Li Zefan
Any comments? If this patch is acceptable, it should be queued for .39? since fs.h is exported to userspace. Li Zefan wrote: FS_COW_FL and FS_NOCOW_FL were newly introduced to control per file COW in btrfs, but FS_NOCOW_FL is sufficient. The fact is we don't have corresponding

Re: Integration branch pushed out to btrfs-unstable

2011-05-24 Thread Li Zefan
Chris Mason wrote: Hi everyone, I've pushed out my current kernel git tree to a new branch called integration-test. This is meant for integration testing only and should not be run by anyone who doesn't love crashes. I've pulled together a lot of important work from a lot of different

Re: [PATCH 1/2] tracing: add __print_symbolic_u64 to avoid warnings on 32bit machine

2011-05-25 Thread Li Zefan
Steven Rostedt wrote: On Wed, 2011-05-25 at 09:12 -0700, Randy Dunlap wrote: But what I sent out previously is not going into 2.6.40 anyway. Ingo feels that it's too late in the merge window to pull those changes and wants to wait till the next merge window. Since there's some fixes in

[PATCH] Btrfs: setup free ino caching in a more asynchronous way

2011-05-25 Thread Li Zefan
to search through the extent tree. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- based on the integration-test branch --- fs/btrfs/inode-map.c | 28 ++-- 1 files changed, 22 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c index

[PATCH] Btrfs: make lzo the default compression scheme

2011-05-25 Thread Li Zefan
As the lzo compression feature has been established for quite a while, we are now ready to replace zlib with lzo as the default compression scheme. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/disk-io.c |2 +- fs/btrfs/ioctl.c |2 +- fs/btrfs/super.c |8 3

[PATCH v2] Btrfs: setup free ino caching in a more asynchronous way

2011-05-26 Thread Li Zefan
to search through the extent tree. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- based on the integration-test branch. v2: fixed an off-by-one bug --- fs/btrfs/inode-map.c | 28 ++-- 1 files changed, 22 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/inode-map.c b/fs

Re: Problem with latest for-linus branch

2011-05-29 Thread Li Zefan
I bisected using kernel version 2.6.39 + latest for-linus branch. Bisect complains about this commit: 581bb050941b4f220f84d3e5ed6dace3d42dd382 is the first bad commit commit 581bb050941b4f220f84d3e5ed6dace3d42dd382 Author: Li Zefan l...@cn.fujitsu.com Date: Wed Apr 20 10:06:11 2011 +0800

[PATCH] Btrfs: use join_transaction in btrfs_evict_inode()

2011-06-07 Thread Li Zefan
Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/inode.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 02ff4a1..4e9aa28 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -3646,7 +3646,7 @@ void btrfs_evict_inode(struct

[PATCH] Btrfs: avoid stack bloat in btrfs_ioctl_fs_info()

2011-06-07 Thread Li Zefan
The size of struct btrfs_ioctl_fs_info_args is as big as 1KB, so don't declare the variable on stack. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 23 ++- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs

Re: [PATCH] Btrfs: avoid stack bloat in btrfs_ioctl_fs_info()

2011-06-08 Thread Li Zefan
-if (copy_to_user(arg, fi_args, sizeof(fi_args))) -return -EFAULT; +if (copy_to_user(arg, fi_args, sizeof(fi_args))) sizeof(*fi_args) will integrate that, thanks :) Oops, what a silly mistake! -- To unsubscribe from this list: send the line unsubscribe linux-btrfs

[PATCH v2] Btrfs: avoid stack bloat in btrfs_ioctl_fs_info()

2011-06-08 Thread Li Zefan
The size of struct btrfs_ioctl_fs_info_args is as big as 1KB, so don't declare the variable on stack. Signed-off-by: Li Zefan l...@cn.fujitsu.com --- v2: fixed to pass the right size to copy_to_user(). --- fs/btrfs/ioctl.c | 23 ++- 1 files changed, 14 insertions(+), 9

Re: [PATCH] Btrfs: use the normal checksumming infrastructure for free space cache

2011-06-12 Thread Li Zefan
Josef Bacik wrote: We used to store the checksums of the space cache directly in the space cache, however that doesn't work out too well if we have more space than we can fit the checksums into the first page. So instead use the normal checksumming infrastructure. There were problems with

Re: [PATCH] Btrfs: use the normal checksumming infrastructure for free space cache

2011-06-12 Thread Li Zefan
Chris Mason wrote: Excerpts from Li Zefan's message of 2011-06-12 21:52:32 -0400: Josef Bacik wrote: We used to store the checksums of the space cache directly in the space cache, however that doesn't work out too well if we have more space than we can fit the checksums into the first

Re: [GIT PULL] Btrfs updates

2011-06-12 Thread Li Zefan
09:02, Andi Kleen wrote: Chris Mason chris.ma...@oracle.com writes: Hi everyone, The for-linus branch of the btrfs unstable tree: git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable.git for-linus Has our current queue of fixes. Josef's is the biggest pile, mostly in

Re: [PATCH] Btrfs: use the normal checksumming infrastructure for free space cache

2011-06-12 Thread Li Zefan
Li Zefan wrote: Chris Mason wrote: Excerpts from Li Zefan's message of 2011-06-12 21:52:32 -0400: Josef Bacik wrote: We used to store the checksums of the space cache directly in the space cache, however that doesn't work out too well if we have more space than we can fit the checksums

Re: [PATCH] Btrfs: use the normal checksumming infrastructure for free space cache

2011-06-12 Thread Li Zefan
Chris Mason wrote: Excerpts from Li Zefan's message of 2011-06-12 21:52:32 -0400: Josef Bacik wrote: We used to store the checksums of the space cache directly in the space cache, however that doesn't work out too well if we have more space than we can fit the checksums into the first

bug caused by removal of trans_mutex? (Was: Re: kernel BUG at fs/btrfs/extent-tree.c:6164!)

2011-06-13 Thread Li Zefan
Cc: Josef I encountered following panic using 'btrfs-unstable + for-linus' kernel. I ran btrfs fi bal /test5 command, and mount option of /test5 is as follows: /dev/sdc3 on /test5 type btrfs (rw,space_cache,compress=lzo,inode_cache) So, just a btrfs fi bal would lead to the bug? I

Re: bug caused by removal of trans_mutex? (Was: Re: kernel BUG at fs/btrfs/extent-tree.c:6164!)

2011-06-13 Thread Li Zefan
! On Mon, Jun 13, 2011 at 3:13 PM, Li Zefan l...@cn.fujitsu.com wrote: Cc: Josef I encountered following panic using 'btrfs-unstable + for-linus' kernel. I ran btrfs fi bal /test5 command, and mount option of /test5 is as follows: /dev/sdc3 on /test5 type btrfs (rw,space_cache,compress=lzo

Re: strange filefrag output on btrfs

2011-06-13 Thread Li Zefan
Andreas Philipp wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 13.06.2011 13:50, David Sterba wrote: On Sat, Jun 11, 2011 at 05:39:15PM +0200, Andreas Philipp wrote: On one of my btrfs volumes I see a strange output from filefrag when run against a particular large (~8GB) file.

  1   2   3   >