Re: 3.18.11 - "no space left on device" and 'fi usage' shows lots

2015-04-20 Thread Filipe David Manana
On Sun, Apr 19, 2015 at 9:15 PM, Joel Best wrote: > Hi all, We have recently had major issues with our large btrfs volume > crashing and remounting read-only because it thinks it's out of space. The > volume is 55TB on h/w raid 6 with 44TB free and the server is running Ubuntu > 14.04 server x64.

Re: The FAQ on fsync/O_SYNC

2015-04-20 Thread Gian-Carlo Pascutto
On 20-04-15 06:27, Zygo Blaxell wrote: >> I'm curious as to whether +C has any effect on BTRFS's durability, too. > > I would expect it to be strictly equal to or worse than the CoW > durability. In addition to the stuff pointed out, I've wondered about this: PostgreSQL full_page_writes copies 8

[PATCH] Btrfs: device delete by devid

2015-04-20 Thread Anand Jain
This introduces BTRFS_IOC_RM_DEV_V2, which can accept devid as an argument to delete the device. Current only choice to is to pass device path for the device delete cli, but if btrfs is unable to read device SB, then cli fails. And user won't be able to delete the device. With this patch now the

[PATCH] device delete by devid

2015-04-20 Thread Anand Jain
Current method to identify and verify the user provided device_path needs device SB to be accessible. In situations where SB isn't accessible or read fails. Using devid will help. Anand Jain (1): Btrfs: device delete by devid fs/btrfs/ioctl.c | 50

[PATCH 2/2] btrfs-progs: device delete to accept devid

2015-04-20 Thread Anand Jain
This patch introduces new option for the command btrfs device delete [..] In a user reported issue on a 3-disk-RAID1, one disk failed with its SB unreadable. Now with this patch user will have a choice to delete the device using devid. The other method we could do, is to match the input dev

[PATCH 1/2] btrfs-progs: move is_numerical to utils-lib.h and make it non static

2015-04-20 Thread Anand Jain
Signed-off-by: Anand Jain --- cmds-replace.c | 11 --- utils-lib.c| 11 +++ utils.h| 1 + 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cmds-replace.c b/cmds-replace.c index 63d34f9..6ea7c61 100644 --- a/cmds-replace.c +++ b/cmds-replace.c @@ -65,17

[PATCH] Btrfs-progs: fix typo in btrfs-device.txt

2015-04-20 Thread Anand Jain
Signed-off-by: Anand Jain --- Documentation/btrfs-device.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/btrfs-device.txt b/Documentation/btrfs-device.txt index 4bb5ea5..0bc1be3 100644 --- a/Documentation/btrfs-device.txt +++ b/Documentation/btrfs-device.txt

Fwd: [PATCH] fs/btrfs: use inode_set_flags() instead of set_mask_bits()

2015-04-20 Thread Zhang Zhen
Use inode_set_flags() instead of set_mask_bits() according to commit 5f16f3225b062 ("ext4: atomically set inode->i_flags in ext4_set_inode_flags()"). Signed-off-by: Zhang Zhen --- fs/btrfs/ioctl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrf

[PATCH] fs/btrfs: use inode_set_flags() instead of set_mask_bits()

2015-04-20 Thread Zhang Zhen
Use inode_set_flags() instead of set_mask_bits() according to commit 5f16f3225b062 ("ext4: atomically set inode->i_flags in ext4_set_inode_flags()"). Signed-off-by: Zhang Zhen --- fs/btrfs/ioctl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrf

Re: [PATCH 3/3] btrfs: set FS_SUPPORTS_SEEK_HOLE flag.

2015-04-20 Thread David Howells
NeilBrown wrote: > + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | > + FS_SUPPORTS_SEEK_HOLE, I must be missing something: warthog>git merge linus/master Already up-to-date. warthog>stg id 09d51602cf84a1264946711dd4ea0dddbac5

Re: [PATCH/RFC] fscache/cachefiles versus btrfs

2015-04-20 Thread David Howells
NeilBrown wrote: > I managed to reproduce the bug, and when I applied your patches I cannot any > more. So it looks like you've fixed it - thanks. I hope so too. Now I just hope Linus takes the patches. > That just leave the bmap issue. I'll post a patch which causes lseek to be > used when

Re: [PATCH 3/3] btrfs: set FS_SUPPORTS_SEEK_HOLE flag.

2015-04-20 Thread NeilBrown
On Mon, 20 Apr 2015 09:47:42 +0100 David Howells wrote: > NeilBrown wrote: > > > + .fs_flags = FS_REQUIRES_DEV | FS_BINARY_MOUNTDATA | > > + FS_SUPPORTS_SEEK_HOLE, > > I must be missing something: > > warthog>git merge linus/master > Already up-to-date.

Re: [PATCH 2/3] fscache/cachefiles: optionally use SEEK_DATA instead of ->bmap.

2015-04-20 Thread Christoph Hellwig
On Mon, Apr 20, 2015 at 04:27:00PM +1000, NeilBrown wrote: > A worthwhile goal, but I certainly wouldn't consider pursuing it until what I > have submitted so far as been accepted - let's not reject "good" while > waiting for "perfect". It's still broken. You add conditional flag for the almost r

Re: [PATCH 3/3] btrfs: set FS_SUPPORTS_SEEK_HOLE flag.

2015-04-20 Thread David Howells
NeilBrown wrote: > Missing patch 2 of the 3-patch series? Yes. :-) Do ext4 and xfs support this, do you know? David -- 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/maj

Re: [PATCH 3/3] btrfs: set FS_SUPPORTS_SEEK_HOLE flag.

2015-04-20 Thread Christoph Hellwig
On Mon, Apr 20, 2015 at 10:46:49AM +0100, David Howells wrote: > NeilBrown wrote: > > > Missing patch 2 of the 3-patch series? > > Yes. :-) > > Do ext4 and xfs support this, do you know? Yes. As do f2fs, ocfs2, gfs2, ceph and NFSv4.2 > > David ---end quoted text--- -- To unsubscribe from th

Re: snapshot destruction making IO extremely slow

2015-04-20 Thread Marc Cousin
On 31/03/2015 19:05, David Sterba wrote: > On Mon, Mar 30, 2015 at 05:09:52PM +0200, Marc Cousin wrote: >>> So it would be good to sample the active threads and see where it's >>> spending the time. It could be the somewhere in the rb-tree representing >>> extents, but that's a guess. >>> >> I just

unable to mount a btrfs file system kernel 3.19.2

2015-04-20 Thread Némoz Saint-Dizier, Olivier
Hello everyone, I have an issue with my ssd where a btrfs partition is located. I have a /dev/sdb1 in ext4 for the /boot, and the rest of the ssd is /dev/sdb2 which is the root of my Archlinux. When I boot, it hangs up after loading the kernel. So I tried with an Archlinux liveboot, and I have the

Re: unable to mount a btrfs file system kernel 3.19.2

2015-04-20 Thread Hugo Mills
On Mon, Apr 20, 2015 at 12:16:33PM +0200, "Némoz Saint-Dizier, Olivier" wrote: > Hello everyone, > > I have an issue with my ssd where a btrfs partition is located. I have a > /dev/sdb1 in ext4 for the /boot, and the rest of the ssd is /dev/sdb2 > which is the root of my Archlinux. When I boot, it

Re: unable to mount a btrfs file system kernel 3.19.2

2015-04-20 Thread Némoz Saint-Dizier, Olivier
Oh, I didn't see there were similar link in the wiki, my bad. Thank you for your prompt answer :) Olivier. On 4/20/2015 12:27 PM, Hugo Mills wrote: > On Mon, Apr 20, 2015 at 12:16:33PM +0200, "Némoz Saint-Dizier, Olivier" wrote: >> Hello everyone, >> >> I have an issue with my ssd where a btrfs p

Re: unable to mount a btrfs file system kernel 3.19.2

2015-04-20 Thread Holger Hoffstätte
On Mon, 20 Apr 2015 12:16:33 +0200, Némoz Saint-Dizier, Olivier wrote: > Hello everyone, > > I have an issue with my ssd where a btrfs partition is located. I have a > /dev/sdb1 in ext4 for the /boot, and the rest of the ssd is /dev/sdb2 > which is the root of my Archlinux. When I boot, it hangs

Re: [PATCH 2/3] fscache/cachefiles: optionally use SEEK_DATA instead of ->bmap.

2015-04-20 Thread David Howells
NeilBrown wrote: > @@ -721,24 +733,45 @@ int cachefiles_read_or_alloc_pages(struct > fscache_retrieval *op, We can actually do better than this what you've done here for cachefiles_read_or_alloc_pages(). We can use SEEK_DATA to check the beginning of a run of pages and then SEEK_HOLE to see ho

Re: [PATCH] Btrfs-progs: fix typo in btrfs-device.txt

2015-04-20 Thread Duncan
Anand Jain posted on Mon, 20 Apr 2015 18:31:29 +0800 as excerpted: > Signed-off-by: Anand Jain > --- > Documentation/btrfs-device.txt | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Documentation/btrfs-device.txt > b/Documentation/btrfs-device.txt index 4bb5ea5..0bc1be3

Re: [PATCH] btrfs-progs: optionally enforce chroot for btrfs receive

2015-04-20 Thread lauri
Hi, the last one added missing goto. I'll try to make clear differences next time :) -- 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

Re: [PATCH 3/3] btrfs: set FS_SUPPORTS_SEEK_HOLE flag.

2015-04-20 Thread Al Viro
On Mon, Apr 20, 2015 at 02:48:55AM -0700, Christoph Hellwig wrote: > On Mon, Apr 20, 2015 at 10:46:49AM +0100, David Howells wrote: > > NeilBrown wrote: > > > > > Missing patch 2 of the 3-patch series? > > > > Yes. :-) > > > > Do ext4 and xfs support this, do you know? > > Yes. As do f2fs, oc

Re: corruption in USB harddrive - backup via send/receive - question

2015-04-20 Thread Sander
Miguel Negrão wrote (ao): > - Given that I'm running a laptop and comunicating with the harddrives via > USB, is it expected that I will get some corruption from time to time or is > this abnormal Abnormal. I have three Intel ssd's usb connected to an Arndale. Two of them have luks and btrfs raid

btrfs send to file differences

2015-04-20 Thread sri
Hi, I have a subvolume with only one file (file.txt) with 5Mb size. under /btrfs/subvol1/ 1) I have created 1st snapshot /btrfs/snap1_subvol1. Then I ran "btrfs send" and given -f out1.img size of out1.img is 5Mb. 2) Next, I have appended 1Mb data to file.txt And again created snapshot /btrfs/

Re: corruption in USB harddrive - backup via send/receive - question

2015-04-20 Thread Miguel Negrão
On 20-04-2015 15:07, Sander wrote: > Miguel Negrão wrote (ao): >> - Given that I'm running a laptop and comunicating with the harddrives via >> USB, is it expected that I will get some corruption from time to time or is >> this abnormal > > Abnormal. I have three Intel ssd's usb connected to an A

Re: btrfs send to file differences

2015-04-20 Thread Hugo Mills
On Mon, Apr 20, 2015 at 02:15:47PM +, sri wrote: > Hi, > > I have a subvolume with only one file (file.txt) with 5Mb size. > under /btrfs/subvol1/ > 1) > I have created 1st snapshot /btrfs/snap1_subvol1. Then I ran "btrfs > send" and given -f out1.img > > size of out1.img is 5Mb. > > 2) > N

Re: [PATCH] btrfs-progs: fix btrfs quota rescan failed on PPC64 arch

2015-04-20 Thread Eric Sandeen
On 4/20/15 12:33 AM, xuw2...@gmail.com wrote: > From: George Wang > > PPC64 arch use such following IOC values " > \#define _IOC_NONE 1U > \#define _IOC_READ 2U > \#define _IOC_WRITE 4U > " comparing to the default IOC values " > \#define _IOC_NONE 0U > \#define _IOC_READ

Is btrfs on top of bcache stable now?

2015-04-20 Thread Marc MERLIN
On Mon, Apr 20, 2015 at 10:27:05AM +, Hugo Mills wrote: >See the first issue here: https://btrfs.wiki.kernel.org/index.php/Gotchas Hi Hugo, looking at the page again, I see "bcache + btrfs does not seem to be stable yet" linking to a thread more than 2 years old and btrfs kernels that wou

Re: The FAQ on fsync/O_SYNC

2015-04-20 Thread Zygo Blaxell
On Mon, Apr 20, 2015 at 10:13:47AM +0200, Gian-Carlo Pascutto wrote: > On 20-04-15 06:27, Zygo Blaxell wrote: > > >> I'm curious as to whether +C has any effect on BTRFS's durability, too. > > > > I would expect it to be strictly equal to or worse than the CoW > > durability. > > In addition to

Re: Is btrfs on top of bcache stable now?

2015-04-20 Thread Fábio Pfeifer
I'm one of those that used to have problems with btrfs on top of bcache. After some corruptions, I gave up this setup. Recently (from February, I think) I gave it another shot, and I have had no problems since. I use bcache in writeback mode, with very good performance. I'm feeling btrfs very stab

[RFC][PATCH] cachefiles: Make better use of SEEK_DATA/SEEK_HOLE

2015-04-20 Thread David Howells
Here's a test patch that makes better use of SEEK_DATA/SEEK_HOLE in cachefiles_read_or_alloc_pages() by caching data/hole information to use on the subsequent pages in the list. Note that the pages list needs to be transited in reverse for this to work as it seems that the list passed to the fs is

Re: how to clone a btrfs filesystem

2015-04-20 Thread Christoph Anton Mitterer
On Mon, 2015-04-20 at 05:23 +, Duncan wrote: > Which, given the common developer wisdom about premature optimization, > can be explained. But accepting that explanation, one is still stymied > by the fact that all the previous warnings about btrfs being in heavy > development, keep good ba

Re: [PATCH 3/3] btrfs: set FS_SUPPORTS_SEEK_HOLE flag.

2015-04-20 Thread Chris Mason
On 04/20/2015 01:27 AM, NeilBrown wrote: > This allows fscache to cachefiles in a btrfs filesystem. Thanks for working on this Neil. Signed-off-by: Chris Mason -chris > > Signed-off-by: NeilBrown > --- > fs/btrfs/super.c |3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff

Re: [PATCH] Btrfs: Improve FL_KEEP_SIZE handling in fallocate.

2015-04-20 Thread Davide Italiano
On Mon, Apr 6, 2015 at 10:09 PM, Davide Italiano wrote: > - We call inode_size_ok() only if FL_KEEP_SIZE isn't specified. > - As an optimisation we can skip the call if (off + len) > isn't greater than the current size of the file. This operation > is called under the lock so the less work we

Kernel BUG at fs/btrfs/ctree.c:3163

2015-04-20 Thread Francis McBratney
Hi folks, Reporting this here too as per the "How do I report bugs and issues?" section on the wiki. I managed to trigger the following BUG_ON() whilst running 'apt purge':- [ 85.635305] kernel BUG at fs/btrfs/ctree.c:3163! [ 85.635350] invalid opcode: [#1] SMP [ 85.635398] Modules li

Carefully crafted BTRFS-image causes kernel to crash

2015-04-20 Thread Lukas Lueg
See also https://bugzilla.kernel.org/show_bug.cgi?id=96971 I've identified some problems in the btrfs code and attached a btrfs-image which causes the userland tools to crash and the kernel to immediately freeze once the filesystem get's mounted and one of the files is accessed. Putting the image

Re: The FAQ on fsync/O_SYNC

2015-04-20 Thread Zygo Blaxell
On Mon, Apr 20, 2015 at 06:07:09AM +, Duncan wrote: > 4.0 is out. There's reason people may want to stick one version back by > default, to 3.19 currently, since it can take a few weeks for early > reports to develop into a coherent problem, and sticking one stable > series back allows for

Re: [PATCH] btrfs-progs: fix btrfs quota rescan failed on PPC64 arch

2015-04-20 Thread 王旭
Thanks for review. On Mon, Apr 20, 2015 at 10:47 PM, Eric Sandeen wrote: > On 4/20/15 12:33 AM, xuw2...@gmail.com wrote: >> From: George Wang >> This means the value "_IOW*" will be negative when we store it in the int >> variables. Such as the "BTRFS_IOC_QGROUP_CREATE", it will be "0x4010942e"

Re: Carefully crafted BTRFS-image causes kernel to crash

2015-04-20 Thread Qu Wenruo
Original Message Subject: Carefully crafted BTRFS-image causes kernel to crash From: Lukas Lueg To: Date: 2015年04月21日 07:04 See also https://bugzilla.kernel.org/show_bug.cgi?id=96971 I've identified some problems in the btrfs code and attached a btrfs-image which causes

[PATCH v2] Btrfs-progs: fix typo in btrfs-device.txt

2015-04-20 Thread Anand Jain
From: Anand Jain Signed-off-by: Anand Jain --- v1->v2: Oh no. Typo while fixing typo. oops ! thanks Duncan. Documentation/btrfs-device.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/btrfs-device.txt b/Documentation/btrfs-device.txt index 4bb5ea5..780

[PATCH v2 1/1] btrfs-progs: optionally restore metadata

2015-04-20 Thread Dan Merillat
As long as the inode is intact, the file metadata can be restored. Directory data is restored at the end of search_dir. Errors are checked and returned, unless ignore_errors is requested. Signed-off-by: Dan Merillat --- Documentation/btrfs-restore.txt | 3 ++ cmds-restore.c |

[PATCH v2 0/1] btrfs-progs: optionally restore metadata

2015-04-20 Thread Dan Merillat
Changes since v1: * Documented in the manpage * Added to usage() for btrfs restore * Made it an optional flag (-m/--restore-metadata) * Use endian-safe macros to access the on-disk data. * Restore the proper mtime instead of atime twice. * Restore owner and mode * Restore metadata for directories

[PATCH 00/18] New extent-oriented qgroup mechanism with minor cleanup

2015-04-20 Thread Qu Wenruo
[BRIEF] This patchset mainly introduces a new qgroup mechanism, which is originally used to fix a bug in fstest/btrfs/057. [WORKFLOW] The new mechanism works like the following: 0) Previous transaction is done. The new mechanism highly depends on commit_transaction. So without commit_transac

[PATCH 01/18] btrfs: backref: Don't merge refs which are not for same block.

2015-04-20 Thread Qu Wenruo
Old __merge_refs() in backref.c will even merge refs whose root_id are different, which makes qgroup gives wrong result. Fix it by checking ref_for_same_block() before any mode specific works. Signed-off-by: Qu Wenruo --- fs/btrfs/backref.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletio

[PATCH 07/18] btrfs: qgroup: Add function qgroup_update_counters().

2015-04-20 Thread Qu Wenruo
Add function qgroup_update_counters(), which will update related qgroups' rfer/excl according to old/new_roots. This is one of the two core functions for the new qgroup implement. This is based on btrfs_adjust_coutners() but with clearer logic and comment. Signed-off-by: Qu Wenruo --- fs/btrfs

[PATCH 17/18] btrfs: qgroup: Add the ability to skip given qgroup for old/new_roots.

2015-04-20 Thread Qu Wenruo
This is used by later qgroup fix patches for snapshot. As current snapshot accounting is done by btrfs_qgroup_inherit(), but new extent oriented quota mechanism will account extent from btrfs_copy_root() and other snapshot things, causing wrong result. So add this ability to handle snapshot accou

[PATCH 04/18] btrfs: qgroup: Cleanup open-coded old/new_refcnt update and read.

2015-04-20 Thread Qu Wenruo
Use inline functions to do such things, to improve readability. Signed-off-by: Qu Wenruo Acked-by: David Sterba --- fs/btrfs/qgroup.c | 95 +++ 1 file changed, 54 insertions(+), 41 deletions(-) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup

[PATCH 03/18] btrfs: delayed-ref: Cleanup the unneeded functions.

2015-04-20 Thread Qu Wenruo
Cleanup the rb_tree merge/insert/update functions, since now we use list instead of rb_tree now. Signed-off-by: Qu Wenruo --- fs/btrfs/delayed-ref.c | 174 - 1 file changed, 174 deletions(-) diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-r

[PATCH 14/18] btrfs: qgroup: Switch self test to extent-oriented qgroup mechanism.

2015-04-20 Thread Qu Wenruo
Since the self test transaction don't have delayed_ref_roots, so use find_all_roots() and export btrfs_qgroup_account_extent() to simulate it Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 2 +- fs/btrfs/qgroup.h | 5 ++ fs/btrfs/tests/qgroup-tests.c | 109 +

[PATCH 16/18] btrfs: ulist: Add ulist_del() function.

2015-04-20 Thread Qu Wenruo
This function will delete unode with given (val,aux) pair. And with this patch, seqnum for debug usage doesn't have any meaning now, so remove them. This is used by later patches to skip snapshot root. Signed-off-by: Qu Wenruo --- fs/btrfs/ulist.c | 47 --

[PATCH 13/18] btrfs: qgroup: Switch to new extent-oriented qgroup mechanism.

2015-04-20 Thread Qu Wenruo
Switch from old ref_node based qgroup to extent based qgroup mechanism for normal operations. The new mechanism should hugely reduce the overhead of btrfs quota system, and further more, the codes and logic should be more clean and easier to maintain. Signed-off-by: Qu Wenruo --- fs/btrfs/exten

[PATCH 11/18] btrfs: qgroup: Add new qgroup calculation function btrfs_qgroup_account_extents().

2015-04-20 Thread Qu Wenruo
The new btrfs_qgroup_account_extents() function should be called in btrfs_commit_transaction() and it will update all the qgroup according to delayed_ref_root->dirty_extent_root. The new function can handle both normal operation during commit_transaction() or in rescan in a unified method with cle

[PATCH 06/18] btrfs: qgroup: Add function qgroup_update_refcnt().

2015-04-20 Thread Qu Wenruo
This function is used to update refcnt for qgroups. And is one of the two core functions used in the new qgroup implement. This is based on the old update_old/new_refcnt, but provides a unified logic and behavior. Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 58 +

[PATCH 09/18] btrfs: qgroup: Add new function to record old_roots.

2015-04-20 Thread Qu Wenruo
Add function btrfs_qgroup_prepare_account_extents() to get old_roots which are needed for qgroup. We do it in commit_transaction() and before switch_roots(), and only search commit_root, so it gives a quite accurate view for previous transaction. With old_roots from previous transaction, we can u

[PATCH 18/18] btrfs: qgroup: Make snapshot accounting work with new extent-oriented qgroup.

2015-04-20 Thread Qu Wenruo
Make snapshot accounting work with new extent-oriented mechanism by skipping given root in new/old_roots in create_pending_snapshot(). Signed-off-by: Qu Wenruo --- fs/btrfs/transaction.c | 53 +++--- 1 file changed, 33 insertions(+), 20 deletions(-) d

[PATCH 15/18] btrfs: qgroup: Cleanup the old ref_node-oriented mechanism.

2015-04-20 Thread Qu Wenruo
Goodbye, the old mechanisim. Signed-off-by: Qu Wenruo --- fs/btrfs/ctree.h | 2 +- fs/btrfs/extent-tree.c | 5 - fs/btrfs/qgroup.c| 905 +-- fs/btrfs/qgroup.h| 49 --- include/trace/events/btrfs.h | 55 --- 5

[PATCH 08/18] btrfs: qgroup: Record possible quota-related extent for qgroup.

2015-04-20 Thread Qu Wenruo
Add hook in add_delayed_ref_head() to record quota-related extent record into delayed_ref_root->dirty_extent_record rb-tree for later qgroup accounting. Signed-off-by: Qu Wenruo --- fs/btrfs/delayed-ref.c | 58 -- fs/btrfs/delayed-ref.h | 3 +++ f

[PATCH 10/18] btrfs: backref: Add special time_seq == (u64)-1 case for btrfs_find_all_roots().

2015-04-20 Thread Qu Wenruo
Allow btrfs_find_all_roots() to skip all delayed_ref_head lock and tree lock to do tree search. This is important for later qgroup implement which will call find_all_roots() after fs trees are committed. Signed-off-by: Qu Wenruo --- fs/btrfs/backref.c | 35 +-- 1

[PATCH 12/18] btrfs: qgroup: Switch rescan to new mechanism.

2015-04-20 Thread Qu Wenruo
Switch rescan to use the new new extent oriented mechanism. As rescan is also based on extent, new mechanism is just a perfect match for rescan. With re-designed internal functions, rescan is quite easy, just call btrfs_find_all_roots() and then btrfs_qgroup_account_one_extent(). Signed-off-by:

[PATCH 05/18] btrfs: extent-tree: Use ref_node to replace unneeded parameters in __inc_extent_ref() and __free_extent()

2015-04-20 Thread Qu Wenruo
__btrfs_inc_extent_ref() and __btrfs_free_extent() have already had too many parameters, but three of them can be extracted from btrfs_delayed_ref_node struct. So use btrfs_delayed_ref_node struct as a single parameter to replace the bytenr/num_byte/no_quota parameters. The real objective of this

[PATCH 02/18] btrfs: delayed-ref: Use list to replace the ref_root in ref_head.

2015-04-20 Thread Qu Wenruo
This patch replace the rbtree used in ref_head to list. This has the following advantage: 1) Easier merge logic. With the new list implement, we only need to care merging the tail ref_node with the new ref_node. And this can be done quite easy at insert time, no need to do a indicated merge at run_