[PATCH v5 10/19] btrfs: dedup: Add basic tree structure for on-disk dedup method

2016-02-01 Thread Qu Wenruo
Introduce a new tree, dedup tree to record on-disk dedup hash. As a persist hash storage instead of in-memeory only implement. Unlike Liu Bo's implement, in this version we won't do hack for bytenr -> hash search, but add a new type, DEDUP_BYTENR_ITEM for such search case, just like in-memory back

[PATCH v5 19/19] btrfs: try more times to alloc metadata reserve space

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang In btrfs_delalloc_reserve_metadata(), the number of metadata bytes we try to reserve is calculated by the difference between outstanding_extents and reserved_extents. When reserve_metadata_bytes() fails to reserve desited metadata space, it has already done some reclaim work

[PATCH v5 16/19] btrfs: dedup: add an inode nodedup flag

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Introduce BTRFS_INODE_NODEDUP flag, then we can explicitly disable online data deduplication for specified files. Signed-off-by: Wang Xiaoguang --- fs/btrfs/ctree.h | 1 + fs/btrfs/ioctl.c | 6 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/c

[PATCH v5 03/19] btrfs: dedup: Introduce function to add hash into in-memory tree

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Introduce static function inmem_add() to add hash into in-memory tree. And now we can implement the btrfs_dedup_add() interface. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang --- fs/btrfs/dedup.c | 157 +++ 1 fi

[PATCH v5 00/19][For 4.6] Btrfs: Add inband (write time) de-duplication framework

2016-02-01 Thread Qu Wenruo
The patchset can also be fetched from github: https://github.com/adam900710/linux.git wang_dedup This updated version of inband de-duplication has the following features: 1) ONE unified dedup framework. Most of its code is hidden quietly in dedup.c and export the minimal interfaces for its c

[PATCH v5 11/19] btrfs: dedup: Introduce interfaces to resume and cleanup dedup info

2016-02-01 Thread Qu Wenruo
Since we will introduce a new on-disk based dedup method, introduce new interfaces to resume previous dedup setup. And since we introduce a new tree for status, also add disable handler for it. Signed-off-by: Wang Xiaoguang Signed-off-by: Qu Wenruo --- fs/btrfs/dedup.c | 277

[PATCH v5 13/19] btrfs: dedup: Add support to delete hash for on-disk backend

2016-02-01 Thread Qu Wenruo
Now on-disk backend can delete hash now. Signed-off-by: Wang Xiaoguang Signed-off-by: Qu Wenruo --- fs/btrfs/dedup.c | 100 +++ 1 file changed, 100 insertions(+) diff --git a/fs/btrfs/dedup.c b/fs/btrfs/dedup.c index c2b6a03..309cbc3 100644 -

[PATCH v5 04/19] btrfs: dedup: Introduce function to remove hash from in-memory tree

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Introduce static function inmem_del() to remove hash from in-memory dedup tree. And implement btrfs_dedup_del() and btrfs_dedup_destroy() interfaces. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang --- fs/btrfs/dedup.c | 88 +

[PATCH v5 15/19] btrfs: dedup: Add ioctl for inband deduplication

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Add ioctl interface for inband deduplication, which includes: 1) enable 2) disable 3) status We will later add ioctl to disable inband dedup for given file/dir. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang --- fs/btrfs/dedup.c | 52 +++

[PATCH v5 17/19] btrfs: dedup: add a property handler for online dedup

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang We use btrfs extended attribute "btrfs.dedup" to record per-file online dedup status, so add a dedup property handler. Signed-off-by: Wang Xiaoguang --- fs/btrfs/props.c | 40 1 file changed, 40 insertions(+) diff --git a/fs/btrfs/

[PATCH v5 01/19] btrfs: dedup: Introduce dedup framework and its header

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Introduce the header for btrfs online(write time) de-duplication framework and needed header. The new de-duplication framework is going to support 2 different dedup method and 1 dedup hash. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang --- fs/btrfs/ctree.h |

[PATCH v5 07/19] btrfs: dedup: Implement btrfs_dedup_calc_hash interface

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Unlike in-memory or on-disk dedup method, only SHA256 hash method is supported yet, so implement btrfs_dedup_calc_hash() interface using SHA256. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang --- fs/btrfs/dedup.c | 43 +++ 1

[PATCH v5 06/19] btrfs: dedup: Introduce function to search for an existing hash

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Introduce static function inmem_search() to handle the job for in-memory hash tree. The trick is, we must ensure the delayed ref head is not being run at the time we search the for the hash. With inmem_search(), we can implement the btrfs_dedup_search() interface. Signed-o

[PATCH v5 09/19] btrfs: dedup: Inband in-memory only de-duplication implement

2016-02-01 Thread Qu Wenruo
Core implement for inband de-duplication. It reuse the async_cow_start() facility to do the calculate dedup hash. And use dedup hash to do inband de-duplication at extent level. The work flow is as below: 1) Run delalloc range for an inode 2) Calculate hash for the delalloc range at the unit of de

[PATCH v5 08/19] btrfs: ordered-extent: Add support for dedup

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Add ordered-extent support for dedup. Note, current ordered-extent support only supports non-compressed source extent. Support for compressed source extent will be added later. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang --- fs/btrfs/ordered-data.c | 36 ++

[PATCH v5 12/19] btrfs: dedup: Add support for on-disk hash search

2016-02-01 Thread Qu Wenruo
Now on-disk backend should be able to search hash now. Signed-off-by: Wang Xiaoguang Signed-off-by: Qu Wenruo --- fs/btrfs/dedup.c | 133 --- fs/btrfs/dedup.h | 1 + 2 files changed, 118 insertions(+), 16 deletions(-) diff --git a/fs/btrfs/

[PATCH v5 02/19] btrfs: dedup: Introduce function to initialize dedup info

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Add generic function to initialize dedup info. Signed-off-by: Qu Wenruo Signed-off-by: Wang Xiaoguang --- fs/btrfs/Makefile | 2 +- fs/btrfs/dedup.c | 100 ++ fs/btrfs/dedup.h | 17 -- 3 files changed, 116 i

[PATCH v5 05/19] btrfs: delayed-ref: Add support for increasing data ref under spinlock

2016-02-01 Thread Qu Wenruo
For in-band dedup, btrfs needs to increase data ref with delayed_ref locked, so add a new function btrfs_add_delayed_data_ref_lock() to increase extent ref with delayed_refs already locked. Signed-off-by: Qu Wenruo --- fs/btrfs/dedup.c | 1 + fs/btrfs/delayed-ref.c | 30 ++

[PATCH v5 18/19] btrfs: dedup: add per-file online dedup control

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Introduce inode_need_dedup() to implement per-file online dedup control. Signed-off-by: Wang Xiaoguang --- fs/btrfs/inode.c | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1e27a71..1973f86 100644

[PATCH v5 14/19] btrfs: dedup: Add support for adding hash for on-disk backend

2016-02-01 Thread Qu Wenruo
Now on-disk backend can add hash now. Signed-off-by: Wang Xiaoguang Signed-off-by: Qu Wenruo --- fs/btrfs/dedup.c | 83 1 file changed, 83 insertions(+) diff --git a/fs/btrfs/dedup.c b/fs/btrfs/dedup.c index 309cbc3..073726d 100644 --- a

[PATCH v4 7/8] btrfs-progs: debug-tree: Add dedup tree support

2016-02-01 Thread Qu Wenruo
Add dedup tree support for btrfs-debug-tree. Signed-off-by: Qu Wenruo --- v2: Add support to print hex objectid/offset for dedup hash. Add support to print hex hash. --- btrfs-debug-tree.c | 4 +++ ctree.h| 7 print-tree.c | 94 +++

[PATCH v4 3/8] btrfs-progs: dedup: Add disable support for inband deduplication

2016-02-01 Thread Qu Wenruo
Add disable subcommand for dedup command group. Signed-off-by: Qu Wenruo --- Documentation/btrfs-dedup.asciidoc | 5 + cmds-dedup.c | 42 ++ 2 files changed, 47 insertions(+) diff --git a/Documentation/btrfs-dedup.asciidoc b/Docume

[PATCH v4 2/8] btrfs-progs: dedup: Add enable command for dedup command group

2016-02-01 Thread Qu Wenruo
Add enable subcommand for dedup commmand group. Signed-off-by: Qu Wenruo --- Documentation/btrfs-dedup.asciidoc | 79 - cmds-dedup.c | 138 + ioctl.h| 2 + 3 files changed, 218 insertions

[PATCH v4 6/8] btrfs-progs: Add show-super support for new DEDUP flag

2016-02-01 Thread Qu Wenruo
Now btrfs-show-super can handle DEDUP ro compat flag. Signed-off-by: Qu Wenruo --- btrfs-show-super.c | 17 + 1 file changed, 17 insertions(+) diff --git a/btrfs-show-super.c b/btrfs-show-super.c index 051bd11..0bc0b1f 100644 --- a/btrfs-show-super.c +++ b/btrfs-show-super.c @@

[PATCH v4 4/8] btrfs-progs: dedup: Add status subcommand

2016-02-01 Thread Qu Wenruo
Add status subcommand for dedup command group. Signed-off-by: Qu Wenruo --- Documentation/btrfs-dedup.asciidoc | 3 ++ cmds-dedup.c | 76 ++ 2 files changed, 79 insertions(+) diff --git a/Documentation/btrfs-dedup.asciidoc b/Documentat

[PATCH v4 5/8] btrfs-progs: Add dedup feature for mkfs and convert

2016-02-01 Thread Qu Wenruo
Add new DEDUP ro compat flag and corresponding mkfs/convert flag 'dedup'. Since dedup tree is completely isolated from fs tree, so even old kernel could do read mount. So add it to RO compat flag instead of common incompat flags Signed-off-by: Qu Wenruo --- Documentation/mkfs.btrfs.asciidoc |

[PATCH v4 8/8] btrfs-progs: property: add a dedup property

2016-02-01 Thread Qu Wenruo
From: Wang Xiaoguang Normally if we enable online dedup for a fs, it's filesystem wide de-duplication. With this property, we can explicitly disable data de-duplication for specified files. Signed-off-by: Wang Xiaoguang --- Documentation/btrfs-property.asciidoc | 2 + props.c

[PATCH v4 1/8] btrfs-progs: Basic framework for dedup command group

2016-02-01 Thread Qu Wenruo
Add basic ioctl header and command group framework for later use. Alone with basic man page doc. Signed-off-by: Qu Wenruo --- Documentation/Makefile.in | 1 + Documentation/btrfs-dedup.asciidoc | 39 +++ Documentation/btrfs.asciidoc | 4 Makefile

[PATCH v4 0/8] btrfs-progs: Support in-band de-duplication

2016-02-01 Thread Qu Wenruo
Preparation patchset for in-coming (aimed for 4.6) kernel in-band de-duplication patchset. New kernel dedup will has 2 different dedup backends and a ioctl interface to enable/disable dedup. The ioctl interface and on-disk format (mostly) is determined, so submit this patchset first before de-dup

Re: Why is dedup inline, not delayed (as opposed to offline)? Explain like I'm five pls.

2016-02-01 Thread Qu Wenruo
You're right, I misunderstood the mail and get a little emotional. And sorry for that inappropriate reply. BTW, the new patchset will be sent to btrfs mail list in coming hour, if you're interested in inband de-dup, you can try the following github repos to build and test in-band de-dup: Ke

[RFC PATCH 1/4] fstests: Add support to check btrfs sysfs features

2016-02-01 Thread Qu Wenruo
Btrfs has its sysfs interface showing what features current kernel/btrfs module support. Add _require_btrfs_kernel_feature() to check such interface. Also rename _require_btrfs() to _require_btrfs_subcommand() to avoid confusion. Signed-off-by: Qu Wenruo --- common/rc | 12 +++-

[RFC PATCH 4/4] fstests: btrfs: Add per inode dedup flag test

2016-02-01 Thread Qu Wenruo
This test will check per inode dedup flag. Signed-off-by: Qu Wenruo --- tests/btrfs/202 | 117 tests/btrfs/202.out | 15 +++ tests/btrfs/group | 1 + 3 files changed, 133 insertions(+) create mode 100755 tests/btrfs/202 create m

[RFC PATCH 0/4] fstests for basic btrfs inband de-duplication

2016-02-01 Thread Qu Wenruo
Basic test for btrfs in-band de-duplication. The comprehensive test should be enable dedup for every existing test case (except some ENOSPC test, which need life time to fill it). Dave is implementing the feature allowing us to execute such command at mount time, but it's not implemented now. Qu

[RFC PATCH 2/4] fstests: btrfs: Add basic test for btrfs in-band de-duplication

2016-02-01 Thread Qu Wenruo
Add basic test for btrfs in-band de-duplication, including: 1) Enable 2) Re-enable 3) On disk extents are refering to same bytenr 4) Disable Signed-off-by: Qu Wenruo --- common/defrag | 8 tests/btrfs/200 | 112 tests/btrfs/20

[RFC PATCH 3/4] fstests: btrfs: Add testcase for btrfs dedup enable disable race test

2016-02-01 Thread Qu Wenruo
Add test case to check btrfs dedup enable/disable race. Signed-off-by: Qu Wenruo --- tests/btrfs/201 | 97 + tests/btrfs/201.out | 1 + tests/btrfs/group | 1 + 3 files changed, 99 insertions(+) create mode 100755 tests/btrfs/201 crea

Re: [PATCH] btrfs-progs: add 'du' command

2016-02-01 Thread David Sterba
Hi, On Wed, Jan 20, 2016 at 01:49:24PM -0800, Mark Fasheh wrote: > A git tree of the patches can be found here: > > https://github.com/markfasheh/btrfs-progs-patches/tree/du what changed since the previous posting? Otherwise code looks ok, I saw use of uint64_t, the units help can be extended t

Re: booting from BTRFS works only with one device in the pool

2016-02-01 Thread Chris Murphy
On Mon, Feb 1, 2016 at 2:31 PM, Hendrik Friedel wrote: > Hello, > > I am running CentOS from a btrfs root. > This worked fine until I added a device to that pool: > btrfs device add /dev/sda3 / > reboot > > This now causes the errors: > BTRFS: failed to read chunk tree on sdb3 > BTRFS: open_ctree

Re: [PATCH V7 0/3][PULL REQUEST] Unify 'norecovery' bahavior with other filesystems

2016-02-01 Thread David Sterba
On Fri, Jan 29, 2016 at 11:17:48AM +0800, Qu Wenruo wrote: > Ping. > > Any comment? > Or will it be merged into current 4.5? Apparently not for 4.5, I'm going to revisit that for 4.6. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@v

Re: booting from BTRFS works only with one device in the pool

2016-02-01 Thread Hugo Mills
On Mon, Feb 01, 2016 at 11:02:42PM +, Duncan wrote: > Hugo Mills posted on Mon, 01 Feb 2016 22:11:20 + as excerpted: > > > On Mon, Feb 01, 2016 at 10:31:47PM +0100, Hendrik Friedel wrote: > >> Hello, > >> > >> I am running CentOS from a btrfs root. > >> This worked fine until I added a de

Re: booting from BTRFS works only with one device in the pool

2016-02-01 Thread Duncan
Hugo Mills posted on Mon, 01 Feb 2016 22:11:20 + as excerpted: > On Mon, Feb 01, 2016 at 10:31:47PM +0100, Hendrik Friedel wrote: >> Hello, >> >> I am running CentOS from a btrfs root. >> This worked fine until I added a device to that pool: >> btrfs device add /dev/sda3 / >> reboot >> >> Th

Re: booting from BTRFS works only with one device in the pool

2016-02-01 Thread Hugo Mills
On Mon, Feb 01, 2016 at 10:31:47PM +0100, Hendrik Friedel wrote: > Hello, > > I am running CentOS from a btrfs root. > This worked fine until I added a device to that pool: > btrfs device add /dev/sda3 / > reboot > > This now causes the errors: > BTRFS: failed to read chunk tree on sdb3 > BTRFS:

booting from BTRFS works only with one device in the pool

2016-02-01 Thread Hendrik Friedel
Hello, I am running CentOS from a btrfs root. This worked fine until I added a device to that pool: btrfs device add /dev/sda3 / reboot This now causes the errors: BTRFS: failed to read chunk tree on sdb3 BTRFS: open_ctree failed Here I am stuck in a recovery prompt. btrfs fi show displays th

Re: Question about a specific error.

2016-02-01 Thread Hugo Mills
On Mon, Feb 01, 2016 at 03:37:39PM -0500, Austin S. Hemmelgarn wrote: > On 2016-02-01 15:21, Hugo Mills wrote: > >On Mon, Feb 01, 2016 at 02:44:24PM -0500, Austin S. Hemmelgarn wrote: > >>In the process of trying to debug issues I'm having on one of my > >>systems with a new kernel version, I decid

Re: btrfs-progs 4.4 re-balance of RAID6 is very slow / limited to one cpu core?

2016-02-01 Thread Chris Murphy
On Mon, Feb 1, 2016 at 7:10 AM, Christian Rohmann wrote: > Hey Chris, > > > sorry for the late reply. > > > On 01/27/2016 10:53 PM, Chris Murphy wrote: >> I can't exactly reproduce this. I'm using +C qcow2 on Btrfs on one SSD >> to back the drives in the VM. >> >> 2x btrfs raid1 with files totalli

Re: Question about a specific error.

2016-02-01 Thread Austin S. Hemmelgarn
On 2016-02-01 15:21, Hugo Mills wrote: On Mon, Feb 01, 2016 at 02:44:24PM -0500, Austin S. Hemmelgarn wrote: In the process of trying to debug issues I'm having on one of my systems with a new kernel version, I decided to do a dry run check on the root filesystem. 'btrfs check' returned a bunch

Re: Question about a specific error.

2016-02-01 Thread Austin S. Hemmelgarn
On 2016-02-01 15:27, Chris Murphy wrote: On Mon, Feb 1, 2016 at 12:44 PM, Austin S. Hemmelgarn wrote: In the process of trying to debug issues I'm having on one of my systems with a new kernel version, I decided to do a dry run check on the root filesystem. 'btrfs check' returned a bunch of li

Re: Question about a specific error.

2016-02-01 Thread Chris Murphy
On Mon, Feb 1, 2016 at 12:44 PM, Austin S. Hemmelgarn wrote: > In the process of trying to debug issues I'm having on one of my > systems with a new kernel version, I decided to do a dry run check on > the root filesystem. 'btrfs check' returned a bunch of lines like: > > root 257 inode XX er

Re: Question about a specific error.

2016-02-01 Thread Hugo Mills
On Mon, Feb 01, 2016 at 02:44:24PM -0500, Austin S. Hemmelgarn wrote: > In the process of trying to debug issues I'm having on one of my > systems with a new kernel version, I decided to do a dry run check on > the root filesystem. 'btrfs check' returned a bunch of lines like: > > root 257 inode

Question about a specific error.

2016-02-01 Thread Austin S. Hemmelgarn
In the process of trying to debug issues I'm having on one of my systems with a new kernel version, I decided to do a dry run check on the root filesystem. 'btrfs check' returned a bunch of lines like: root 257 inode XX errors 2000, link count wrong unresolved ref dir Y index 53 n

Re: Progress indicator when (slowly) mounting a btrfs filesystem?

2016-02-01 Thread Austin S. Hemmelgarn
On 2016-02-01 09:03, Christian Rohmann wrote: Hey Chris, On 01/28/2016 12:47 AM, Chris Murphy wrote: Might be a bug, but more likely might be a lack of optimization. If it eventually mounts without errors that's a pretty good plus. Lots of file systems can't handle power failures well at all.

Re: btrfs-progs 4.4 re-balance of RAID6 is very slow / limited to one cpu core?

2016-02-01 Thread Christian Rohmann
Hey Chris, sorry for the late reply. On 01/27/2016 10:53 PM, Chris Murphy wrote: > I can't exactly reproduce this. I'm using +C qcow2 on Btrfs on one SSD > to back the drives in the VM. > > 2x btrfs raid1 with files totalling 5G consistently takes ~1 minute > [1] to balance (no filters) > >

Re: Progress indicator when (slowly) mounting a btrfs filesystem?

2016-02-01 Thread Christian Rohmann
Hey Chris, On 01/28/2016 12:47 AM, Chris Murphy wrote: > Might be a bug, but more likely might be a lack of optimization. If it > eventually mounts without errors that's a pretty good plus. Lots of > file systems can't handle power failures well at all. So what and how should I go about profiling

[PATCH] Btrfs extent_same (dedup) ioctl fixes

2016-02-01 Thread fdmanana
From: Filipe Manana Hi Chris, Please consider the following fixes for the extent_same ioctl. They fix issues related to missing proper page and range locking, which lead to invalid memory accesses and other unexpected failures (such as data checksum validation failures, on perfectly healthy hard

Re: RAID1 disk upgrade method

2016-02-01 Thread Austin S. Hemmelgarn
On 2016-01-29 17:06, Henk Slager wrote: On Fri, Jan 29, 2016 at 9:40 PM, Austin S. Hemmelgarn wrote: On 2016-01-29 15:27, Henk Slager wrote: On Fri, Jan 29, 2016 at 1:14 PM, Austin S. Hemmelgarn wrote: On 2016-01-28 18:01, Chris Murphy wrote: On Thu, Jan 28, 2016 at 1:44 PM, Austin S. H

Re: [PATCH] fs: btrfs: fixes a pass by reference issue in send.c

2016-02-01 Thread Filipe Manana
On Mon, Feb 1, 2016 at 11:53 AM, Ben Marsh wrote: > This patch fixes a pointer issue from passing a struct as a parameter > to the function btrfs_root_dec_send_in_progress. > > Signed-off-by: Ben Marsh > --- > fs/btrfs/send.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git

[PATCH] fs: btrfs: fixes a pass by reference issue in send.c

2016-02-01 Thread Ben Marsh
This patch fixes a pointer issue from passing a struct as a parameter to the function btrfs_root_dec_send_in_progress. Signed-off-by: Ben Marsh --- fs/btrfs/send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 63a6152..47ee63e 100644

Re: "WARNING: device 0 not present" during scrub?

2016-02-01 Thread Patrik Lundquist
On 30 January 2016 at 12:59, Christian Pernegger wrote: > > This is on a 1-month-old Debian stable (jessie) install and yes, I > know that means the kernel and btrfs-progs are ancient apt-get install -t jessie-backports linux-image-4.3.0-0.bpo.1-amd64 Or something like that for the image name. U

Re: Pointers to Btrfs Testplan/Testcases

2016-02-01 Thread Lakshmipathi.G
I didn't know that xfstests covers more than xfs. Will look into their repo for btrfs specific cases. thanks for the response. Cheers, Lakshmipathi.G -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo inf