[PATCH V2 07/10] Btrfs: use percpu counter for fs_info-delalloc_bytes

2013-01-29 Thread Miao Xie
ENOSPC error when we still have some free space in the fs. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - modify the changelog and make it more clear and stringency. --- fs/btrfs/ctree.h | 7 --- fs/btrfs/disk-io.c | 18 ++ fs/btrfs/extent-tree.c

[PATCH V2 08/10] Btrfs: use the inode own lock to protect its delalloc_bytes

2013-01-29 Thread Miao Xie
We need not use a global lock to protect the delalloc_bytes of the inode, just use its own lock. In this way, we can reduce the lock contention and -delalloc_lock will just protect delalloc inode list. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - none. --- fs/btrfs

[PATCH V2 09/10] Btrfs: use seqlock to protect fs_info-avail_{data, metadata, system}_alloc_bits

2013-01-29 Thread Miao Xie
There is no lock to protect fs_info-avail_{data, metadata, system}_alloc_bits, it may introduce some problem, such as the wrong profile information, so we add a seqlock to protect them. Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1

[PATCH V2 10/10] Btrfs: use bit operation for -fs_state

2013-01-29 Thread Miao Xie
add other flags, the above problem will happen to a certainty. Now we use bit operation for it to fix the above problem. In this way, we can make the code more robust and be easy to add new flags. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - modify the changelog and make

About Chunk Tree recover

2013-01-29 Thread Miao Xie
Hi, everyone. About 1 years ago, we implemented the chunk tree recover function, but it has not been applied till now because that implementation need change the disk format. (http://marc.info/?l=linux-btrfsm=129914269932543w=2 http://marc.info/?l=linux-btrfsm=130976668006281w=2

[PATCH 1/3] Btrfs: fix wrong sync_writers decrement in btrfs_file_aio_write()

2013-01-28 Thread Miao Xie
If the checks at the beginning of btrfs_file_aio_write() fail, we needn't decrease -sync_writers, because we have not increased it. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/file.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/file.c

[PATCH 2/3] Btrfs: fix missing release of the space/qgroup reservation in start_transaction()

2013-01-28 Thread Miao Xie
When we fail to start a transaction, we need to release the reserved free space and qgroup space, fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c | 27 +++ 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/fs/btrfs

[RFC][PATCH 3/3] Btrfs: introduce btrfs_subvolume_{start, end}_write() for each subvolume

2013-01-28 Thread Miao Xie
, such as mkdir(), we just use the transaction mechanism, when we start a transaction, we will check the subvolume is R/O or not. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 18 +- fs/btrfs/disk-io.c | 36 fs/btrfs

Re: [PATCH] Btrfs: fix ENOSPC in qgroups (metadata)

2013-01-28 Thread Miao Xie
On mon, 28 Jan 2013 13:03:46 +0100, Jan Schmidt wrote: When start_transaction() returns ENOSPC after btrfs_qgroup_reserve(), we must call btrfs_qgroup_free() to avoid the qgroup counters increasing when there's actually no data being written. Signed-off-by: Jan Schmidt

Re: [PATCH] Btrfs/send: sparse and pre-allocated file support for, btrfs-send mechanism

2013-01-24 Thread Miao Xie
On thu, 24 Jan 2013 10:53:17 +0200, Alex Lyakas wrote: Hi Chen, with all due respect, what do you mean by I see and OK for users? The semantics of the fallocate API with/without the FALLOC_FL_PUNCH_HOLE flag is not defined by me or you. As far as I understand, the file system *must* adhere to

Re: [PATCH] Btrfs/send: sparse and pre-allocated file support for, btrfs-send mechanism

2013-01-24 Thread Miao Xie
On thu, 24 Jan 2013 11:58:13 +, Hugo Mills wrote: On Thu, Jan 24, 2013 at 07:39:17PM +0800, Miao Xie wrote: On thu, 24 Jan 2013 10:53:17 +0200, Alex Lyakas wrote: Hi Chen, with all due respect, what do you mean by I see and OK for users? The semantics of the fallocate API

Re: [PATCH 1/5] Btrfs: fix repeated delalloc work allocation

2013-01-24 Thread Miao Xie
On thu, 24 Jan 2013 18:20:06 +0200, Alex Lyakas wrote: - Is there something that user-space can do to avoid flushing the delalloc during snap-commit? For example, if the user-space stops the IO and does a normal commit, this will not call btrfs_start_delalloc_inodes(), but this should ensure

Re: [PATCH 1/5] Btrfs: fix repeated delalloc work allocation

2013-01-23 Thread Miao Xie
On wed, 23 Jan 2013 16:17:53 +0800, Liu Bo wrote: On Wed, Jan 23, 2013 at 02:33:27PM +0800, Miao Xie wrote: On wed, 23 Jan 2013 14:06:21 +0800, Liu Bo wrote: On Wed, Jan 23, 2013 at 12:44:49PM +0800, Miao Xie wrote: No, we can't. The other tasks which flush the delalloc data may remove

Re: [PATCH 1/5] Btrfs: fix repeated delalloc work allocation

2013-01-23 Thread Miao Xie
On Wed, 23 Jan 2013 17:52:14 +0800, Liu Bo wrote: On Wed, Jan 23, 2013 at 04:58:27PM +0800, Miao Xie wrote: On wed, 23 Jan 2013 16:17:53 +0800, Liu Bo wrote: On Wed, Jan 23, 2013 at 02:33:27PM +0800, Miao Xie wrote: On wed, 23 Jan 2013 14:06:21 +0800, Liu Bo wrote: On Wed, Jan 23, 2013 at 12

Re: [PATCH 1/5] Btrfs: fix repeated delalloc work allocation

2013-01-23 Thread Miao Xie
, Jan 23, 2013 at 12:20 PM, Miao Xie mi...@cn.fujitsu.com wrote: On Wed, 23 Jan 2013 17:52:14 +0800, Liu Bo wrote: On Wed, Jan 23, 2013 at 04:58:27PM +0800, Miao Xie wrote: On wed, 23 Jan 2013 16:17:53 +0800, Liu Bo wrote: On Wed, Jan 23, 2013 at 02:33:27PM +0800, Miao Xie wrote: On wed, 23 Jan

Re: btrfs_start_delalloc_inodes livelocks when creating snapshot under IO

2013-01-22 Thread Miao Xie
On mon, 21 Jan 2013 20:37:57 +0200, Alex Lyakas wrote: Greetings all, I see the following issue during snap creation under IO: Transaction commit calls btrfs_start_delalloc_inodes() that locks the delalloc_inodes list, fetches the first inode, unlocks the list, triggers

[PATCH 1/5] Btrfs: fix repeated delalloc work allocation

2013-01-22 Thread Miao Xie
with before, it will fetch the same inode. As a result, this function allocates a huge amount of btrfs_delalloc_work structures, and OOM happens. Fix this problem by splice this delalloc list. Reported-by: Alex Lyakas alex.bt...@zadarastorage.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs

[PATCH 2/5] Btrfs: check the return value of btrfs_start_delalloc_inodes()

2013-01-22 Thread Miao Xie
We forget to check the return value of btrfs_start_delalloc_inodes(), fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/dev-replace.c |6 +- fs/btrfs/transaction.c |4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs

[PATCH 3/5] Btrfs: check the return value of btrfs_run_ordered_operations()

2013-01-22 Thread Miao Xie
We forget to check the return value of btrfs_run_ordered_operations() when flushing all the pending stuffs, fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs

[PATCH 4/5] Btrfs: traverse and flush the delalloc inodes once

2013-01-22 Thread Miao Xie
btrfs_start_delalloc_inodes() needn't traverse and flush the delalloc inodes repeatedly. It is because we can regard the data that the users write after we start delalloc inodes flush as the one which is after the delalloc inodes flush is done, and we can flush it next time. Signed-off-by: Miao

[PATCH 5/5] Btrfs: don't traverse the ordered operation list repeatedly

2013-01-22 Thread Miao Xie
btrfs_run_ordered_operations() needn't traverse the ordered operation list repeatedly, it is because the transaction commiter will invoke it again when there is no other writer in this transaction, it can ensure that no one can add new objects into the ordered operation list. Signed-off-by: Miao

Re: [PATCH 1/5] Btrfs: fix repeated delalloc work allocation

2013-01-22 Thread Miao Xie
On Tue, 22 Jan 2013 22:24:15 +0800, Liu Bo wrote: On Tue, Jan 22, 2013 at 06:49:00PM +0800, Miao Xie wrote: btrfs_start_delalloc_inodes() locks the delalloc_inodes list, fetches the first inode, unlocks the list, triggers btrfs_alloc_delalloc_work/ btrfs_queue_worker for this inode

Re: [PATCH 1/5] Btrfs: fix repeated delalloc work allocation

2013-01-22 Thread Miao Xie
On wed, 23 Jan 2013 11:56:55 +0800, Liu Bo wrote: On Wed, Jan 23, 2013 at 10:54:39AM +0800, Miao Xie wrote: On Tue, 22 Jan 2013 22:24:15 +0800, Liu Bo wrote: On Tue, Jan 22, 2013 at 06:49:00PM +0800, Miao Xie wrote: btrfs_start_delalloc_inodes() locks the delalloc_inodes list, fetches

Re: [PATCH 1/5] Btrfs: fix repeated delalloc work allocation

2013-01-22 Thread Miao Xie
On wed, 23 Jan 2013 14:06:21 +0800, Liu Bo wrote: On Wed, Jan 23, 2013 at 12:44:49PM +0800, Miao Xie wrote: No, we can't. The other tasks which flush the delalloc data may remove the inode from the delalloc list/splice list. If we release the lock, we will meet the race between list

Re: [PATCH V2] mm/slab: add a leak decoder callback

2013-01-15 Thread Miao Xie
On wed, 16 Jan 2013 11:03:13 +0800, Liu Bo wrote: This adds a leak decoder callback so that slab destruction can use to generate debugging output for the allocated objects. Callers like btrfs are using their own leak tracking which will manage allocated objects in a list(or something else),

Re: [PATCH 10/11] Btrfs: use bit operation for -fs_state

2013-01-14 Thread Miao Xie
On tue, 15 Jan 2013 12:03:03 +0800, Liu Bo wrote: On Mon, Jan 14, 2013 at 03:50:31PM +0800, Miao Xie wrote: On thu, 10 Jan 2013 18:57:35 +0100, David Sterba wrote: On Thu, Jan 10, 2013 at 08:51:59PM +0800, Miao Xie wrote: There is no lock to protect fs_info-fs_state, it will introduce some

[PATCH V2 11/11] Btrfs: Add ACCESS_ONCE() to transaction-abort accesses

2013-01-14 Thread Miao Xie
We may access and update transaction-aborted on the different CPUs without lock, so we need ACCESS_ONCE() wrapper to prevent the compiler from creating unsolicited accesses and make sure we can get the right value. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - modify

[PATCH] Btrfs: fix missed transaction-aborted check

2013-01-14 Thread Miao Xie
threads to flush the space cache and inode cache. Those threads also allocate some transaction handles and may set transaction-aborted if some serious error happens. So we need more check for -aborted when committing the transaction. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com

Re: [PATCH 11/11] Btrfs: Add ACCESS_ONCE() to transaction-abort accesses

2013-01-13 Thread Miao Xie
On thu, 10 Jan 2013 18:38:00 +0100, David Sterba wrote: On Thu, Jan 10, 2013 at 08:53:03PM +0800, Miao Xie wrote: We may access and update transaction-abort on the different CPUs without lock, so we need ACCESS_ONCE() wrapper to make sure we can get the new value. ACCESS_ONCE

[PATCH 01/11] Btrfs: use atomic for btrfs_fs_info-generation

2013-01-10 Thread Miao Xie
fs_info-generation is a 64bit variant, we might get a wrong number on the 32bit machines if there is no lock or other methods to protect it. Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.c | 7 --- fs/btrfs/ctree.h

[PATCH 02/11] Btrfs: use atomic for fs_info-last_trans_committed

2013-01-10 Thread Miao Xie
fs_info-last_trans_committed is a 64bits variant, we might get a wrong value on the 32bit machines if we access it directly. Fix it by atomic operation. Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h| 2 +- fs/btrfs/disk

[PATCH 03/11] Btrfs: use atomic for fs_info-last_trans_log_full_commit

2013-01-10 Thread Miao Xie
fs_info-last_trans_log_full_commit is a 64bits variant, we might get a wrong value on the 32bit machines if we access it directly. Fix it by atomic operation. Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 2 +- fs/btrfs

[PATCH 04/11] Btrfs: add a comment for fs_info-max_inline

2013-01-10 Thread Miao Xie
We need not add anything to protect fs_info-max_inline, but we need a comment to explain why we don't add a lock to protect it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index

[PATCH 05/11] Btrfs: protect fs_info-alloc_start

2013-01-10 Thread Miao Xie
of them. Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 10 ++ fs/btrfs/super.c | 4 2 files changed, 14 insertions(+) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 3e672916..201be7d 100644 --- a/fs/btrfs

[PATCH 06/11] Btrfs: use percpu counter for dirty metadata count

2013-01-10 Thread Miao Xie
-dirty_metadata_bytes is accessed very frequently, so use percpu counter instead of the u64 variant to reduce the contention of the lock. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 9 fs/btrfs/disk-io.c | 64

[PATCH 07/11] Btrfs: use percpu counter for fs_info-delalloc_bytes

2013-01-10 Thread Miao Xie
fs_info-delalloc_bytes is accessed very frequently, so use percpu counter instead of the u64 variant for it to reduce the lock contention. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 7 --- fs/btrfs/disk-io.c | 18 ++ fs/btrfs/extent-tree.c

[PATCH 08/11] Btrfs: use the inode own lock to protect its delalloc_bytes

2013-01-10 Thread Miao Xie
We need not use a global lock to protect the delalloc_bytes of the inode, just use its own lock. In this way, we can reduce the lock contention and -delalloc_lock will just protect delalloc inode list. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/btrfs_inode.h | 1 + fs/btrfs/disk

[PATCH 09/11] Btrfs: use seqlock to protect fs_info-avail_{data, metadata, system}_alloc_bits

2013-01-10 Thread Miao Xie
There is no lock to protect fs_info-avail_{data, metadata, system}_alloc_bits, it may introduce some problem, such as the wrong profile information, so we add a seqlock to protect them. Signed-off-by: Zhao Lei zhao...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs

[PATCH 10/11] Btrfs: use bit operation for -fs_state

2013-01-10 Thread Miao Xie
There is no lock to protect fs_info-fs_state, it will introduce some problems, such as the value may be covered by the other task when several tasks modify it. Now we use bit operation for it to fix the above problem. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 4

[PATCH 11/11] Btrfs: Add ACCESS_ONCE() to transaction-abort accesses

2013-01-10 Thread Miao Xie
We may access and update transaction-abort on the different CPUs without lock, so we need ACCESS_ONCE() wrapper to make sure we can get the new value. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/super.c | 2 +- fs/btrfs/transaction.c | 9 - 2 files changed, 5

Re: About btrfs qgroup import/export command

2013-01-09 Thread Miao Xie
Hi, Arne On Wed, 19 Dec 2012 12:40:25 +0100, Arne Jansen wrote: On 19.12.2012 12:25, Miao Xie wrote: As we know, there is no backup function for qgroup. when the problem occurs, the users must recover qgroup configuration manually, it is not convenient. And besides that, some users might want

Re: [PATCH RESEND] vfs: re-implement writeback_inodes_sb(_nr)_if_idle() and rename them

2013-01-09 Thread Miao Xie
On Fri, 28 Dec 2012 15:33:38 +0100, David Sterba wrote: On Thu, Dec 20, 2012 at 06:09:35PM +0800, Miao Xie wrote: --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1314,7 +1314,6 @@ void writeback_inodes_sb_nr(struct super_block *sb, bdi_queue_work(sb-s_bdi, work

[PATCH V3] Btrfs: flush all dirty inodes if writeback can not start

2013-01-09 Thread Miao Xie
from r/w to r/o. because the filesystem should guarantee all the dirty pages have been written into the disk after it becomes readonly, so the sync operation will do nothing if the filesystem is already readonly. Though it may waste lots of time, as a corner case, we needn't care. Signed-off-by: Miao

[PATCH V2] vfs: re-implement writeback_inodes_sb(_nr)_if_idle() and rename them

2013-01-09 Thread Miao Xie
writeback_inodes_sb(_nr)_if_idle(). The name of these two functions is cumbersome, so rename them to try_to_writeback_inodes_sb(_nr). This idea came from Christoph Hellwig. Some code is from the patch of Kamal Mostafa. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- Changelog v1 - v2: - do not remove

[PATCH V2] Btrfs: flush all dirty inodes if writeback can not start

2012-12-24 Thread Miao Xie
from r/w to r/o. because the filesystem should guarantee all the dirty pages have been written into the disk after it becomes readonly, so the sync operation will do nothing if the filesystem is already readonly. Though it may waste lots of time, as a corner case, we needn't care. Signed-off-by: Miao

[PATCH 2/3] Btrfs: use wrapper page_offset

2012-12-21 Thread Miao Xie
Use wrapper page_offset to get byte-offset into filesystem object for page. Signed-off-by: Liu Bo liubo2...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/disk-io.c| 2 +- fs/btrfs/extent_io.c | 24 +++- fs/btrfs/inode.c | 5 ++--- fs

[PATCH 1/3] Btrfs: fix missing write access release in btrfs_ioctl_resize()

2012-12-21 Thread Miao Xie
We forget to give up the write access after we find some device operation is going on. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7624212..679b82c

[PATCH 2/3] Btrfs: fix resize a readonly device

2012-12-21 Thread Miao Xie
We should not resize a readonly device, fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 679b82c..668475c 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs

[PATCH 3/3] Btrfs: fix trivial error in btrfs_ioctl_resize()

2012-12-21 Thread Miao Xie
This patch fixes the following problem: - improper return value - unnecessary read-only check Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 668475c

Re: [PATCH 1/3] Btrfs: fix missing write access release in btrfs_ioctl_resize()

2012-12-21 Thread Miao Xie
On Fri, 21 Dec 2012 11:22:52 +0100, Stefan Behrens wrote: On Fri, 21 Dec 2012 17:19:20 +0800, Miao Xie wrote: -pr_info(btrfs: dev add/delete/balance/replace/resize operation in progress\n); +pr_info(btrfs: dev add/delete/balance/replace/resize operation

[PATCH RESEND 1/3] Btrfs: flush all dirty inodes if writeback can not start

2012-12-20 Thread Miao Xie
From: Miao Xie mi...@cn.fujitsu.com We may try to flush some dirty pages when there is no enough space to reserve. But it is possible that this operation fails, in order to get enough space to reserve successfully, we will sync all the delalloc file. This operation is safe, we needn't worry about

[PATCH] Btrfs: make delayed ref lock logic more readable

2012-12-19 Thread Miao Xie
Locking and unlocking delayed ref mutex are in the different functions, and the name of lock functions is not uniform, so the readability is not so good, this patch optimizes the lock logic and makes it more readable. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/delayed-ref.c | 8

About btrfs qgroup import/export command

2012-12-19 Thread Miao Xie
Hi, everyone. As we know, there is no backup function for qgroup. when the problem occurs, the users must recover qgroup configuration manually, it is not convenient. And besides that, some users might want to import an existed qgroup configuration into a new filesystem. Btrfs does not have such

Re: [PATCH] Btrfs: don't bother updating the inode when evicting

2012-12-19 Thread Miao Xie
On wed, 19 Dec 2012 10:02:59 -0500, Josef Bacik wrote: On Tue, Dec 18, 2012 at 06:58:33PM -0700, Miao Xie wrote: On tue, 18 Dec 2012 15:51:57 -0500, Josef Bacik wrote: We're deleting the stupid thing, no sense in updating the inode for the new size. We're running into having 50-100

Re: About btrfs qgroup import/export command

2012-12-19 Thread Miao Xie
On Wed, 19 Dec 2012 12:40:25 +0100, Arne Jansen wrote: On 19.12.2012 12:25, Miao Xie wrote: Hi, everyone. As we know, there is no backup function for qgroup. when the problem occurs, the users must recover qgroup configuration manually, it is not convenient. And besides that, some users

Re: [PATCH] [RFC v2] Btrfs: Subpagesize blocksize (WIP).

2012-12-18 Thread Miao Xie
On tue, 18 Dec 2012 15:30:51 +0800, Liu Bo wrote: On Mon, Dec 17, 2012 at 11:13:25PM -0800, cli...@linux.vnet.ibm.com wrote: From: Wade Cline cli...@linux.vnet.ibm.com v1 - v2: - Added Signed-off-by tag (it's kind of important). This patch is only an RFC. My internship is ending and I was

[PATCH 1/2] Btrfs: cleanup similar code in delayed inode

2012-12-18 Thread Miao Xie
The delayed item commit code in several functions is similar, so cleanup it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/delayed-inode.c | 83 +--- 1 file changed, 37 insertions(+), 46 deletions(-) diff --git a/fs/btrfs/delayed-inode.c b

[PATCH 2/2] Btrfs: fix lots of orphan inodes when the space is not enough

2012-12-18 Thread Miao Xie
-by: Josef Bacik jba...@fusionio.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/delayed-inode.c | 90 +--- fs/btrfs/delayed-inode.h | 1 + fs/btrfs/inode.c | 11 +++--- 3 files changed, 85 insertions(+), 17 deletions(-) diff --git

Re: [RFC PATCH V5 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-17 Thread Miao Xie
On mon, 17 Dec 2012 19:22:11 +0800, Jeff Liu wrote: Introduce a new ioctl BTRFS_IOC_SET_FSLABEL to change the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs

Re: [RFC PATCH V5 1/2] Btrfs: Add a new ioctl to get the label of a mounted filesystem

2012-12-17 Thread Miao Xie
On mon, 17 Dec 2012 19:22:02 +0800, Jeff Liu wrote: Introduce a new ioctl BTRFS_IOC_GET_FSLABEL to fetch the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com Reviewed-by: Miao

Re: [RFC PATCH V5 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-17 Thread Miao Xie
On mon, 17 Dec 2012 18:34:41 +0100, Goffredo Baroncelli wrote: On 12/17/2012 02:30 PM, Jeff Liu wrote: On 12/17/2012 07:57 PM, Miao Xie wrote: On mon, 17 Dec 2012 19:22:11 +0800, Jeff Liu wrote: Introduce a new ioctl BTRFS_IOC_SET_FSLABEL to change the label of a mounted file system

Re: [RFC PATCH V6 2/2] Btrfs: Add a new ioctl to change the label of a mounted file system

2012-12-17 Thread Miao Xie
On Tue, 18 Dec 2012 11:06:07 +0800, Jeff Liu wrote: Introduce a new ioctl BTRFS_IOC_SET_FSLABEL to change the label of a mounted file system. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com Cc: Miao Xie mi...@cn.fujitsu.com Cc: Goffredo

Re: [PATCH 5/5] Btrfs: fix remount vs autodefrag

2012-12-16 Thread Miao Xie
On fri, 14 Dec 2012 12:51:06 -0500, Josef Bacik wrote: On Mon, Nov 26, 2012 at 02:28:13AM -0700, Miao Xie wrote: If we remount the fs to close the auto defragment or make the fs R/O, we should stop the auto defragment. Signed-off-by: Miao Xie mi...@cn.fujitsu.com I'm dropping

Re: Kernel 3.7 + slower snapshot then usual

2012-12-13 Thread Miao Xie
On wed, 12 Dec 2012 23:26:02 -0500, Sylvain Alain wrote: Hi guys, I noticed that now my snapshot take a long time to process : sylvain@gentootux ~ $ df -h Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur rootfs 112G4,0G 103G 4% / /dev/sda4 112G4,0G 103G

Re: [RFC PATCH 9/9] Btrfs: get write access for adding device

2012-12-11 Thread Miao Xie
Any comment about this patch? On mon, 26 Nov 2012 16:51:36 +0800, Miao Xie wrote: Without this patch, we can add a device into the R/O fs. Steps to reproduce: # mkfs.btrfs -d single -m single disk0 disk1 # mount -o ro disk0 mnt0 # mount -o ro disk0 mnt1 # mount -o remount,rw mnt0

Re: [PATCH V4 2/2] Btrfs: Add a new ioctl to change the label of a mounted filesystem

2012-12-11 Thread Miao Xie
Hi, Liu On wed, 12 Dec 2012 08:22:28 +0800, Jeff Liu wrote: Add a new ioctl BTRFS_FS_SETLABEL to change the label of a mounted filesystem. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- fs/btrfs/ioctl.c | 14 ++

Re: [RESEND PATCH V4 1/2] Btrfs: Add a new ioctl to get the label of a mounted filesystem

2012-12-11 Thread Miao Xie
On Wed, 12 Dec 2012 11:22:49 +0800, Jeff Liu wrote: Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- fs/btrfs/ioctl.c | 14 ++ fs/btrfs/ioctl.h |2 ++ 2 files changed, 16 insertions(+) diff --git a/fs/btrfs/ioctl.c

Re: [RESEND PATCH V4 2/2] Btrfs: Add a new ioctl to change the label of a mounted filesystem

2012-12-11 Thread Miao Xie
On wed, 12 Dec 2012 11:23:00 +0800, Jeff Liu wrote: Add a new ioctl BTRFS_FS_SETLABEL to change the label of a mounted filesystem. Signed-off-by: Jie Liu jeff@oracle.com Signed-off-by: Anand Jain anand.j...@oracle.com --- fs/btrfs/ioctl.c | 34 ++

[PATCH 0/9] enhance btrfs qgroup show command

2012-12-06 Thread Miao Xie
The patchset enhanced btrfs qgroup show command. Firstly, we restructure show_qgroups, make it easy to add new features. And then we add '-p' '-c', '-l',and '-e' options to print the parent qgroup id, child qgroup id, max referenced size and max exclusive size of qgroup respectively, add '-F'

[PATCH 1/9] Btrfs-progs: restructure show_qgroups

2012-12-06 Thread Miao Xie
...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- cmds-qgroup.c | 96 +-- ctree.h | 11 ++ qgroup.c | 509 ++ qgroup.h | 9 ++ 4 files changed, 530 insertions(+), 95 deletions(-) diff --git a/cmds

[PATCH 4/9] Btrfs-progs: introduce '-l' option to print max referenced size of qgroups

2012-12-06 Thread Miao Xie
From: Wang Shilong wangsl-f...@cn.fujitsu.com This patch introduces '-l' option to print max referenced size of qgroups. You may use it like: btrfs qgroup show -l path Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- cmds

[PATCH 5/9] Btrfs-progs: introduce '-e' option to print max exclusive size of qgroups

2012-12-06 Thread Miao Xie
From: Wang Shilong wangsl-f...@cn.fujitsu.com This patch introduce '-e' option to print max exclusive size of qgroups. You may use it like this: btrfs qgroup -e path Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- cmds

[PATCH 3/9] Btrfs-progs: introduces '-c' option to print the ID of the child qgroups

2012-12-06 Thread Miao Xie
-- -- 1/0,1/1 Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- cmds-qgroup.c | 9 +++-- qgroup.c | 22 ++ qgroup.h | 1 + 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/cmds-qgroup.c b/cmds

[PATCH 6/9] Btrfs-progs: list all qgroups impact given path(include ancestral qgroups)

2012-12-06 Thread Miao Xie
-by: Wang shilong wangsl-f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- cmds-qgroup.c | 25 -- qgroup.c | 239 +- qgroup.h | 27 ++- 3 files changed, 281 insertions(+), 10 deletions(-) diff --git a/cmds

[PATCH 7/9] Btrfs-progs: list all qgroups impact given path(exclude ancestral qgroups)

2012-12-06 Thread Miao Xie
-by: Miao Xie mi...@cn.fujitsu.com --- cmds-qgroup.c | 14 -- qgroup.c | 16 +++- qgroup.h | 1 + 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/cmds-qgroup.c b/cmds-qgroup.c index b6cdb53..9447179 100644 --- a/cmds-qgroup.c +++ b/cmds-qgroup.c

[PATCH 8/9] Btrfs-progs: enhance btrfs qgroup show to sort qgroups

2012-12-06 Thread Miao Xie
to combine sort items, you do it like that: btrfs qgroup show --sort=-qgroupid,+rfer,max_rfer,excl path Signed-off-by: Wang Shilong wangsl-f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- cmds-qgroup.c | 26 +- qgroup.c | 254

[PATCH 9/9] Btrfs-progs: enhance btrfs qgroup to print the result as a table

2012-12-06 Thread Miao Xie
1289752576 0 --- 1/0 0 0 10999511627776 2/0,3/0 2/0 0 0 0 --- 3/0 0 0 0 --- Signed-off-by: Wang shilong wangsl-f...@cn.fujitsu.com Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- cmds

[PATCH 1/6] Btrfs: don't auto defrag a file when doing directIO

2012-12-05 Thread Miao Xie
If we runt the direct IO, we should not run auto defrag, because it may introduce buffered IO vs direcIO problem, and make direct IO slow down. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs

[PATCH 2/6] Btrfs: fix missing reserved space release in error path of delalloc reservation

2012-12-05 Thread Miao Xie
We forget to release the reserved space in the error path of delalloc reservatiom, fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/extent-tree.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3d3e2c1..1cd71b2

[PATCH 4/6] Btrfs: fix the page that is beyond EOF

2012-12-05 Thread Miao Xie
reserved the space twice. In fact, we needn't truncate the page if it is beyond the end of the file, just release the allocated space in that range. Fix the above problem by this way. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/file.c | 16 +--- 1 file changed, 9 insertions

[PATCH 5/6] Btrfs: punch hole past the end of the file

2012-12-05 Thread Miao Xie
command changes the file size, we must run several commands to reclaim the space if we don't want to change the file size, so it is not a good choice. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/file.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff

[PATCH 6/6] Btrfs: fix wrong return value of btrfs_truncate_page()

2012-12-05 Thread Miao Xie
ret variant may be set to 0 if we read page successfully, but it might be released before we lock it again. On this case, if we fail to allocate a new page, we will return 0, it is wrong, fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/inode.c | 3 +-- 1 file changed, 1

Re: [PATCH v3] Btrfs: add label to snapshot and subvol

2012-11-28 Thread Miao Xie
On wed, 28 Nov 2012 18:02:56 +0800, Anand Jain wrote: On 11/28/2012 11:05 AM, Miao Xie wrote: On wed, 28 Nov 2012 02:29:17 +0800, Anand jain wrote: /* @@ -2441,6 +2443,14 @@ static inline bool btrfs_root_readonly(struct btrfs_root *root) { return (root-root_item.flags

[PATCH 1/2] Btrfs: use existing align macros in btrfs_allocate()

2012-11-28 Thread Miao Xie
The kernel developers have implemented some often-used align macros, we should use them instead of the complex code. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/file.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c

[PATCH 2/2] Btrfs: fix off-by-one error of the reserved size of btrfs_allocate()

2012-11-28 Thread Miao Xie
alloc_end is not the real end of the current extent, it is the start of the next adjoining extent. So we needn't +1 when calculating the size the space that is about to be reserved. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2

Re: [PATCH v3] Btrfs: add label to snapshot and subvol

2012-11-27 Thread Miao Xie
On wed, 28 Nov 2012 02:29:17 +0800, Anand jain wrote: /* @@ -2441,6 +2443,14 @@ static inline bool btrfs_root_readonly(struct btrfs_root *root) { return (root-root_item.flags cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0; } +static inline char * btrfs_root_label(struct

[PATCH 0/9] random fix for btrfs_ioctl()

2012-11-26 Thread Miao Xie
it RFC. We can pull this patchset from the URL git://github.com/miaoxie/linux-btrfs.git readonly Thanks Miao --- Miao Xie (9): Btrfs: pass root object into btrfs_ioctl_{start, wait}_sync() Btrfs: don't start a new transaction when starting sync Btrfs: fix wrong return value

[PATCH 1/9] Btrfs: pass root object into btrfs_ioctl_{start, wait}_sync()

2012-11-26 Thread Miao Xie
Since we have gotten the root in the caller, just pass it into btrfs_ioctl_{start, wait}_sync() directly. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index

[PATCH 2/9] Btrfs: don't start a new transaction when starting sync

2012-11-26 Thread Miao Xie
If there is no running transaction in the fs, we needn't start a new one when we want to start sync. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 14 ++ fs/btrfs/transaction.c | 13 - 2 files changed, 18 insertions(+), 9 deletions(-) diff

[PATCH 3/9] Btrfs: fix wrong return value of btrfs_wait_for_commit()

2012-11-26 Thread Miao Xie
If the id of the existed transaction is more than the one we specified, it means the specified transaction was commited, so we should return 0, not EINVAL. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/transaction.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions

[PATCH 4/9] Btrfs: get write access when setting the default subvolume

2012-11-26 Thread Miao Xie
When wen want to set the default subvolume, we must get write access, or we will change the R/O file system. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 40 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/fs/btrfs

[PATCH 5/9] Btrfs: get write access when doing resize fs

2012-11-26 Thread Miao Xie
, because the kernel may set the R/O flag only for the mount point. We need invoke mnt_want_write_file() to do a full check. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs

[PATCH 6/9] Btrfs: get write access when removing a device

2012-11-26 Thread Miao Xie
of the super block object. It is not enough, because the kernel may set the R/O flag only for the mount point. We need invoke mnt_want_write_file() to do a full check. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions

[PATCH 7/9] Btrfs: get write access for scrub

2012-11-26 Thread Miao Xie
We need get write access for scrub, or we will modify the R/O fs. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 5921bb9..a7afafa 100644 --- a/fs

[PATCH 8/9] Btrfs: get write access for qgroup operations

2012-11-26 Thread Miao Xie
We need get write access for qgroup operations, or we will modify the R/O fs. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 73 +--- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs

[RFC PATCH 9/9] Btrfs: get write access for adding device

2012-11-26 Thread Miao Xie
is based on a seed filesystem immediately after it is created, needn't do remount/umount-mount. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ioctl.c | 81 ++ fs/btrfs/super.c | 5 ++-- fs/btrfs/volumes.c | 26

[PATCH 1/5] Btrfs: use slabs for auto defrag allocation

2012-11-26 Thread Miao Xie
The auto defrag allocation is in the fast path of the IO, so use slabs to improve the speed of the allocation. And besides that, it can do check for leaked objects when the module is removed. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 2 ++ fs/btrfs/file.c | 28

[PATCH 2/5] Btrfs: fix unprotected defragable inode insertion

2012-11-26 Thread Miao Xie
We forget to get the defrag lock when we re-add the defragable inode, Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/file.c | 70 - 1 file changed, 55 insertions(+), 15 deletions(-) diff --git a/fs/btrfs/file.c b/fs

[PATCH 3/5] Btrfs: restructure btrfs_run_defrag_inodes()

2012-11-26 Thread Miao Xie
This patch restructure btrfs_run_defrag_inodes() and make the code of the auto defragment more readable. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/ctree.h | 1 + fs/btrfs/disk-io.c | 2 +- fs/btrfs/file.c| 197 + 3

[PATCH 4/5] Btrfs: fix freeze vs auto defrag

2012-11-26 Thread Miao Xie
If we freeze the fs, the auto defragment should not run. Fix it. Signed-off-by: Miao Xie mi...@cn.fujitsu.com --- fs/btrfs/file.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 6ca2b46..40b17d0 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c

<    1   2   3   4   5   6   7   8   9   10   >