[PATCH 15/19] btrfs: fallocate: Add support to accurate qgroup reserve

2015-09-08 Thread Qu Wenruo
Now fallocate will do accurate qgroup reserve space check, unlike old method, which will always reserve the whole length of the range. With this patch, fallocate will: 1) Iterate the desired range and mark in data rsv map Only range which is going to be allocated will be recorded in data rsv

[PATCH 19/19] btrfs: qgroup: Add handler for NOCOW and inline

2015-09-08 Thread Qu Wenruo
For NOCOW and inline case, there will be no delayed_ref created for them, so we should free their reserved data space at proper time(finish_ordered_io for NOCOW and cow_file_inline for inline). Signed-off-by: Qu Wenruo --- fs/btrfs/extent-tree.c | 7 ++- fs/btrfs/inode.c | 15

[PATCH 03/19] btrfs: qgroup: Introduce new function to search most left reserve range

2015-09-08 Thread Qu Wenruo
Introduce the new function to search the most left reserve range in a reserve map. It provides the basis for later reserve map implement. Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 36 1 file changed, 36 insertions(+) diff --git a/fs/btrfs/qgroup.c b/

[PATCH 08/19] btrfs: qgroup: Introduce function to release/free reserved data range

2015-09-08 Thread Qu Wenruo
Introduce functions btrfs_qgroup_release/free_data() to release/free reserved data range. Release means, just remove the data range from data rsv map, but doesn't free the reserved space. This is for normal buffered write case, when data is written into disc and its metadata is added into tree, it

[PATCH 01/19] btrfs: qgroup: New function declaration for new reserve implement

2015-09-08 Thread Qu Wenruo
Add new structures and functions for new qgroup reserve implement dirty phase. Which will focus on avoiding over-reserve as in that case, which means for already reserved dirty space range, we won't reserve space again. This patch adds the needed structure declaration and comments. Signed-off-by:

[PATCH 06/19] btrfs: qgroup: Introduce btrfs_qgroup_reserve_data function

2015-09-08 Thread Qu Wenruo
This new function will do all the hard work to reserve precious space for a write. The overall work flow will be the following. File A already has some dirty pages: 0 4K 8K 12K 16K |///| |///| And then, someone want to write some data into range [4K, 16K).

[PATCH 09/19] btrfs: delayed_ref: Add new function to record reserved space into delayed ref

2015-09-08 Thread Qu Wenruo
Add new function btrfs_add_delayed_qgroup_reserve() function to record how much space is reserved for that extent. As btrfs only accounts qgroup at run_delayed_refs() time, so newly allocated extent should keep the reserved space until then. So add needed function with related members to do it.

[PATCH 02/19] btrfs: qgroup: Implement data_rsv_map init/free functions

2015-09-08 Thread Qu Wenruo
New functions btrfs_qgroup_init/free_data_rsv_map() to init/free data reserve map. Data reserve map is used to mark which range already holds reserved space, to avoid current reserved space leak. Signed-off-by: Qu Wenruo --- fs/btrfs/btrfs_inode.h | 2 ++ fs/btrfs/inode.c | 10 +++ f

[PATCH 18/19] btrfs: qgroup: Cleanup old inaccurate facilities

2015-09-08 Thread Qu Wenruo
Cleanup the old facilities which use old btrfs_qgroup_reserve() function call, replace them with the newer version, and remove the "__" prefix in them. Also, make btrfs_qgroup_reserve/free() functions private, as they are now only used inside qgroup codes. Now, the whole btrfs qgroup is swithed t

[PATCH 05/19] btrfs: qgroup: Introduce function to reserve data range per inode

2015-09-08 Thread Qu Wenruo
Introduce new function reserve_data_range(). This function will find non-overlap range and to insert it into reserve map using previously introduced functions. This provides the basis for later per inode reserve map implement. Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 92

[PATCH 04/19] btrfs: qgroup: Introduce function to insert non-overlap reserve range

2015-09-08 Thread Qu Wenruo
New function insert_data_ranges() will insert non-overlap reserve ranges into reserve map. It provides the basis for later qgroup reserve map implement. Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 124 ++ 1 file changed, 124 insertions(+)

[PATCH 10/19] btrfs: delayed_ref: release and free qgroup reserved at proper timing

2015-09-08 Thread Qu Wenruo
Qgroup reserved space needs to be released from inode dirty map and get freed at different timing: 1) Release when the metadata is written into tree After corresponding metadata is written into tree, any newer write will be COWed(don't include NOCOW case yet). So we must release its range from ino

[PATCH 07/19] btrfs: qgroup: Introduce function to release reserved range

2015-09-08 Thread Qu Wenruo
Introduce new function release_data_range() to release reserved ranges. It will iterate through all existing ranges and remove/shrink them. Note this function will not free reserved space, as the range can be released in the following conditions: 1) The dirty range gets written to disk. In this

[PATCH 12/19] btrfs: qgroup: Use new metadata reservation.

2015-09-08 Thread Qu Wenruo
As we have the new metadata reservation functions, use them to replace the old btrfs_qgroup_reserve() call for metadata. Signed-off-by: Qu Wenruo --- fs/btrfs/extent-tree.c | 14 ++ fs/btrfs/transaction.c | 34 ++ fs/btrfs/transaction.h | 1 - 3 files

[PATCH 11/19] btrfs: qgroup: Introduce new functions to reserve/free metadata

2015-09-08 Thread Qu Wenruo
Introduce new functions btrfs_qgroup_reserve/free_meta() to reserve/free metadata reserved space. Signed-off-by: Qu Wenruo --- fs/btrfs/ctree.h | 3 +++ fs/btrfs/disk-io.c | 1 + fs/btrfs/qgroup.c | 40 fs/btrfs/qgroup.h | 4 4 files changed,

[PATCH 13/19] btrfs: extent-tree: Add new verions of btrfs_check_data_free_space

2015-09-08 Thread Qu Wenruo
Add new function __btrfs_check_data_free_space() to do precious space reservation. The new function will replace old btrfs_check_data_free_space(), but until all the change is done, let's just use the new name. Also, export internal use function btrfs_alloc_data_chunk_ondemand(), as now qgroup re

[PATCH 14/19] btrfs: Switch to new check_data_free_space

2015-09-08 Thread Qu Wenruo
Use new check_data_free_space for buffered write and inode cache. For buffered write case, as nodatacow write won't increase quota account, so unlike old behavior which does reserve before check nocow, now we check nocow first and then only reserve data if we can't do nocow write. Signed-off-by:

[PATCH 16/19] btrfs: extent-tree: Add new version of btrfs_delalloc_reserve_space

2015-09-08 Thread Qu Wenruo
Add new version of btrfs_delalloc_reserve_space() function, which supports accurate qgroup reserve. Signed-off-by: Qu Wenruo --- fs/btrfs/ctree.h | 1 + fs/btrfs/extent-tree.c | 38 ++ 2 files changed, 39 insertions(+) diff --git a/fs/btrfs/ctree.h b/f

[PATCH 17/19] btrfs: extent-tree: Use new __btrfs_delalloc_reserve_space function

2015-09-08 Thread Qu Wenruo
Use new __btrfs_delalloc_reserve_space to reserve space. Signed-off-by: Qu Wenruo --- fs/btrfs/inode-map.c | 2 +- fs/btrfs/inode.c | 16 ++-- fs/btrfs/ioctl.c | 5 +++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-m

[PATCH RFC 00/14] Accurate qgroup reserve framework

2015-09-08 Thread Qu Wenruo
[[BUG]] One of the most common case to trigger the bug is the following method: 1) Enable quota 2) Limit excl of qgroup 5 to 16M 3) Write [0,2M) of a file inside subvol 5 10 times without sync EQUOT will be triggered at about the 8th write. [[CAUSE]] The problem is caused by the fact that qgroup

Re: Btrfs progs release 4.1

2015-09-08 Thread Qu Wenruo
Qu Wenruo wrote on 2015/09/09 09:34 +0800: Hi David, Sorry for the late reply, but I noticed something interesting. David Sterba wrote on 2015/06/22 17:00 +0200: Hi, btrfs-progs 4.1 have been released (in time with kernel 4.1). Unusual load of changes. Fixed since rc1: - uuid rewrite pr

Re: [PATCH 18/19] btrfs: qgroup: Cleanup old inaccurate facilities

2015-09-08 Thread Tsutomu Itoh
Hi, Qu, On 2015/09/08 18:25, Qu Wenruo wrote: > Cleanup the old facilities which use old btrfs_qgroup_reserve() function > call, replace them with the newer version, and remove the "__" prefix in > them. > > Also, make btrfs_qgroup_reserve/free() functions private, as they are > now only used ins

Re: [PATCH 15/19] btrfs: fallocate: Add support to accurate qgroup reserve

2015-09-08 Thread Tsutomu Itoh
Hi, Qu, On 2015/09/08 18:22, Qu Wenruo wrote: > Now fallocate will do accurate qgroup reserve space check, unlike old > method, which will always reserve the whole length of the range. > > With this patch, fallocate will: > 1) Iterate the desired range and mark in data rsv map > Only range wh

Re: [PATCH 3/3] btrfs-progs: tests: Introduce misc-tests/008-leaf-accross-stripes

2015-09-08 Thread Qu Wenruo
Zhao Lei wrote on 2015/09/04 21:23 +0800: To check is btrfs-convert create bad filesystem with leaf accross stripes. It is happened in progs version <=v4.1.2, and fixed by patch titled: btrfs: convert: Avoid allocating metadata extent crossing stripe boundary which was merged in v4.2. Notice

Re: [PATCH 10/19] btrfs: delayed_ref: release and free qgroup reserved at proper timing

2015-09-08 Thread Qu Wenruo
Tsutomu Itoh wrote on 2015/09/09 10:21 +0900: Hi, Qu, On 2015/09/08 18:08, Qu Wenruo wrote: Qgroup reserved space needs to be released from inode dirty map and get freed at different timing: 1) Release when the metadata is written into tree After corresponding metadata is written into tree,

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Anand Jain
On 09/09/2015 03:34 AM, Hugo Mills wrote: On Tue, Sep 08, 2015 at 09:18:05PM +0200, Ian Kumlien wrote: Hi, Currently i have a raid1 configuration on two disks where one of them is failing. But since: btrfs fi df /mnt/disk/ Data, RAID1: total=858.00GiB, used=638.16GiB Data, single: total=1.00

Re: [PATCH 13/19] btrfs: extent-tree: Add new verions of btrfs_check_data_free_space

2015-09-08 Thread Tsutomu Itoh
Hi, Qu, On 2015/09/08 18:22, Qu Wenruo wrote: > Add new function __btrfs_check_data_free_space() to do precious space > reservation. > > The new function will replace old btrfs_check_data_free_space(), but > until all the change is done, let's just use the new name. > > Also, export internal use

Re: Btrfs progs release 4.1

2015-09-08 Thread Qu Wenruo
Hi David, Sorry for the late reply, but I noticed something interesting. David Sterba wrote on 2015/06/22 17:00 +0200: Hi, btrfs-progs 4.1 have been released (in time with kernel 4.1). Unusual load of changes. Fixed since rc1: - uuid rewrite prints the correct original UUID - map-logica

Re: [PATCH 10/19] btrfs: delayed_ref: release and free qgroup reserved at proper timing

2015-09-08 Thread Tsutomu Itoh
Hi, Qu, On 2015/09/08 18:08, Qu Wenruo wrote: > Qgroup reserved space needs to be released from inode dirty map and get > freed at different timing: > > 1) Release when the metadata is written into tree > After corresponding metadata is written into tree, any newer write will > be COWed(don't inc

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Darrick J. Wong
On Tue, Sep 08, 2015 at 04:08:43PM -0700, Andy Lutomirski wrote: > On Tue, Sep 8, 2015 at 3:39 PM, Darrick J. Wong > wrote: > > On Tue, Sep 08, 2015 at 02:45:39PM -0700, Andy Lutomirski wrote: > >> On Tue, Sep 8, 2015 at 2:29 PM, Darrick J. Wong > >> wrote: > >> > On Tue, Sep 08, 2015 at 09:03:

Re: [PATCH 08/19] btrfs: qgroup: Introduce function to release/free reserved data range

2015-09-08 Thread Tsutomu Itoh
Hi, Qu, On 2015/09/08 18:08, Qu Wenruo wrote: > Introduce functions btrfs_qgroup_release/free_data() to release/free > reserved data range. > > Release means, just remove the data range from data rsv map, but doesn't > free the reserved space. > This is for normal buffered write case, when data i

Re: [PATCH 04/19] btrfs: qgroup: Introduce function to insert non-overlap reserve range

2015-09-08 Thread Tsutomu Itoh
Hi, Qu, On 2015/09/08 18:01, Qu Wenruo wrote: > New function insert_data_ranges() will insert non-overlap reserve ranges > into reserve map. > > It provides the basis for later qgroup reserve map implement. > > Signed-off-by: Qu Wenruo > --- > fs/btrfs/qgroup.c | 124 > ++

Re: [PATCH 01/19] btrfs: qgroup: New function declaration for new reserve implement

2015-09-08 Thread Tsutomu Itoh
Hi, Qu, On 2015/09/08 17:56, Qu Wenruo wrote: > Add new structures and functions for new qgroup reserve implement dirty > phase. > Which will focus on avoiding over-reserve as in that case, which means > for already reserved dirty space range, we won't reserve space again. > > This patch adds the

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Andy Lutomirski
On Tue, Sep 8, 2015 at 3:39 PM, Darrick J. Wong wrote: > On Tue, Sep 08, 2015 at 02:45:39PM -0700, Andy Lutomirski wrote: >> On Tue, Sep 8, 2015 at 2:29 PM, Darrick J. Wong >> wrote: >> > On Tue, Sep 08, 2015 at 09:03:09PM +0100, Pádraig Brady wrote: >> >> On 08/09/15 20:10, Andy Lutomirski wrot

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Darrick J. Wong
On Tue, Sep 08, 2015 at 02:45:39PM -0700, Andy Lutomirski wrote: > On Tue, Sep 8, 2015 at 2:29 PM, Darrick J. Wong > wrote: > > On Tue, Sep 08, 2015 at 09:03:09PM +0100, Pádraig Brady wrote: > >> On 08/09/15 20:10, Andy Lutomirski wrote: > >> > On Tue, Sep 8, 2015 at 11:23 AM, Anna Schumaker > >>

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Andy Lutomirski
On Tue, Sep 8, 2015 at 2:29 PM, Darrick J. Wong wrote: > On Tue, Sep 08, 2015 at 09:03:09PM +0100, Pádraig Brady wrote: >> On 08/09/15 20:10, Andy Lutomirski wrote: >> > On Tue, Sep 8, 2015 at 11:23 AM, Anna Schumaker >> > wrote: >> >> On 09/08/2015 11:21 AM, Pádraig Brady wrote: >> >>> I see cop

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Darrick J. Wong
On Tue, Sep 08, 2015 at 09:03:09PM +0100, Pádraig Brady wrote: > On 08/09/15 20:10, Andy Lutomirski wrote: > > On Tue, Sep 8, 2015 at 11:23 AM, Anna Schumaker > > wrote: > >> On 09/08/2015 11:21 AM, Pádraig Brady wrote: > >>> I see copy_file_range() is a reflink() on BTRFS? > >>> That's a bit surp

[PATCH] btrfs: use a single if() statement for one outcome in get_block_rsv()

2015-09-08 Thread Alexandru Moise
Rather than have three separate if() statements for the same outcome we should just OR them together in the same if() statement. Signed-off-by: Alexandru Moise <00moses.alexande...@gmail.com> --- fs/btrfs/extent-tree.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Anna Schumaker
On 09/08/2015 04:45 PM, Darrick J. Wong wrote: > On Tue, Sep 08, 2015 at 11:08:03AM -0400, Anna Schumaker wrote: >> On 09/05/2015 04:33 AM, Al Viro wrote: >>> On Fri, Sep 04, 2015 at 04:25:27PM -0600, Andreas Dilger wrote: >>> This is a bit of a surprising result, since in my testing in the >>

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Darrick J. Wong
On Tue, Sep 08, 2015 at 11:08:03AM -0400, Anna Schumaker wrote: > On 09/05/2015 04:33 AM, Al Viro wrote: > > On Fri, Sep 04, 2015 at 04:25:27PM -0600, Andreas Dilger wrote: > > > >> This is a bit of a surprising result, since in my testing in the > >> past, copy_{to/from}_user() is a major consume

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Hugo Mills
On Tue, Sep 08, 2015 at 10:33:54PM +0200, Ian Kumlien wrote: > On 8 September 2015 at 22:28, Hugo Mills wrote: > > On Tue, Sep 08, 2015 at 02:17:55PM -0600, Chris Murphy wrote: > >> On Tue, Sep 8, 2015 at 2:13 PM, Ian Kumlien wrote: > >> > On 8 September 2015 at 22:08, Chris Murphy > >> > wrote

Re: [PATCH v1 9/8] copy_file_range.2: New page documenting copy_file_range()

2015-09-08 Thread Darrick J. Wong
On Tue, Sep 08, 2015 at 11:04:03AM -0400, Anna Schumaker wrote: > On 09/04/2015 05:38 PM, Darrick J. Wong wrote: > > On Fri, Sep 04, 2015 at 04:17:03PM -0400, Anna Schumaker wrote: > >> copy_file_range() is a new system call for copying ranges of data > >> completely in the kernel. This gives file

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Ian Kumlien
On 8 September 2015 at 22:28, Hugo Mills wrote: > On Tue, Sep 08, 2015 at 02:17:55PM -0600, Chris Murphy wrote: >> On Tue, Sep 8, 2015 at 2:13 PM, Ian Kumlien wrote: >> > On 8 September 2015 at 22:08, Chris Murphy wrote: >> >> On Tue, Sep 8, 2015 at 2:00 PM, Ian Kumlien wrote: [--8<--] >> > -

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Hugo Mills
On Tue, Sep 08, 2015 at 02:17:55PM -0600, Chris Murphy wrote: > On Tue, Sep 8, 2015 at 2:13 PM, Ian Kumlien wrote: > > On 8 September 2015 at 22:08, Chris Murphy wrote: > >> On Tue, Sep 8, 2015 at 2:00 PM, Ian Kumlien wrote: > > > > [--8<--] > > > >>> Someone thought they were done too early, on

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Ian Kumlien
On 8 September 2015 at 22:17, Chris Murphy wrote: > On Tue, Sep 8, 2015 at 2:13 PM, Ian Kumlien wrote: >> On 8 September 2015 at 22:08, Chris Murphy wrote: >>> On Tue, Sep 8, 2015 at 2:00 PM, Ian Kumlien wrote: >> >> [--8<--] >> Someone thought they were done too early, only one disk => re

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Chris Murphy
On Tue, Sep 8, 2015 at 2:13 PM, Ian Kumlien wrote: > On 8 September 2015 at 22:08, Chris Murphy wrote: >> On Tue, Sep 8, 2015 at 2:00 PM, Ian Kumlien wrote: > > [--8<--] > >>> Someone thought they were done too early, only one disk => read only >>> mount. But, readonly mount => no balance. >>> >

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Ian Kumlien
On 8 September 2015 at 22:08, Chris Murphy wrote: > On Tue, Sep 8, 2015 at 2:00 PM, Ian Kumlien wrote: [--8<--] >> Someone thought they were done too early, only one disk => read only >> mount. But, readonly mount => no balance. >> >> I think something is wrong >> >> btrfs balance start -dc

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Chris Murphy
On Tue, Sep 8, 2015 at 2:00 PM, Ian Kumlien wrote: > On 8 September 2015 at 21:55, Ian Kumlien wrote: >> On 8 September 2015 at 21:43, Ian Kumlien wrote: >>> On 8 September 2015 at 21:34, Hugo Mills wrote: On Tue, Sep 08, 2015 at 09:18:05PM +0200, Ian Kumlien wrote: >> [--8<--] >>

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Pádraig Brady
On 08/09/15 20:10, Andy Lutomirski wrote: > On Tue, Sep 8, 2015 at 11:23 AM, Anna Schumaker > wrote: >> On 09/08/2015 11:21 AM, Pádraig Brady wrote: >>> I see copy_file_range() is a reflink() on BTRFS? >>> That's a bit surprising, as it avoids the copy completely. >>> cp(1) for example considered

RE: mkfs.btrfs cannot find rotational file for SSD detection for a pmem device

2015-09-08 Thread Elliott, Robert (Persistent Memory)
> -Original Message- > From: Austin S Hemmelgarn [mailto:ahferro...@gmail.com] > Sent: Tuesday, September 8, 2015 7:56 AM > Subject: Re: mkfs.btrfs cannot find rotational file for SSD detection for > a pmem device > > On 2015-09-06 13:51, Elliott, Robert (Persistent Memory) wrote: ... > >

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Ian Kumlien
On 8 September 2015 at 21:55, Ian Kumlien wrote: > On 8 September 2015 at 21:43, Ian Kumlien wrote: >> On 8 September 2015 at 21:34, Hugo Mills wrote: >>> On Tue, Sep 08, 2015 at 09:18:05PM +0200, Ian Kumlien wrote: > [--8<--] > >>>Physically removing it is the way to go (or disabling it usi

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Ian Kumlien
On 8 September 2015 at 21:43, Ian Kumlien wrote: > On 8 September 2015 at 21:34, Hugo Mills wrote: >> On Tue, Sep 08, 2015 at 09:18:05PM +0200, Ian Kumlien wrote: [--8<--] >>Physically removing it is the way to go (or disabling it using echo >> offline >/sys/block/sda/device/state). Once you

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Ian Kumlien
On 8 September 2015 at 21:34, Hugo Mills wrote: > On Tue, Sep 08, 2015 at 09:18:05PM +0200, Ian Kumlien wrote: >> Hi, >> >> Currently i have a raid1 configuration on two disks where one of them >> is failing. >> >> But since: >> btrfs fi df /mnt/disk/ >> Data, RAID1: total=858.00GiB, used=638.16Gi

Re: [btrfs tools] ability to fail a device...

2015-09-08 Thread Hugo Mills
On Tue, Sep 08, 2015 at 09:18:05PM +0200, Ian Kumlien wrote: > Hi, > > Currently i have a raid1 configuration on two disks where one of them > is failing. > > But since: > btrfs fi df /mnt/disk/ > Data, RAID1: total=858.00GiB, used=638.16GiB > Data, single: total=1.00GiB, used=256.00KiB > System,

[btrfs tools] ability to fail a device...

2015-09-08 Thread Ian Kumlien
Hi, Currently i have a raid1 configuration on two disks where one of them is failing. But since: btrfs fi df /mnt/disk/ Data, RAID1: total=858.00GiB, used=638.16GiB Data, single: total=1.00GiB, used=256.00KiB System, RAID1: total=32.00MiB, used=132.00KiB Metadata, RAID1: total=4.00GiB, used=1.21G

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Andy Lutomirski
On Tue, Sep 8, 2015 at 11:23 AM, Anna Schumaker wrote: > On 09/08/2015 11:21 AM, Pádraig Brady wrote: >> I see copy_file_range() is a reflink() on BTRFS? >> That's a bit surprising, as it avoids the copy completely. >> cp(1) for example considered doing a BTRFS clone by default, >> but didn't due

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Anna Schumaker
On 09/08/2015 11:21 AM, Pádraig Brady wrote: > On 04/09/15 21:16, Anna Schumaker wrote: >> Copy system calls came up during Plumbers a couple of weeks ago, because >> several filesystems (including NFS and XFS) are currently working on copy >> acceleration implementations. We haven't heard from Za

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Pádraig Brady
On 04/09/15 21:16, Anna Schumaker wrote: > Copy system calls came up during Plumbers a couple of weeks ago, because > several filesystems (including NFS and XFS) are currently working on copy > acceleration implementations. We haven't heard from Zach Brown in a while, > so I volunteered to push hi

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Anna Schumaker
On 09/05/2015 04:33 AM, Al Viro wrote: > On Fri, Sep 04, 2015 at 04:25:27PM -0600, Andreas Dilger wrote: > >> This is a bit of a surprising result, since in my testing in the >> past, copy_{to/from}_user() is a major consumer of CPU time (50% >> of a CPU core at 1GB/s). What backing filesystem di

Re: [PATCH v1 0/8] VFS: In-kernel copy system call

2015-09-08 Thread Anna Schumaker
On 09/04/2015 06:25 PM, Andreas Dilger wrote: > On Sep 4, 2015, at 2:16 PM, Anna Schumaker wrote: >> >> Copy system calls came up during Plumbers a couple of weeks ago, >> because several filesystems (including NFS and XFS) are currently >> working on copy acceleration implementations. We haven't

Re: [PATCH v1 9/8] copy_file_range.2: New page documenting copy_file_range()

2015-09-08 Thread Anna Schumaker
On 09/04/2015 06:31 PM, Andreas Dilger wrote: > On Sep 4, 2015, at 3:38 PM, Darrick J. Wong wrote: >> >> On Fri, Sep 04, 2015 at 04:17:03PM -0400, Anna Schumaker wrote: >>> copy_file_range() is a new system call for copying ranges of data >>> completely in the kernel. This gives filesystems an op

Re: [PATCH v1 9/8] copy_file_range.2: New page documenting copy_file_range()

2015-09-08 Thread Anna Schumaker
On 09/04/2015 05:38 PM, Darrick J. Wong wrote: > On Fri, Sep 04, 2015 at 04:17:03PM -0400, Anna Schumaker wrote: >> copy_file_range() is a new system call for copying ranges of data >> completely in the kernel. This gives filesystems an opportunity to >> implement some kind of "copy acceleration",

Re: [PATCH v1 8/8] vfs: Fall back on splice if no copy function defined

2015-09-08 Thread Anna Schumaker
On 09/04/2015 05:08 PM, Darrick J. Wong wrote: > On Fri, Sep 04, 2015 at 04:17:02PM -0400, Anna Schumaker wrote: >> The NFS server will need a fallback for filesystems that don't have any >> kind of copy acceleration yet, and it should be generally useful to have >> an in-kernel copy to avoid lots

[PATCH 2/3] btrfs-progs: Avoid uninitialized data in output of btrfs-convert

2015-09-08 Thread Zhao Lei
sequence, transid and reserved field of inode was write to disk with uninitizlized value, this patch fixed it. Signed-off-by: Zhao Lei --- btrfs-convert.c | 4 ctree.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/btrfs-convert.c b/btrfs-convert.c index f4fc650..934f4dc 100

[PATCH 3/3] btrfs-progs: add ext2fs_close_inode_scan to copy_inodes

2015-09-08 Thread Zhao Lei
We need use ext2fs_close_inode_scan to release relative resource get from ext2fs_open_inode_scan() in copy_inodes() Signed-off-by: Zhao Lei --- btrfs-convert.c | 1 + 1 file changed, 1 insertion(+) diff --git a/btrfs-convert.c b/btrfs-convert.c index 934f4dc..e7f3c9e 100644 --- a/btrfs-convert.

[PATCH 1/3] btrfs-progs: fix set_get typo of btrfs_inode_item->sequence

2015-09-08 Thread Zhao Lei
s/generation/sequence for BTRFS_SETGET_STACK_FUNCS(stack_inode_sequence, ...) Signed-off-by: Zhao Lei --- ctree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctree.h b/ctree.h index bcad2b9..2061e1e 100644 --- a/ctree.h +++ b/ctree.h @@ -1423,7 +1423,7 @@ BTRFS_SETGET_FUN

[PATCH 0/3] btrfs-progs: Avoid uninitialized data in output of btrfs-convert

2015-09-08 Thread Zhao Lei
sequence, transid and reserved field of inode was write to disk with uninitizlized value, this patchset fixed it, also fixed some other typo. Zhao Lei (3): btrfs-progs: fix set_get typo of btrfs_inode_item->sequence btrfs-progs: Avoid uninitialized data in output of btrfs-convert btrfs-progs

Re: mkfs.btrfs cannot find rotational file for SSD detection for a pmem device

2015-09-08 Thread Austin S Hemmelgarn
On 2015-09-06 13:51, Elliott, Robert (Persistent Memory) wrote: mkfs.btrfs does not detect pmem devices as being SSDs in kernel 4.2. Label: (null) UUID: 46603efe-728c-43fe-8241-ffc125e1a7ed Node size: 16384 Sector size:4096 Filesystem size:8.00GiB

Re: raid6 + hot spare question

2015-09-08 Thread Hugo Mills
On Tue, Sep 08, 2015 at 01:59:19PM +0200, Peter Keše wrote: > > I'm planning to set up a raid6 array with 4 x 4TB drives. > Presumably that would result in 8TB of usable space + parity, which > is about enough for my data (my data is currently 5TB in raid1, > slowly growing at about 1 TB per year,

raid6 + hot spare question

2015-09-08 Thread Peter Keše
I'm planning to set up a raid6 array with 4 x 4TB drives. Presumably that would result in 8TB of usable space + parity, which is about enough for my data (my data is currently 5TB in raid1, slowly growing at about 1 TB per year, but I often keep some additional backups if space permits). How

Re: [PATCH] btrfs-progs: makefile: drop u option from ar invocation

2015-09-08 Thread David Sterba
On Sat, Sep 05, 2015 at 01:06:18AM +0200, Arnd Hannemann wrote: > In newer distros (ubuntu 15.10, fedora rawhide) the binutils > ar uses the new D flag per default to build deterministic > binaries. > Without this patch the following warning is issued, when > building btrfs-progs: > > [AR]

Re: [PATCH] btrfs: trival fix of __btrfs_set_acl error handling

2015-09-08 Thread David Sterba
On Tue, Sep 08, 2015 at 05:02:32PM +0800, Sheng Yong wrote: > Hi, Qu > > On 9/8/2015 4:50 PM, Qu Wenruo wrote: > > Sheng Yong wrote on 2015/09/08 08:46 +: > >> * If the allocation failed, don't free to free it, even though kfree > >>allows to free a NULL pointer. > >> * If posix_acl_to_xat

[PATCH v9.1 1/3] xfstests: btrfs: add functions to create dm-error device

2015-09-08 Thread Anand Jain
From: Anand Jain Controlled EIO from the device is achieved using the dm device. Helper functions are at common/dmerror. Broadly steps will include calling _dmerror_init(). _dmerror_init() will use SCRATCH_DEV to create dm linear device and assign DMERROR_DEV to /dev/mapper/error-test. When tes

[PATCH 18/19] btrfs: qgroup: Cleanup old inaccurate facilities

2015-09-08 Thread Qu Wenruo
Cleanup the old facilities which use old btrfs_qgroup_reserve() function call, replace them with the newer version, and remove the "__" prefix in them. Also, make btrfs_qgroup_reserve/free() functions private, as they are now only used inside qgroup codes. Now, the whole btrfs qgroup is swithed t

[PATCH 17/19] btrfs: extent-tree: Use new __btrfs_delalloc_reserve_space function

2015-09-08 Thread Qu Wenruo
Use new __btrfs_delalloc_reserve_space to reserve space. Signed-off-by: Qu Wenruo --- fs/btrfs/inode-map.c | 2 +- fs/btrfs/inode.c | 16 ++-- fs/btrfs/ioctl.c | 5 +++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-m

[PATCH 19/19] btrfs: qgroup: Add handler for NOCOW and inline

2015-09-08 Thread Qu Wenruo
For NOCOW and inline case, there will be no delayed_ref created for them, so we should free their reserved data space at proper time(finish_ordered_io for NOCOW and cow_file_inline for inline). Signed-off-by: Qu Wenruo --- fs/btrfs/extent-tree.c | 7 ++- fs/btrfs/inode.c | 15

[PATCH 16/19] btrfs: extent-tree: Add new version of btrfs_delalloc_reserve_space

2015-09-08 Thread Qu Wenruo
Add new version of btrfs_delalloc_reserve_space() function, which supports accurate qgroup reserve. Signed-off-by: Qu Wenruo --- fs/btrfs/ctree.h | 1 + fs/btrfs/extent-tree.c | 38 ++ 2 files changed, 39 insertions(+) diff --git a/fs/btrfs/ctree.h b/f

[PATCH 12/19] btrfs: qgroup: Use new metadata reservation.

2015-09-08 Thread Qu Wenruo
As we have the new metadata reservation functions, use them to replace the old btrfs_qgroup_reserve() call for metadata. Signed-off-by: Qu Wenruo --- fs/btrfs/extent-tree.c | 14 ++ fs/btrfs/transaction.c | 34 ++ fs/btrfs/transaction.h | 1 - 3 files

[PATCH 14/19] btrfs: Switch to new check_data_free_space

2015-09-08 Thread Qu Wenruo
Use new check_data_free_space for buffered write and inode cache. For buffered write case, as nodatacow write won't increase quota account, so unlike old behavior which does reserve before check nocow, now we check nocow first and then only reserve data if we can't do nocow write. Signed-off-by:

[PATCH 13/19] btrfs: extent-tree: Add new verions of btrfs_check_data_free_space

2015-09-08 Thread Qu Wenruo
Add new function __btrfs_check_data_free_space() to do precious space reservation. The new function will replace old btrfs_check_data_free_space(), but until all the change is done, let's just use the new name. Also, export internal use function btrfs_alloc_data_chunk_ondemand(), as now qgroup re

[PATCH 15/19] btrfs: fallocate: Add support to accurate qgroup reserve

2015-09-08 Thread Qu Wenruo
Now fallocate will do accurate qgroup reserve space check, unlike old method, which will always reserve the whole length of the range. With this patch, fallocate will: 1) Iterate the desired range and mark in data rsv map Only range which is going to be allocated will be recorded in data rsv

[PATCH 11/19] btrfs: qgroup: Introduce new functions to reserve/free metadata

2015-09-08 Thread Qu Wenruo
Introduce new functions btrfs_qgroup_reserve/free_meta() to reserve/free metadata reserved space. Signed-off-by: Qu Wenruo --- fs/btrfs/ctree.h | 3 +++ fs/btrfs/disk-io.c | 1 + fs/btrfs/qgroup.c | 40 fs/btrfs/qgroup.h | 4 4 files changed,

[PATCH 10/19] btrfs: delayed_ref: release and free qgroup reserved at proper timing

2015-09-08 Thread Qu Wenruo
Qgroup reserved space needs to be released from inode dirty map and get freed at different timing: 1) Release when the metadata is written into tree After corresponding metadata is written into tree, any newer write will be COWed(don't include NOCOW case yet). So we must release its range from ino

[PATCH 09/19] btrfs: delayed_ref: Add new function to record reserved space into delayed ref

2015-09-08 Thread Qu Wenruo
Add new function btrfs_add_delayed_qgroup_reserve() function to record how much space is reserved for that extent. As btrfs only accounts qgroup at run_delayed_refs() time, so newly allocated extent should keep the reserved space until then. So add needed function with related members to do it.

[PATCH 08/19] btrfs: qgroup: Introduce function to release/free reserved data range

2015-09-08 Thread Qu Wenruo
Introduce functions btrfs_qgroup_release/free_data() to release/free reserved data range. Release means, just remove the data range from data rsv map, but doesn't free the reserved space. This is for normal buffered write case, when data is written into disc and its metadata is added into tree, it

Re: [PATCH RFC 00/14] Accurate qgroup reserve framework

2015-09-08 Thread Qu Wenruo
Sorry for the confusing cover letter title. This patch is no longer RFC now. It's already a working one, and we're doing stress test to ensure it's completely OK, but seems quite good for now. To Chris, I know the timing I sent the patchset is quite awful, as there is only less than 1 week f

[PATCH 05/19] btrfs: qgroup: Introduce function to reserve data range per inode

2015-09-08 Thread Qu Wenruo
Introduce new function reserve_data_range(). This function will find non-overlap range and to insert it into reserve map using previously introduced functions. This provides the basis for later per inode reserve map implement. Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 92

[PATCH 04/19] btrfs: qgroup: Introduce function to insert non-overlap reserve range

2015-09-08 Thread Qu Wenruo
New function insert_data_ranges() will insert non-overlap reserve ranges into reserve map. It provides the basis for later qgroup reserve map implement. Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 124 ++ 1 file changed, 124 insertions(+)

[PATCH 06/19] btrfs: qgroup: Introduce btrfs_qgroup_reserve_data function

2015-09-08 Thread Qu Wenruo
This new function will do all the hard work to reserve precious space for a write. The overall work flow will be the following. File A already has some dirty pages: 0 4K 8K 12K 16K |///| |///| And then, someone want to write some data into range [4K, 16K).

[PATCH 07/19] btrfs: qgroup: Introduce function to release reserved range

2015-09-08 Thread Qu Wenruo
Introduce new function release_data_range() to release reserved ranges. It will iterate through all existing ranges and remove/shrink them. Note this function will not free reserved space, as the range can be released in the following conditions: 1) The dirty range gets written to disk. In this

Re: [PATCH] btrfs: trival fix of __btrfs_set_acl error handling

2015-09-08 Thread Sheng Yong
Hi, Qu On 9/8/2015 4:50 PM, Qu Wenruo wrote: > Sheng Yong wrote on 2015/09/08 08:46 +: >> * If the allocation failed, don't free to free it, even though kfree >>allows to free a NULL pointer. >> * If posix_acl_to_xattr() failed, cleanup the allocation and return >>the error directly. >

[PATCH 03/19] btrfs: qgroup: Introduce new function to search most left reserve range

2015-09-08 Thread Qu Wenruo
Introduce the new function to search the most left reserve range in a reserve map. It provides the basis for later reserve map implement. Signed-off-by: Qu Wenruo --- fs/btrfs/qgroup.c | 36 1 file changed, 36 insertions(+) diff --git a/fs/btrfs/qgroup.c b/

[PATCH 01/19] btrfs: qgroup: New function declaration for new reserve implement

2015-09-08 Thread Qu Wenruo
Add new structures and functions for new qgroup reserve implement dirty phase. Which will focus on avoiding over-reserve as in that case, which means for already reserved dirty space range, we won't reserve space again. This patch adds the needed structure declaration and comments. Signed-off-by:

[PATCH 02/19] btrfs: qgroup: Implement data_rsv_map init/free functions

2015-09-08 Thread Qu Wenruo
New functions btrfs_qgroup_init/free_data_rsv_map() to init/free data reserve map. Data reserve map is used to mark which range already holds reserved space, to avoid current reserved space leak. Signed-off-by: Qu Wenruo --- fs/btrfs/btrfs_inode.h | 2 ++ fs/btrfs/inode.c | 10 +++ f

[PATCH RFC 00/14] Accurate qgroup reserve framework

2015-09-08 Thread Qu Wenruo
[[BUG]] One of the most common case to trigger the bug is the following method: 1) Enable quota 2) Limit excl of qgroup 5 to 16M 3) Write [0,2M) of a file inside subvol 5 10 times without sync EQUOT will be triggered at about the 8th write. [[CAUSE]] The problem is caused by the fact that qgroup

Re: [PATCH] btrfs: trival fix of __btrfs_set_acl error handling

2015-09-08 Thread Qu Wenruo
Sheng Yong wrote on 2015/09/08 08:46 +: * If the allocation failed, don't free to free it, even though kfree allows to free a NULL pointer. * If posix_acl_to_xattr() failed, cleanup the allocation and return the error directly. So, what's the point? For me, I didn't see the pros of the

[PATCH] btrfs: trival fix of __btrfs_set_acl error handling

2015-09-08 Thread Sheng Yong
* If the allocation failed, don't free to free it, even though kfree allows to free a NULL pointer. * If posix_acl_to_xattr() failed, cleanup the allocation and return the error directly. Signed-off-by: Sheng Yong --- fs/btrfs/acl.c | 14 +++--- 1 file changed, 7 insertions(+), 7 del