Re: [PATCH 1/5] Btrfs-progs: fix closing of devices

2013-06-11 Thread Filipe Manana
On 11/06/2013, at 16:00, David Sterba dste...@suse.cz wrote: On Mon, Jun 10, 2013 at 09:07:55PM +0100, Filipe David Borba Manana wrote: --- a/disk-io.c +++ b/disk-io.c @@ -1267,12 +1267,12 @@ static int close_all_devices(struct btrfs_fs_info *fs_info) while (!list_empty(list)) {

[PATCH] Btrfs: read lock extent buffer while walking backrefs

2014-07-02 Thread Filipe Manana
Before processing the extent buffer, acquire a read lock on it, so that we're safe against concurrent updates on the extent buffer. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/backref.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c

[PATCH] Btrfs: reduce size of struct extent_state

2014-07-06 Thread Filipe Manana
, meaning that with a page size of 4096 bytes we can now store 46 extent states per page instead of 42. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/extent_io.c | 37 - fs/btrfs/extent_io.h | 1 - 2 files changed, 20 insertions(+), 18 deletions(-) diff

[PATCH] Btrfs: set error return value in btrfs_get_blocks_direct

2014-07-07 Thread Filipe Manana
We were returning with 0 (success) because we weren't extracting the error code from em (PTR_ERR(em)). Fix it. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index

[PATCH] Btrfs: race free update of commit root for ro snapshots

2014-07-28 Thread Filipe Manana
that uses the new snapshot. This change addresses those 2 issues. Special thanks to Alex Lyakas for spotting the second issue. Cc: Alex Lyakas alex.bt...@zadarastorage.com Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 29 + fs/btrfs

[PATCH] Btrfs: unlock nodes earlier when inserting items in a btree

2014-07-28 Thread Filipe Manana
In ctree.c:setup_items_for_insert(), we can unlock all nodes in our path before we process the leaf (shift items and data, adjust data offsets, etc). This allows for better btree concurrency, as we're often holding a write lock on at least the node at level 1. Signed-off-by: Filipe Manana fdman

[PATCH] Btrfs: avoid unnecessary switch of path locks to blocking mode

2014-07-28 Thread Filipe Manana
release our path before repeating the tree search. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/ctree.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index bd0ae3e..783ea3b 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs

[PATCH] Btrfs: return path with unlocked nodes in btrfs_next_leaf

2014-07-31 Thread Filipe Manana
if applicable) while the btrfs_next_leaf() caller processes the leaf. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/ctree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 783ea3b..8ca6761 100644 --- a/fs/btrfs/ctree.c +++ b

[PATCH v2] Btrfs: race free update of commit root for ro snapshots

2014-07-31 Thread Filipe Manana
and performs orphan cleanup if needed. Like the vfs, the ioctl locks the parent inode too, preventing race issues between a dentry lookup and snapshot creation. Cc: Alex Lyakas alex.bt...@zadarastorage.com Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Updated commit message, as original second

[PATCH] Btrfs: ensure tmpfile inode is always persisted with link count of 0

2014-07-31 Thread Filipe Manana
orphan item checksum tree key (CSUM_TREE ROOT_ITEM 0) (...) Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 4f35c6c..8ad3ea9 100644 --- a/fs/btrfs

[PATCH] xfstests: add regression test for btrfs send with orphans

2014-07-31 Thread Filipe Manana
kernel btrfs patch: Btrfs: update commit root on snapshot creation after orphan cleanup Signed-off-by: Filipe Manana fdman...@suse.com --- tests/btrfs/057 | 81 + tests/btrfs/057.out | 1 + tests/btrfs/group | 1 + 3 files changed, 83

[PATCH v2] xfstests: add regression test for btrfs send with orphans

2014-08-01 Thread Filipe Manana
kernel btrfs patch: Btrfs: update commit root on snapshot creation after orphan cleanup Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Replaced a redirect with a redirect to $seqres.full, and added a sleep. tests/btrfs/057 | 84

[PATCH] Btrfs: make btrfs_search_forward return with nodes unlocked

2014-08-04 Thread Filipe Manana
nodes with level = 1 immediately after calling btrfs_search_forward(), change btrfs_search_forward() to do it, so that it benefits all callers. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/ctree.c | 11 +++ fs/btrfs/ioctl.c | 5 - fs/btrfs/tree-log.c | 3 --- fs

[PATCH] Btrfs: fix hole detection during file fsync

2014-08-06 Thread Filipe Manana
# md5 digest should be the same we got before the unmount. _mount_flakey md5sum $SCRATCH_MNT/foo | _filter_scratch _unmount_flakey MOUNT_OPTIONS=$SAVE_MOUNT_OPTIONS status=0 exit Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/tree-log.c | 17 + 1

[PATCH v2] Btrfs: fix hole detection during file fsync

2014-08-07 Thread Filipe Manana
above, and the file's # md5 digest should be the same we got before the unmount. _mount_flakey md5sum $SCRATCH_MNT/foo | _filter_scratch _unmount_flakey MOUNT_OPTIONS=$SAVE_MOUNT_OPTIONS status=0 exit Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Updated commit

[PATCH] Btrfs: don't monopolize a core when evicting inode

2014-08-07 Thread Filipe Manana
-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8ad3ea9..00b4bd3 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4718,6 +4718,11 @@ static void evict_inode_truncate_pages(struct

[PATCH] Btrfs: fix csum tree corruption, duplicate and outdated checksums

2014-08-09 Thread Filipe Manana
with logical offset of 40161280, 40165376 or 40169472 (the last 3 4kb blocks of file data), will get the old checksums. Cc: sta...@vger.kernel.org Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/file-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/file

[PATCH] Btrfs: send, lower mem requirements for processing xattrs

2014-08-10 Thread Filipe Manana
with kmalloc. Also start with a smaller buffer size, since xattr values typically are smaller than a page. Reported-by: Chris Murphy li...@colorremedies.com Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/send.c | 41 + 1 file changed, 33

[PATCH v2] Btrfs: send, lower mem requirements for processing xattrs

2014-08-10 Thread Filipe Manana
with kmalloc. Also start with a smaller buffer size, since xattr values typically are smaller than a page. Reported-by: Chris Murphy li...@colorremedies.com Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Use is_vmalloc_addr() instead of keeping a boolean variable around. fs/btrfs/send.c

[PATCH v3] Btrfs: send, lower mem requirements for processing xattrs

2014-08-10 Thread Filipe Manana
with kmalloc. Also start with a smaller buffer size, since xattr values typically are smaller than a page. Reported-by: Chris Murphy li...@colorremedies.com Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Use is_vmalloc_addr() instead of keeping a boolean variable around. V3: Use krealloc

[PATCH v4] Btrfs: send, lower mem requirements for processing xattrs

2014-08-10 Thread Filipe Manana
with kmalloc. Also start with a smaller buffer size, since xattr values typically are smaller than a page. Reported-by: Chris Murphy li...@colorremedies.com Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Use is_vmalloc_addr() instead of keeping a boolean variable around. V3: Use krealloc

[PATCH] Btrfs: shrink further sizeof(struct extent_buffer)

2014-08-14 Thread Filipe Manana
The map_start and map_len fields aren't used anywhere, so just remove them. On a x86_64 system, this reduced sizeof(struct extent_buffer) from 296 bytes to 280 bytes, and therefore 14 extent_buffer structs can now fit into a page instead of 13. Signed-off-by: Filipe Manana fdman...@suse.com

[PATCH v5] Btrfs: send, lower mem requirements for processing xattrs

2014-08-20 Thread Filipe Manana
with kmalloc. Also start with a smaller buffer size, since xattr values typically are smaller than a page. Reported-by: Chris Murphy li...@colorremedies.com Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Use is_vmalloc_addr() instead of keeping a boolean variable around. V3: Use krealloc

[PATCH] Btrfs: improve free space cache management and space allocation

2014-08-25 Thread Filipe Manana
0.24s) read compiled tree total runs 3 avg 27.82 MB/s (user 1.45s sys 0.97s) delete compiled tree total runs 30 avg 3.18 seconds (user 0.17s sys 0.65s) Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/free-space-cache.c | 149 ++- fs/btrfs/tests/free-space-tests.c

[PATCH] Btrfs: fix corruption after write/fsync failure + fsync + log recovery

2014-08-25 Thread Filipe Manana
total csum bytes: 4 total tree bytes: 131072 total fs tree bytes: 32768 total extent tree bytes: 16384 btree space waste bytes: 123404 file data blocks allocated: 274432 referenced 274432 Btrfs v3.14.1-96-gcc7fd5a-dirty Signed-off-by: Filipe Manana fdman...@suse.com

[PATCH v3] Btrfs: improve free space cache management and space allocation

2014-08-29 Thread Filipe Manana
0.24s) read compiled tree total runs 3 avg 27.82 MB/s (user 1.45s sys 0.97s) delete compiled tree total runs 30 avg 3.18 seconds (user 0.17s sys 0.65s) Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Simplified bitmap search logic, shorter and cleaner now, and one less rbtree

[PATCH] Btrfs: fix crash while a ranged msync() is ongoing

2014-08-29 Thread Filipe Manana
the in memory inode's disk_i_size). Issue found while running xfstests/generic/127 (happens very rarely for me). Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 16e8146

[PATCH v2] Btrfs: fix crash while doing a ranged fsync

2014-08-29 Thread Filipe Manana
supposed to change the in memory inode's disk_i_size. Issue found while running xfstests/generic/127 (happens very rarely for me), more specifically via the fsx calls that use memory mapped IO (and issue msync calls). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Updated commit message

[PATCH] Btrfs: fix fsync data loss after a ranged fsync

2014-08-30 Thread Filipe Manana
a matching file extent item to the log btree and wait for its ordered operation to finish (if it's still ongoing). Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/file.c | 2 +- fs/btrfs/tree-log.c | 50 -- fs/btrfs/tree-log.h | 2

[PATCH] Btrfs: fix fsync race leading to invalid data after log replay

2014-08-30 Thread Filipe Manana
locations containing invalid data. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/file.c | 33 +++-- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index e5534c1..5e9d108 100644 --- a/fs/btrfs/file.c

[PATCH v2] Btrfs: fix fsync race leading to invalid data after log replay

2014-09-02 Thread Filipe Manana
data, as we returned success to userspace without waiting for the respective ordered operation to finish, because it wasn't captured by btrfs_get_logged_extents(). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Better comments and for the non full sync case, start only

[PATCH v2] Btrfs: fix fsync data loss after a ranged fsync

2014-09-02 Thread Filipe Manana
and therefore we didn't log it, and we must let the next fast fsync (one that checks only the modified list) see this extent map and log a matching file extent item to the log btree and wait for its ordered operation to finish (if it's still ongoing). Signed-off-by: Filipe Manana fdman...@suse.com

[PATCH] Btrfs: fix data corruption after fast fsync and writeback error

2014-09-05 Thread Filipe Manana
a -EIO error to userspace, so that it knows that not all of its previous writes were durably persisted and the application can take proper action (like redo the writes for e.g.) - and definitely not leave any file extent items in the log refer to non fully written extents. Signed-off-by: Filipe

[PATCH v3] Btrfs: fix fsync data loss after a ranged fsync

2014-09-05 Thread Filipe Manana
-by: Filipe Manana fdman...@suse.com --- V2: No code change, only updated the changelog and the comment, to make them more clear and accurate. V3: Added missing condition to exclude extent map from the modified list and ensure btrfs_log_inode() is called for the next fsync if the modified list

[PATCH] xfstests: generic: add test for double msync, motivated by a btrfs bug

2014-09-05 Thread Filipe Manana
is fixed by the following linux kernel patch: Btrfs: fix fsync data loss after a ranged fsync Signed-off-by: Filipe Manana fdman...@suse.com --- tests/generic/325 | 106 ++ tests/generic/325.out | 19 + tests/generic/group | 1

[PATCH v4] Btrfs: fix fsync data loss after a ranged fsync

2014-09-06 Thread Filipe Manana
-by: Filipe Manana fdman...@suse.com --- V2: No code change, only updated the changelog and the comment, to make them more clear and accurate. V3: Added missing condition to exclude extent map from the modified list and ensure btrfs_log_inode() is called for the next fsync if the modified list

[PATCH] Btrfs: fix directory recovery from fsync log

2014-09-08 Thread Filipe Manana
$SCRATCH_MNT/foo ] || echo file foo is missing [ -f $SCRATCH_MNT/bar ] || echo file bar is missing _unmount_flakey _check_scratch_fs $FLAKEY_DEV The filesystem check at the end failed with the message: root 5 root dir 256 error. A test case for xfstests follows. Signed-off-by: Filipe

[PATCH] xfstests: generic: add dir fsync test, motivated by a btrfs bug

2014-09-08 Thread Filipe Manana
patch: Btrfs: fix directory recovery from fsync log Signed-off-by: Filipe Manana fdman...@suse.com --- tests/generic/326 | 95 +++ tests/generic/326.out | 2 ++ tests/generic/group | 1 + 3 files changed, 98 insertions(+) create mode

[PATCH v5] Btrfs: fix fsync data loss after a ranged fsync

2014-09-08 Thread Filipe Manana
-by: Filipe Manana fdman...@suse.com --- V2: No code change, only updated the changelog and the comment, to make them more clear and accurate. V3: Added missing condition to exclude extent map from the modified list and ensure btrfs_log_inode() is called for the next fsync if the modified list

[PATCH v2] xfstests: generic: add dir fsync test, motivated by a btrfs bug

2014-09-08 Thread Filipe Manana
patch: Btrfs: fix directory recovery from fsync log Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Replaced direct use of xfs_io with $XFS_IO_PROG. tests/generic/326 | 95 +++ tests/generic/326.out | 2 ++ tests/generic/group | 1

[PATCH] Btrfs: add missing compression property remove in btrfs_ioctl_setflags

2014-09-10 Thread Filipe Manana
$ lsattr a/file2 c--- a/file2 $ lsattr -d a a Reported-by: Andreas Schneider a...@cryptomilk.org Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/ioctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c

[PATCH v2] Btrfs: add missing compression property remove in btrfs_ioctl_setflags

2014-09-11 Thread Filipe Manana
$ lsattr a/file2 c--- a/file2 $ lsattr -d a a Reported-by: Andreas Schneider a...@cryptomilk.org Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Ensure BTRFS_INODE_NOCOMPRESS isn't set (unless the bit FS_NOCOMP_FL is set). fs/btrfs/ioctl.c | 3

[PATCH] xfstests: btrfs: add test regarding clearing compression flag/property

2014-09-11 Thread Filipe Manana
Regression test for btrfs where removing the flag FS_COMPR_FL (chattr -c) from an inode wouldn't clear its compression property. This was fixed in the following linux kernel patch: Btrfs: add missing compression property remove in btrfs_ioctl_setflags Signed-off-by: Filipe Manana fdman

[PATCH] Btrfs: set inode's logged_trans/last_log_commit after ranged fsync

2014-09-11 Thread Filipe Manana
loss after a ranged fsync which was added to its v5, but didn't make it on time. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/btrfs_inode.h | 13 +++-- fs/btrfs/tree-log.c| 14 ++ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/fs/btrfs

[PATCH 1/2] Btrfs: add missing end_page_writeback on submit_extent_page failure

2014-09-22 Thread Filipe Manana
forever waiting for the writeback bit to be cleared from the page. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/extent_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 3af4966..91f866c 100644 --- a/fs/btrfs/extent_io.c +++ b

[PATCH 2/2] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-22 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/btrfs_inode.h | 2 ++ fs/btrfs/extent_io.c | 69 +++--- fs/btrfs/transaction.c | 20 --- fs/btrfs

[PATCH 2/2 v2] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-23 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since

[PATCH 2/2 v3] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-23 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since

[PATCH 2/2 v4] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-23 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since

[PATCH 2/2 v5] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-24 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since

[PATCH 2/2 v6] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-24 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since

[PATCH 2/2 v7] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-24 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since

[PATCH 2/2 v8] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-25 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since

[PATCH v3] xfstests: generic: add dir fsync test, motivated by a btrfs bug

2014-09-25 Thread Filipe Manana
able to rmdir empty directories (failed with errno ENOTEMPTY). This was fixed in btrfs with the following linux kernel patch: Btrfs: fix directory recovery from fsync log Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Replaced direct use of xfs_io with $XFS_IO_PROG. V3: Made

[PATCH 2/2 v9] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-25 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since

[PATCH 2/2 v10] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-25 Thread Filipe Manana
that writeback errors happened (the pages were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since

[PATCH 2/2 v11] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-25 Thread Filipe Manana
were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since the unwritten node/leaf it represents can't

[PATCH 2/2 v12] Btrfs: be aware of btree inode write errors to avoid fs corruption

2014-09-26 Thread Filipe Manana
were no longer tagged for writeback). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: If an extent buffer's write failed but it's also deleted from the tree before the transaction commits, don't abort the transaction with -EIO, since the unwritten node/leaf it represents can't

[PATCH] Btrfs: send, don't delay dir move if there's a new parent inode

2014-10-02 Thread Filipe Manana
receive (from an incremental send) failed with the following error message: rename o261-7-0 - merlin/RC/OSD failed. This is a regression introduced in the 3.16 kernel. A test case for xfstests follows. Reported-by: Marc Merlin m...@merlins.org Signed-off-by: Filipe Manana fdman...@suse.com --- fs

[PATCH] fstests: regression test for btrfs incremental send

2014-10-02 Thread Filipe Manana
: send, don't delay dir move if there's a new parent inode Signed-off-by: Filipe Manana fdman...@suse.com --- tests/btrfs/060 | 148 tests/btrfs/060.out | 2 + tests/btrfs/group | 1 + 3 files changed, 151 insertions(+) create mode

Re: FIBMAP unsupported

2014-10-03 Thread Filipe Manana
On 10/02/2014 11:11 PM, Marc Dietrich wrote: Am Donnerstag 02 Oktober 2014, 21:55:55 schrieb Marc Dietrich: Will try to restore the file using btrfs restore ok, restore worked. I did some more tests. This is unrelated to CoW. It seems that the fallocate -n in combination with dd

[PATCH 4/5] Btrfs: process all async extents on compressed write failure

2014-10-06 Thread Filipe Manana
that correspond to the uncompressed content). Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index a3e2330..8636499 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c

[PATCH 1/5] Btrfs: set page and mapping error on compressed write failure

2014-10-06 Thread Filipe Manana
of the inode's address space operations don't get that return value. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/extent_io.c | 5 + fs/btrfs/extent_io.h | 1 + fs/btrfs/inode.c | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/extent_io.c b/fs

[PATCH 2/5] Btrfs: fix hang on compressed write error

2014-10-06 Thread Filipe Manana
, so any filemap_fdatawait_range() call will hang forever. We were also not calling the writepage end io hook, which means the corresponding ordered extent will never complete and all its waiters will block forever, such as a full fsync (via btrfs_wait_ordered_range()). Signed-off-by: Filipe

[PATCH 0/5] Proper error handling for the compressed write path

2014-10-06 Thread Filipe Manana
This patchset fixes several issues in inode.c:submit_compressed_extents() when one of the functions it calls fails. These issues range from hangs, missing error reporting (silent failure), memory leaks and pages not getting released. Filipe Manana (5): Btrfs: set page and mapping error

[PATCH 3/5] Btrfs: don't leak pages and memory on compressed write error

2014-10-06 Thread Filipe Manana
In inode.c:submit_compressed_extents(), if we fail before calling btrfs_submit_compressed_write(), or when that function fails, we were freeing the async_extent structure without releasing its pages and freeing the pages array. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c

[PATCH 5/5] Btrfs: make inode.c:submit_compressed_extents() return void

2014-10-06 Thread Filipe Manana
calling filemap_fdatawrite_range (which calls the writepages address space callback, which in turn calls the inode's fill_delalloc callback). Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/btrfs

[PATCH] Btrfs: don't ignore compressed bio write errors

2014-10-06 Thread Filipe Manana
to filemap_fdatawait_range() / filemap_fdatawait() can find out that errors happened (we surely don't want silent failures on fsync for example). Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/compression.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fs

[PATCH 2/2] Btrfs: make inode.c:compress_file_range() return void

2014-10-09 Thread Filipe Manana
with the respective pages tagged with an error and AS_EIO flag set in the inode's imapping. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b91a171..aef0fa3 100644

[PATCH 1/2] Btrfs: report error after failure inlining extent in compressed write path

2014-10-09 Thread Filipe Manana
starting at the patch titled: [1/5] Btrfs: set page and mapping error on compressed write failure Which changed extent_clear_unlock_delalloc() to use SetPageError and mapping_set_error(). Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 1 + 1 file changed, 1 insertion

[PATCH 1/2] Btrfs: correctly flush compressed data before/after direct IO

2014-10-09 Thread Filipe Manana
-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/file.c | 12 +++- fs/btrfs/inode.c | 16 +--- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 29b147d..82c7229 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c

[PATCH 2/2] Btrfs: add helper btrfs_fdatawrite_range

2014-10-09 Thread Filipe Manana
To avoid duplicating this double filemap_fdatawrite_range() call for inodes with async extents (compressed writes) so often. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/ctree.h| 1 + fs/btrfs/file.c | 36 fs/btrfs/inode.c

[PATCH 2/2 v2] Btrfs: add helper btrfs_fdatawrite_range

2014-10-10 Thread Filipe Manana
To avoid duplicating this double filemap_fdatawrite_range() call for inodes with async extents (compressed writes) so often. Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Pass right arguments to the new helper. Missed unstaged changes. fs/btrfs/ctree.h| 1 + fs/btrfs/file.c

[PATCH 1/2 v2] Btrfs: report error after failure inlining extent in compressed write path

2014-10-10 Thread Filipe Manana
starting at the patch titled: [1/5] Btrfs: set page and mapping error on compressed write failure Which changed extent_clear_unlock_delalloc() to use SetPageError and mapping_set_error(). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Use SET_PAGE_ERROR only if ret 0, obviously. Thanks

[PATCH 1/3] Btrfs: deal with convert_extent_bit errors to avoid fs corruption

2014-10-13 Thread Filipe Manana
from disk or the content of some node/leaf from a past generation that got cowed or deleted and is no longer valid (for this later case we end up getting error messages like parent transid verify failed on X wanted Y found Z when reading btree nodes/leafs from disk). Signed-off-by: Filipe Manana

[PATCH 3/3] Btrfs: avoid returning -ENOMEM in convert_extent_bit() too early

2014-10-13 Thread Filipe Manana
. Therefore just don't return -ENOMEM if we can't allocate the temporary extent state, since we might not need it at all, and if we end up needing one, we'll do it later anyway. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/extent_io.c | 11 ++- 1 file changed, 10 insertions

[PATCH 2/3] Btrfs: make find_first_extent_bit be able to cache any state

2014-10-13 Thread Filipe Manana
returning -ENOMEM in convert_extent_bit() too early) will help reduce significantly the chances of calls to convert_extent_bit() fail with -ENOMEM when called from the transaction/log commit code. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/extent_io.c | 16 fs/btrfs

[PATCH] Revert Btrfs: race free update of commit root for ro snapshots

2014-10-15 Thread Filipe Manana
test for xfstests will follow soon. Cc: sta...@vger.kernel.org # 3.17 Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/inode.c | 36 fs/btrfs/ioctl.c | 33 + 2 files changed, 33 insertions(+), 36 deletions(-) diff

[PATCH] fstests: btrfs: regression test for ro snapshot creation

2014-10-15 Thread Filipe Manana
9c3b306e1c9e6be4be09e99a8fe2227d1005effc Signed-off-by: Filipe Manana fdman...@suse.com --- tests/btrfs/078 | 85 + tests/btrfs/078.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 88 insertions(+) create mode 100755 tests

[PATCH] Btrfs-progs: check, fix return value check of is_child_root()

2014-10-15 Thread Filipe Manana
value on error. This affects only the 3.17 release candidates (3.16 and older releases don't have this issue). Signed-off-by: Filipe Manana fdman...@suse.com --- cmds-check.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmds-check.c b/cmds-check.c index 99d1a94..002d3e9

[PATCH v2] Btrfs-progs: check, fix return value check of is_child_root()

2014-10-15 Thread Filipe Manana
. This affects only the 3.17 release candidates (3.16 and older releases don't have this issue). Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Made it return 2 (instead of -1) when the root child_root_id doesn't have any parent roots, in order to behave exactly like the code pre

[PATCH] Btrfs-progs: check, ability to detect and fix outdated snapshot root items

2014-10-17 Thread Filipe Manana
csum bytes: 130824 total tree bytes: 601620480 total fs tree bytes: 580288512 total extent tree bytes: 18464768 btree space waste bytes: 136939144 file data blocks allocated: 34150318080 referenced 27815415808 Btrfs v3.17-rc3-2-gbbe1dd8 $ echo $? 0 Signed-off-by: Filipe Manana

Re: [GIT PULL] Btrfs for stable (mostly 3.17)

2014-10-20 Thread Filipe Manana
On 10/20/2014 12:13 AM, Greg KH wrote: On Sun, Oct 19, 2014 at 09:55:11PM +0200, Greg KH wrote: On Sun, Oct 19, 2014 at 06:01:16AM -0400, Chris Mason wrote: Hi everyone, I've pulled out some of the btrfs commits from the merge window that we'd like to see in stable. The full list of sha's

[PATCH] Btrfs: ensure send always works on roots without orphans

2014-10-21 Thread Filipe Manana
will not get a commit root that differs from the main root (that has orphan items). Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/ioctl.c | 29 - fs/btrfs/send.c | 49 + 2 files changed, 49 insertions(+), 29 deletions

[PATCH] Btrfs: fix snapshot inconsistency after a file write followed by truncate

2014-10-21 Thread Filipe Manana
writes were captured 4) both writes and the truncation were captured But never capture a state where only the first write and the truncation were captured (since the second write was performed before the truncation). A test case for xfstests follows. Signed-off-by: Filipe Manana fdman...@suse.com

[PATCH] fstests: btrfs, add test for snapshoting after file write + truncate

2014-10-21 Thread Filipe Manana
a file write followed by truncate Signed-off-by: Filipe Manana fdman...@suse.com --- tests/btrfs/080 | 152 tests/btrfs/080.out | 2 + tests/btrfs/group | 1 + 3 files changed, 155 insertions(+) create mode 100755 tests/btrfs/080

[PATCH] fstests: btrfs, add regression test for clone ioctl

2014-10-21 Thread Filipe Manana
. This affected only buffered reads (i.e. didn't affect direct IO reads). This issue was fixed by the following linux kernel patch: Btrfs: ensure readers see new data after a clone operation (commit c125b8bff1d9f6c8c91ce4eb8bd5616058c7d510) Signed-off-by: Filipe Manana fdman...@suse.com --- tests

[PATCH v2] fstests: btrfs, add test for snapshoting after file write + truncate

2014-10-26 Thread Filipe Manana
a file write followed by truncate Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Added some background processes to cause some cpu load. This makes the test fail always on environments with a non-debug kernel and where no other significant load (other the test itself) is running

[PATCH] Btrfs: fix invalid leaf slot access in btrfs_lookup_extent()

2014-10-27 Thread Filipe Manana
it. Since btrfs_lookup_extent() is only used to find extent items for data extents, fix this by removing completely the logic that looks up for an equivalent skinny metadata item, since it can not exist. Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/extent-tree.c | 8 +--- 1 file

[PATCH] Btrfs: fix race that makes btrfs_lookup_extent_info miss skinny extent items

2014-10-27 Thread Filipe Manana
in the tree (i.e. no left siblings for our leaf), in which case the re-search logic isn't needed as well. This race has been present since the introduction of skinny metadata (change 3173a18f70554fe7880bb2d85c7da566e364eb3c). Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/extent-tree.c

[PATCH v2] Btrfs: fix invalid leaf slot access in btrfs_lookup_extent()

2014-10-27 Thread Filipe Manana
it. Since btrfs_lookup_extent() is only used to find extent items for data extents, fix this by removing completely the logic that looks up for an equivalent skinny metadata item, since it can not exist. Signed-off-by: Filipe Manana fdman...@suse.com --- V2: Renamed btrfs_lookup_extent

[PATCH v2] Btrfs: fix snapshot inconsistency after a file write followed by truncate

2014-10-28 Thread Filipe Manana
writes were captured 4) both writes and the truncation were captured But never capture a state where only the first write and the truncation were captured (since the second write was performed before the truncation). A test case for xfstests follows. Signed-off-by: Filipe Manana fdman...@suse.com

[PATCH v3] Btrfs: fix snapshot inconsistency after a file write followed by truncate

2014-10-29 Thread Filipe Manana
writes were captured 4) both writes and the truncation were captured But never capture a state where only the first write and the truncation were captured (since the second write was performed before the truncation). A test case for xfstests follows. Signed-off-by: Filipe Manana fdman...@suse.com

[PATCH v4] Btrfs: fix snapshot inconsistency after a file write followed by truncate

2014-10-29 Thread Filipe Manana
writes were captured 4) both writes and the truncation were captured But never capture a state where only the first write and the truncation were captured (since the second write was performed before the truncation). A test case for xfstests follows. Signed-off-by: Filipe Manana fdman...@suse.com

[PATCH] Btrfs: fix freeing used extent after removing empty block group

2014-11-03 Thread Filipe Manana
doing a lookup for a block group's cache object in unpin_extent_range() if a new block group didn't end up being allocated for the same chunk (step 4 above). Fix this by not freeing the block group and chunk if we fail to clear the dirty bit. Signed-off-by: Filipe Manana fdman...@suse.com --- fs

[PATCH] Btrfs: avoid premature -ENOMEM in clear_extent_bit()

2014-11-03 Thread Filipe Manana
is a bit excessive since we might end up not needing the pre-allocated extent state at all - for the case where the tree doesn't have any extent states that cover the input range and cover too any other range. Therefore don't return -ENOMEM if that pre-allocation fails. Signed-off-by: Filipe Manana

[PATCH] Btrfs: fix race when cleaning unused block groups

2014-11-05 Thread Filipe Manana
-by: Filipe Manana fdman...@suse.com --- fs/btrfs/ctree.h | 1 + fs/btrfs/disk-io.c | 1 + fs/btrfs/extent-tree.c | 5 +++-- fs/btrfs/transaction.c | 5 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 36f82ba..a5e471a 100644

[PATCH] Btrfs: avoid crash when overflowing a dir_item

2014-11-07 Thread Filipe Manana
-by: Filipe Manana fdman...@suse.com --- fs/btrfs/dir-item.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c index fc8df86..65bf60e 100644 --- a/fs/btrfs/dir-item.c +++ b/fs/btrfs/dir-item.c @@ -53,6 +53,8 @@ static struct btrfs_dir_item

[PATCH] Btrfs: make xattr replace operations atomic

2014-11-07 Thread Filipe Manana
Oliva for reporting the non-atomicity of the xattr replace implementation. Reported-by: Alexandre Oliva ol...@gnu.org Signed-off-by: Filipe Manana fdman...@suse.com --- fs/btrfs/ctree.h| 4 ++ fs/btrfs/dir-item.c | 10 ++-- fs/btrfs/xattr.c| 142

[PATCH] fstests: add generic test to verify xattr replace operations are atomic

2014-11-07 Thread Filipe Manana
and listxattrs) not getting neither the old nor the new value during a short time window. Signed-off-by: Filipe Manana fdman...@suse.com --- tests/generic/326 | 107 ++ tests/generic/326.out | 2 + tests/generic/group | 1 + 3 files changed, 110

  1   2   3   4   5   6   7   8   >