Unable to mount BTRFS home dir anymore

2016-02-15 Thread Bhasker C V
Hi all, Help with recovery of BTRFS home directory data. I have been using BTRFS happily for an year now. It has worked across power failures and many such situations. Last week, however, the filesystem could not be mounted after a power failure. None of the following methods were helpful 1)

Major HDD performance degradation on btrfs receive

2016-02-15 Thread Nazar Mokrynskyi
I have 2 SSD with BTRFS filesystem (RAID) on them and several subvolumes. Each 15 minutes I'm creating read-only snapshot of subvolumes /root, /home and /web inside /backup. After this I'm searching for last common subvolume on /backup_hdd, sending difference between latest common snapshot and

Re: bad extent [5993525264384, 5993525280768), type mismatch with chunk

2016-02-15 Thread Qu Wenruo
Ángel González wrote on 2016/02/16 01:14 +0100: Hello everybody I have a btrfs filesystem [probably] created with btrfs-progs 4.3.1 that is also spewing some hundred of thousand «bad extent [x, y), type mismatch with chunk» messages on btrfsck. In fact, there is not only one false alert.

Re: bad extent [5993525264384, 5993525280768), type mismatch with chunk

2016-02-15 Thread Ángel González
Hello everybody I have a btrfs filesystem [probably] created with btrfs-progs 4.3.1 that is also spewing some hundred of thousand «bad extent [x, y), type mismatch with chunk» messages on btrfsck. The data seems to be fine, so I expect it to be some kind of false positive. Still, there seems to

Re: [PATCH] btrfs: change max_inline default to 2048

2016-02-15 Thread Chris Mason
On Thu, Feb 11, 2016 at 05:55:30PM +0100, David Sterba wrote: > The current practical default is ~4k on x86_64 (the logic is more complex, > simplified for brevity), the inlined files land in the metadata group and > thus consume space that could be needed for the real metadata. > > The inlining

[PATCH 3/3] xfs/24[356]: check for -c switch to xfs_io bmap command

2016-02-15 Thread Darrick J. Wong
Extend _require_xfs_io_command so that we can pass it a command line argument to look for, and then use new capabililty in the relevant tests to ensure that bmap knows how to dump CoW fork contents (bmap -c) Signed-off-by: Darrick J. Wong --- common/rc |9

[PATCH 2/3] punch-alternating: use the block size reported by the fs for punching

2016-02-15 Thread Darrick J. Wong
When we're trying to punch alternating blocks out of a file, use the bsize reported by fstatfs so that we can punch out single blocks. Signed-off-by: Darrick J. Wong --- src/punch-alternating.c |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git

[PATCH 1/3] generic/304: fix high offset

2016-02-15 Thread Darrick J. Wong
"Invalid argument" is a better response to an impossibly high offset dedupe request than "extents don't match", so change the test. Signed-off-by: Darrick J. Wong --- tests/generic/304.out |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v4.3 0/3] xfstests: minor fixes for the reflink/dedupe tests

2016-02-15 Thread Darrick J. Wong
This is a patch set against the reflink/dedupe test cases in xfstests. All three patches fix some minor problems in the giant testcase merge last weekend. The zeroth patch ought to be Filipe Manana's patch ("fstests: generic/158, test dedupe with destination offset past EOF") but as he just

Re: [PATCH] btrfs: change max_inline default to 2048

2016-02-15 Thread David Sterba
On Fri, Feb 12, 2016 at 07:10:29AM +, Duncan wrote: > Default? > > For those who want to keep the current inline, what's the mkfs.btrfs or > mount-option recipe to do so? I don't see any code added for that, nor > am I aware of any current options to change it, yet "default" indicates >

Re: [PATCH] btrfs: Avoid BUG_ON()s because of ENOMEM caused by kmalloc() failure

2016-02-15 Thread David Sterba
On Mon, Feb 15, 2016 at 02:38:09PM +0900, Satoru Takeuchi wrote: > There are some BUG_ON()'s after kmalloc() as follows. > > = > foo = kmalloc(); > BUG_ON(!foo); /* -ENOMEM case */ > = > > A Docker + memory cgroup user hit these BUG_ON()s. > >

[PATCH 01/15] btrfs: create a helper function to read the disk super

2016-02-15 Thread David Sterba
From: Anand Jain A part of code from btrfs_scan_one_device() is moved to a new function btrfs_read_disk_super(), so that former function looks cleaner. (In this process it also moves the code which ensures null terminating label). So this creates easy opportunity to merge

[PATCH 02/15] btrfs: create helper function __check_raid_min_devices()

2016-02-15 Thread David Sterba
From: Anand Jain move a section of btrfs_rm_device() code to check for min number of the devices into the function __check_raid_min_devices() Signed-off-by: Anand Jain Signed-off-by: David Sterba --- fs/btrfs/volumes.c | 51

[PATCH 09/15] btrfs: optimize check for stale device

2016-02-15 Thread David Sterba
From: Anand Jain Optimize check for stale device to only be checked when there is device added or changed. If there is no update to the device, there is no need to call btrfs_free_stale_device(). Signed-off-by: Anand Jain Signed-off-by: David

[PATCH 08/15] btrfs: introduce device delete by devid

2016-02-15 Thread David Sterba
From: Anand Jain This introduces new ioctl BTRFS_IOC_RM_DEV_V2, which uses enhanced struct btrfs_ioctl_vol_args_v2 to carry devid as an user argument. The patch won't delete the old ioctl interface and so kernel remains backward compatible with user land progs. Test

[PATCH 05/15] btrfs: make use of btrfs_find_device_by_user_input()

2016-02-15 Thread David Sterba
From: Anand Jain btrfs_rm_device() has a section of the code which can be replaced btrfs_find_device_by_user_input() Signed-off-by: Anand Jain Signed-off-by: David Sterba --- fs/btrfs/volumes.c | 100

[PATCH 06/15] btrfs: enhance btrfs_find_device_by_user_input() to check device path

2016-02-15 Thread David Sterba
From: Anand Jain The operation of device replace and device delete follows same steps upto some depth with in btrfs kernel, however they don't share codes. This enhancement will help replace and delete to share codes. Signed-off-by: Anand Jain

[PATCH 07/15] btrfs: make use of btrfs_scratch_superblocks() in btrfs_rm_device()

2016-02-15 Thread David Sterba
From: Anand Jain With the previous patches now the btrfs_scratch_superblocks() is ready to be used in btrfs_rm_device() so use it. Signed-off-by: Anand Jain [ use GFP_KERNEL ] Signed-off-by: David Sterba --- fs/btrfs/volumes.c |

[PATCH 03/15] btrfs: clean up and optimize __check_raid_min_device()

2016-02-15 Thread David Sterba
From: Anand Jain __check_raid_min_device() which was pealed from btrfs_rm_device() maintianed its original code to show the block move. This patch cleans up __check_raid_min_device(). Signed-off-by: Anand Jain Signed-off-by: David Sterba

[PATCH 04/15] btrfs: create helper btrfs_find_device_by_user_input()

2016-02-15 Thread David Sterba
From: Anand Jain The patch renames btrfs_dev_replace_find_srcdev() to btrfs_find_device_by_user_input() and moves it to volumes.c, so that delete device can use it. Signed-off-by: Anand Jain Signed-off-by: David Sterba ---

[PATCH 12/15] btrfs: indtroduce raid-type to error-code table, for minimum device constraint

2016-02-15 Thread David Sterba
Signed-off-by: David Sterba --- fs/btrfs/volumes.c | 15 +++ fs/btrfs/volumes.h | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index ae94e06f3e61..a67249582a6f 100644 --- a/fs/btrfs/volumes.c +++

[PATCH 14/15] btrfs: rename btrfs_find_device_by_user_input

2016-02-15 Thread David Sterba
For clarity how we are going to find the device, let's call it a device specifier, devspec for short. Also rename the arguments that are a leftover from previous function purpose. Signed-off-by: David Sterba --- fs/btrfs/dev-replace.c | 2 +- fs/btrfs/volumes.c | 17

[PATCH 15/15] btrfs: rename flags for vol args v2

2016-02-15 Thread David Sterba
Rename BTRFS_DEVICE_BY_ID so it's more descriptive that we specify the device by id, it'll be part of the public API. The mask of supported flags is also renamed, only for internal use. The error code for unknown flags is EOPNOTSUPP, fixed. Signed-off-by: David Sterba ---

[PATCH 10/15] btrfs: rename __check_raid_min_devices

2016-02-15 Thread David Sterba
Underscores are for special functions, use the full prefix for better stacktrace recognition. Signed-off-by: David Sterba --- fs/btrfs/volumes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index

[PATCH 11/15] btrfs: pass number of devices to btrfs_check_raid_min_devices

2016-02-15 Thread David Sterba
Before this patch, btrfs_check_raid_min_devices would do an off-by-one check of the constraints and not the miminmum check, as its name suggests. This is not a problem if the only caller is device remove, but would be confusing for others. Add an argument with the exact number and let the

[PATCH 00/15] Device delete by id

2016-02-15 Thread David Sterba
Hi, this patchset extends the ioctl arugments to take an id so we can delete a device by it. It reuses the existing structure btrfs_ioctl_vol_args_v2 and extends it in na backward-compatible way so that we don't need to introduce another one. The core patchset is from Anand, I did some cleanups

[PATCH 13/15] btrfs: use existing device constraints table btrfs_raid_array

2016-02-15 Thread David Sterba
We should avoid duplicating the device constraints, let's use the btrfs_raid_array in btrfs_check_raid_min_devices. Signed-off-by: David Sterba --- fs/btrfs/volumes.c | 23 +-- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git

Re: [PATCH 09/13] btrfs: make use of btrfs_find_device_by_user_input()

2016-02-15 Thread David Sterba
On Mon, Feb 15, 2016 at 05:47:46PM +0100, David Sterba wrote: > > + struct btrfs_super_block *disk_super = NULL; > > disk_super is NULL here and unchanged until ... > > > + if (!disk_super) { > > ... here, so this will always take this branch > > > + ret =

Re: [PATCH 09/13] btrfs: make use of btrfs_find_device_by_user_input()

2016-02-15 Thread David Sterba
On Sat, Feb 13, 2016 at 10:01:36AM +0800, Anand Jain wrote: > btrfs_rm_device() has a section of the code which can be replaced > btrfs_find_device_by_user_input() > > Signed-off-by: Anand Jain > --- > fs/btrfs/volumes.c | 100 >

Re: btrfs-image failure (btrfs-tools 4.4)

2016-02-15 Thread Marc MERLIN
On Mon, Feb 15, 2016 at 08:17:32AM +0800, Qu Wenruo wrote: > Sorry for the late reply. > > According to the output of your btrfsck --repair output, things just get > worse. > > So at this point, it's harder to locate the original problem. (Csum > missing with bad file extents) > > IMHO you

[PATCH] Btrfs: fix direct IO requests not reporting IO error to user space

2016-02-15 Thread fdmanana
From: Filipe Manana If a bio for a direct IO request fails, we were not setting the error in the parent bio (the main DIO bio), making us not return the error to user space in btrfs_direct_IO(), that is, it made __blockdev_direct_IO() return the number of bytes issued for IO

Re: [PATCH v2 06/13] btrfs: create helper function __check_raid_min_devices()

2016-02-15 Thread David Sterba
On Sat, Feb 13, 2016 at 10:01:33AM +0800, Anand Jain wrote: > move a section of btrfs_rm_device() code to check for min number of the > devices into the function __check_raid_min_devices() But this also changes the semantics a bit. In context of device remove we check if there are going to be

btrfs check --repair dumps out

2016-02-15 Thread Chad Bergeron
I have a multi-drive raid10 btrfs array that isn't working. When I can mount it, it is r/o, and before I give it up for lost, I thought I'd share what happens when I try to run btrfs check. For starters- uname -a: Linux palantir 4.4.1-2-ARCH #1 SMP PREEMPT Wed Feb 3 13:12:33 UTC 2016 x86_64

Re: Fwd: Unmountable fs after power outage

2016-02-15 Thread Radek Sprta
2016-02-08 14:05 GMT+01:00 Qu Wenruo : > Quite strange. > IIRC, btrfsck should at least report transid error. > As written in disk-io.c, verify_parent_transid() function. > > Since btrfsck reports no error, I think btrfs-image could dump the metadata > without problem. > >

[PATCH 2/2] fstests: generic test for file fsync after rename operation

2016-02-15 Thread fdmanana
From: Filipe Manana Test that if we have a file F1 with two links, one in a directory A and the other in directory B, if we remove the link in directory B, move some other file F2 from directory B into directory C, fsync inode F1, power fail and remount the filesystem, file F2

[PATCH Resend] fstests: generic/158, test dedupe with destination offset past EOF

2016-02-15 Thread fdmanana
From: Filipe Manana We were testing when the source file offset starts at EOF or beyond, but not when the destination offset is beyond EOF or when the destination offset is smaller than EOF but destination offset plus dedup length is greater than EOF. This is motivated by a

[PATCH 1/2] fstests: generic test for directory fsync after rename operation

2016-02-15 Thread fdmanana
From: Filipe Manana Test that if we move one file between directories, fsync the parent directory of the old directory, power fail and remount the filesystem, the file is not lost and it's located at the destination directory. This is motivated by a bug found in btrfs, which

[PATCH Resend] fstests: btrfs, test directory fsync after deleting snapshots

2016-02-15 Thread fdmanana
From: Filipe Manana Test that if we fsync a directory that had a snapshot entry in it that was deleted and crash, the next time we mount the filesystem, the log replay procedure will not fail and the snapshot is not present anymore. This issue is fixed by the following patch