[PATCH] Btrfs-progs: Add missing free() against fs_info-super_copy

2013-05-25 Thread Filipe David Borba Manana
There was a missing free() call against fs_info-super_copy in several places: 1) close_ctree() 2) open_ctree_broken() on failure 3) __open_ctree_fd() on failure Filipe David Borba Manana (1): Btrfs-progs: Add missing free() against fs_info-super_copy btrfs-find-root.c |4 ++-- disk

[PATCH] Btrfs-progs: Add missing free() against fs_info-super_copy

2013-05-25 Thread Filipe David Borba Manana
There was a missing free() call against fs_info-super_copy in several places: 1) close_ctree() 2) open_ctree_broken() on failure 3) __open_ctree_fd() on failure Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- btrfs-find-root.c |4 ++-- disk-io.c |5 +++-- 2

[PATCH] Btrfs-progs: Add missing free() against fs_info-super_copy

2013-05-25 Thread Filipe David Borba Manana
There was a missing free() call against fs_info-super_copy in several places: 1) close_ctree() 2) open_ctree_broken() on failure 3) __open_ctree_fd() on failure Filipe David Borba Manana (1): Btrfs-progs: Add missing free() against fs_info-super_copy btrfs-find-root.c |5 +++-- disk

[PATCH] Btrfs-progs: Add missing free() against fs_info-super_copy

2013-05-25 Thread Filipe David Borba Manana
There was a missing free() call against fs_info-super_copy in several places: 1) close_ctree() 2) open_ctree_broken() on failure 3) __open_ctree_fd() on failure Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- btrfs-find-root.c |5 +++-- disk-io.c |6 -- 2

[PATCH] Btrfs-progs: Validate super block checksum

2013-05-29 Thread Filipe David Borba Manana
After finding a super block in a device also validate its checksum. This validation is done in the kernel but it was missing in btrfs-progs. The function btrfs_check_super_csum() is imported from the file fs/btrfs/disk-io.c in the kernel source tree. Signed-off-by: Filipe David Borba Manana

[PATCH 0/5] Btrfs-progs: coalesce of patches

2013-06-10 Thread Filipe David Borba Manana
Some fixes and minor enhancements. Filipe David Borba Manana (5): Btrfs-progs: fix closing of devices Btrfs-progs: Add missing free_extent_buffer() call to debug-tree Btrfs-progs: Add missing close_ctree() calls to debug-tree Btrfs-progs: pretty print dir_item type Btrfs-progs: Validate

[PATCH 4/5] Btrfs-progs: pretty print dir_item type

2013-06-10 Thread Filipe David Borba Manana
Instead of printing an integer, print a symbolic name which is more human friendly. Particularly useful when using the program btrfs-debug-tree. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- print-tree.c | 40 +++- 1 file changed, 39

[PATCH 3/5] Btrfs-progs: Add missing close_ctree() calls to debug-tree

2013-06-10 Thread Filipe David Borba Manana
Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- btrfs-debug-tree.c |9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c index 97459b1..74d4d66 100644 --- a/btrfs-debug-tree.c +++ b/btrfs-debug-tree.c @@ -195,10

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

2013-06-10 Thread Filipe David Borba Manana
:1276 #2 0x00421dcd in close_ctree (root=optimized out) at disk-io.c:1336 #3 0x00418cfa in cmd_check (argc=optimized out, argv=optimized out) at cmds-check.c:4171 #4 0x00403ed4 in main (argc=2, argv=0x7fff9a583d28) at btrfs.c:295 Signed-off-by: Filipe David Borba

[PATCH 2/5] Btrfs-progs: Add missing free_extent_buffer() call to debug-tree

2013-06-10 Thread Filipe David Borba Manana
Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- btrfs-debug-tree.c |1 + 1 file changed, 1 insertion(+) diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c index bae7f94..97459b1 100644 --- a/btrfs-debug-tree.c +++ b/btrfs-debug-tree.c @@ -355,6 +355,7 @@ again

[PATCH 5/5] Btrfs-progs: Validate super block checksum

2013-06-10 Thread Filipe David Borba Manana
After finding a super block in a device also validate its checksum. This validation is done in the kernel but it was missing in btrfs-progs. The function btrfs_check_super_csum() is imported from the file fs/btrfs/disk-io.c in the kernel source tree. Signed-off-by: Filipe David Borba Manana

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

2013-06-10 Thread Filipe David Borba Manana
:1276 #2 0x00421dcd in close_ctree (root=optimized out) at disk-io.c:1336 #3 0x00418cfa in cmd_check (argc=optimized out, argv=optimized out) at cmds-check.c:4171 #4 0x00403ed4 in main (argc=2, argv=0x7fff9a583d28) at btrfs.c:295 Signed-off-by: Filipe David Borba

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

2013-06-10 Thread Filipe David Borba Manana
-by: Filipe David Borba Manana fdman...@gmail.com --- disk-io.c |4 ++-- volumes.c |5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/disk-io.c b/disk-io.c index 21b410d..bd9cf4e 100644 --- a/disk-io.c +++ b/disk-io.c @@ -1267,12 +1267,12 @@ static int close_all_devices(struct

[PATCH v2 5/5] Btrfs-progs: Validate super block checksum

2013-06-26 Thread Filipe David Borba Manana
. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- btrfs-debug-tree.c |2 +- btrfs-find-root.c |8 ++-- cmds-check.c |2 +- cmds-device.c |2 +- cmds-filesystem.c |2 +- cmds-replace.c |2 +- cmds-restore.c |2 +- disk-io.c | 103

[PATCH 0/3] Small fixes for btrfs-progs

2013-06-30 Thread Filipe David Borba Manana
1) add missing write check for mkfs 2) add kstrdup() return value check 3) remove unused code in btrfs_scan_one_device() Filipe David Borba Manana (3): Btrfs-progs: add missing write check for mkfs Btrfs-progs: add kstrdup() return value check Btrfs-progs: remove unused code

[PATCH 2/3] Btrfs-progs: add kstrdup() return value check

2013-06-30 Thread Filipe David Borba Manana
When allocating a btrfs_device structure, device_list_add() in volumes.c was not checking if the call to duplicate the label string succeeded or not. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- volumes.c |5 + 1 file changed, 5 insertions(+) diff --git a/volumes.c b

[PATCH 1/3] Btrfs-progs: add missing write check for mkfs

2013-06-30 Thread Filipe David Borba Manana
-by: Filipe David Borba Manana fdman...@gmail.com --- utils.c |1 + 1 file changed, 1 insertion(+) diff --git a/utils.c b/utils.c index 7b4cd74..43d93f1 100644 --- a/utils.c +++ b/utils.c @@ -381,6 +381,7 @@ int make_btrfs(int fd, const char *device, const char *label

[PATCH 3/3] Btrfs-progs: remove unused code

2013-06-30 Thread Filipe David Borba Manana
The uuid_unparse() call in btrfs_scan_one_device() was a no-op. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- volumes.c |2 -- 1 file changed, 2 deletions(-) diff --git a/volumes.c b/volumes.c index ea1d401..9d5e97e 100644 --- a/volumes.c +++ b/volumes.c @@ -223,7 +223,6

[PATCH] Btrfs: optimize function btrfs_read_chunk_tree

2013-07-03 Thread Filipe David Borba Manana
chunk item has a key that has this object id. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/volumes.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index b2d1eac..4e969db 100644 --- a/fs/btrfs

[PATCH] Btrfs-progs: fix check in btrfs_lookup_extent_info()

2013-07-03 Thread Filipe David Borba Manana
We want to test if path-slots[0] is greater than zero. Testing for path-slots was a logical error, as it corresponds to a memory address (start of fixed array) and therefore is always non-zero. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c |2 +- 1 file

[PATCH v2 3/3] Btrfs-progs: remove unused code

2013-07-03 Thread Filipe David Borba Manana
V2: removed unused statement in extent-cache.c:tree_insert() too. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-cache.c |1 - volumes.c |2 -- 2 files changed, 3 deletions(-) diff --git a/extent-cache.c b/extent-cache.c index 3dd6434..a8bab59 100644

[PATCH v2 1/3] Btrfs-progs: add missing write check for mkfs

2013-07-03 Thread Filipe David Borba Manana
likely some weird failure later on in mkfs.btrfs inside open_ctree(). V2: Added check for the chunk tree root write. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- utils.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/utils.c b/utils.c index 7b4cd74..702a0b1 100644

[PATCH 4/5] Btrfs-progs: return error on write failure in make_btrfs()

2013-07-04 Thread Filipe David Borba Manana
Instead of aborting with a BUG_ON() statement, return a negated errno code. Also updated mkfs and convert tools to print a nicer error message when make_btrfs() returns an error. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- btrfs-convert.c |3 ++- mkfs.c |2

[PATCH v2 0/5] Small fixes for btrfs-progs

2013-07-04 Thread Filipe David Borba Manana
1) add missing write checks for mkfs 2) add kstrdup() return value check 3) remove unused code 4) make_btrfs() return error code on write failure 5) check for errors in btrfs_add_block_group() V2: added patches 4 and 5. Filipe David Borba Manana (5): Btrfs-progs: add missing write check

[PATCH 5/5] Btrfs-progs: don't ignore errors in btrfs_add_block_group()

2013-07-04 Thread Filipe David Borba Manana
This function was not checking if the calls to set_extent_bits() and set_state_private() actually succeeded or not. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/extent-tree.c b

[PATCH] Btrfs-progs: fix optimization in btrfs_lookup_extent_info

2013-07-04 Thread Filipe David Borba Manana
). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index b0cfe0a..22e6247 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -1515,12 +1515,13 @@ again

[PATCH v2] Btrfs-progs: fix optimization in btrfs_lookup_extent_info

2013-07-04 Thread Filipe David Borba Manana
). V2: If previous leaf item is for a different object, ensure the search key has the target object id. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index

[PATCH] Btrfs-progs: remove incorrect slot decrement

2013-07-05 Thread Filipe David Borba Manana
before. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extent-tree.c b/extent-tree.c index 381572d..5b6c7aa 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -1609,7 +1609,7 @@ again

[PATCH] Btrfs: optimize btrfs_lookup_extent_info()

2013-07-05 Thread Filipe David Borba Manana
it. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/extent-tree.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 0236de7..dd8c7f3 100644 --- a/fs/btrfs/extent-tree.c +++ b

[PATCH v3] Btrfs-progs: fix optimization in btrfs_lookup_extent_info

2013-07-05 Thread Filipe David Borba Manana
). V2: If previous leaf item is for a different object, ensure the search key has the target object id. V3: Added Josef Bacik's review mention. Reviewed-by: Josef Bacik jba...@fusionio.com Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c |6 -- 1 file changed, 4

[PATCH v2] Btrfs-progs: remove incorrect slot decrement

2013-07-05 Thread Filipe David Borba Manana
before. V2: Added Josef Bacik's review mention. Reviewed-by: Josef Bacik jba...@fusionio.com Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extent-tree.c b/extent-tree.c index f597e16..e04160b

[PATCH v2] Btrfs: optimize btrfs_lookup_extent_info()

2013-07-05 Thread Filipe David Borba Manana
it. This optimization is already done by btrfs-progs. V2: updated commit message. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/extent-tree.c | 21 + 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs

[PATCH] Btrfs-progs: optimize function btrfs_read_chunk_tree

2013-07-05 Thread Filipe David Borba Manana
chunk item has a key that has this object id. This is a port of the corresponding kernel patch to keep both kernel and btrfs-progs identical: https://patchwork.kernel.org/patch/2816401/ Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- volumes.c |9 +++-- 1 file changed, 7

[PATCH] Btrfs-progs: add missing path release

2013-07-09 Thread Filipe David Borba Manana
Before repeating the search in extent-tree.c:lookup_inline_extent_backref(), release the current path. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c |1 + 1 file changed, 1 insertion(+) diff --git a/extent-tree.c b/extent-tree.c index f597e16..ba357de 100644

[PATCH 1/2] Btrfs-progs: remove duplicated code in cmds-restore.c

2013-07-09 Thread Filipe David Borba Manana
The module cmds-restore.c was defining its own next_leaf() function, which did exactly the same as btrfs_next_leaf() from ctree.c. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- cmds-restore.c | 62 +--- 1 file changed, 5

[PATCH 2/2] Btrfs-progs: remove unneeded leaf checks in cmds-restore

2013-07-09 Thread Filipe David Borba Manana
If btrfs_search_slot() returns a value = 0, then we can be sure that path-nodes[i] is not NULL for each i between 0 to tree height - 1. The function btrfs_next_leaf() also ensures any path-nodes[i] is not NULL as long as it returns 0. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com

[PATCH 0/2] Remove duplicated and useless code in cmds-restore

2013-07-09 Thread Filipe David Borba Manana
The following patch series are just a cleanup for cmds-restore.c, removing some duplicated code and code that never gets executed. Filipe David Borba Manana (2): Btrfs-progs: remove duplicated code in cmds-restore.c Btrfs-progs: remove unneeded leaf checks in cmds-restore cmds-restore.c

[PATCH] Btrfs-progs: update usage message for cmds-restore

2013-07-09 Thread Filipe David Borba Manana
a target path, the command works as expected: $ btrfs restore -v /dev/sdb3 files2/ Restoring files2/file1 Done searching $ echo $? 0 Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- cmds-restore.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmds-restore.c b

[PATCH v2] Btrfs-progs: update usage message for cmds-restore

2013-07-10 Thread Filipe David Borba Manana
a target path, the command works as expected: $ btrfs restore -v /dev/sdb3 files2/ Restoring files2/file1 Done searching $ echo $? 0 V2: Updated command synopsis by suggestion of Anand Jain. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- cmds-restore.c |3 ++- 1 file changed, 2

[PATCH] Btrfs-progs: fix restore command leaving corrupted files

2013-07-10 Thread Filipe David Borba Manana
); assert(close(fd) == 0); return 0; } Tested this change with zlib, lzo compression and file sizes larger than 1GiB, and found no regression or other corruption issues (so far at least). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- cmds-restore.c | 13

[PATCH v2] Btrfs-progs: fix restore command leaving corrupted files

2013-07-10 Thread Filipe David Borba Manana
and file sizes larger than 1GiB, and found no regression or other corruption issues (so far at least). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: updated commit message to include the C preprocessor macros in the C program. cmds-restore.c | 13 - 1 file

[PATCH v3] Btrfs-progs: fix restore command leaving corrupted files

2013-07-10 Thread Filipe David Borba Manana
this change with zlib, lzo compression and file sizes larger than 1GiB, and found no regression or other corruption issues (so far at least). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: updated commit message to include the C preprocessor macros in the C program. V3

[PATCH v4] Btrfs-progs: fix restore command leaving corrupted files

2013-07-10 Thread Filipe David Borba Manana
this change with zlib, lzo compression and file sizes larger than 1GiB, and found no regression or other corruption issues (so far at least). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: updated commit message to include the C preprocessor macros in the C program. V3

[PATCH] Btrfs-progs: restore can now recover file xattrs

2013-07-10 Thread Filipe David Borba Manana
This change adds a new option to the restore command, named -x, that makes it restore file extented attributes too. This is an optional behaviour and it's disabled by default. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- cmds-restore.c | 113

[PATCH v2] Btrfs-progs: restore can now recover file xattrs

2013-07-10 Thread Filipe David Borba Manana
This change adds a new option to the restore command, named -x, that makes it restore file extented attributes too. This is an optional behaviour and it's disabled by default. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: added missing new line at end of error message

[PATCH v3] Btrfs-progs: restore can now recover file xattrs

2013-07-10 Thread Filipe David Borba Manana
This change adds a new option to the restore command, named -x, that makes it restore file extented attributes too. This is an optional behaviour and it's disabled by default. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: added missing new line at end of error message. V3

[PATCH v4] Btrfs-progs: restore can now recover file xattrs

2013-07-10 Thread Filipe David Borba Manana
This change adds a new option to the restore command, named -x, that makes it restore file extented attributes too. This is an optional behaviour and it's disabled by default. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: added missing new line at end of error message. V3

[PATCH v6] Btrfs-progs: fix restore command leaving corrupted files

2013-07-12 Thread Filipe David Borba Manana
, and found no regression or other corruption issues (so far at least). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: updated commit message to include the C preprocessor macros in the sample C program. V3: updated commit message again to reflect the file size used

[PATCH] Btrfs: add missing error checks to add_data_references

2013-07-13 Thread Filipe David Borba Manana
The function relocation.c:add_data_references() was not checking if all calls to __add_tree_block() and find_data_references() were succeeding or not. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/relocation.c |7 ++- 1 file changed, 6 insertions(+), 1 deletion

[PATCH v3] Btrfs: optimize btrfs_lookup_extent_info()

2013-07-13 Thread Filipe David Borba Manana
it. This optimization is already done by btrfs-progs. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: updated commit message to mention this is already done in btrfs-progs. V3: moved version information out of the commit message, as David Sterba notified me

[PATCH] Btrfs-progs: add missing path alloc return value check

2013-07-19 Thread Filipe David Borba Manana
Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- extent-tree.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/extent-tree.c b/extent-tree.c index f597e16..8e93bab 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -1577,6 +1577,8 @@ int btrfs_set_block_flags(struct

[PATCH v2] Btrfs: optimize function btrfs_read_chunk_tree

2013-07-29 Thread Filipe David Borba Manana
in the chunks tree. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Simplified logic inside the loop (suggested by Josef Bacik on irc). fs/btrfs/volumes.c | 30 ++ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs

[PATCH v2] Btrfs-progs: optimize function btrfs_read_chunk_tree

2013-07-29 Thread Filipe David Borba Manana
in the chunks tree. This is a port of the corresponding kernel patch to keep both kernel and btrfs-progs identical: https://patchwork.kernel.org/patch/2835105/ Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Simplified logic inside the loop (suggested by Josef Bacik on irc

[PATCH] Btrfs-progs: return immediately on tree search failure

2013-07-29 Thread Filipe David Borba Manana
If the chunk tree search failed in volumes.c:btrfs_read_chunk_tree() return immediately, rather than looping and use the invalid contents of the path structure, causing weird errors/crash at run time. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- volumes.c |2 ++ 1 file

[PATCH v2] Btrfs-progs: add missing path alloc return value check

2013-07-29 Thread Filipe David Borba Manana
Also remove unused path in extent-tree.c:finish_current_insert(). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: added 1 more path alloc check and removed unnecessary path allocation in extent-tree.c:finish_current_insert(). extent-tree.c |8 1 file

[PATCH v3] Btrfs-progs: add missing path alloc return value check

2013-07-29 Thread Filipe David Borba Manana
Also remove unused path in extent-tree.c:finish_current_insert(). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: added 1 more path alloc check and removed unnecessary path allocation in extent-tree.c:finish_current_insert(). V3: added missing path alloc checks to dir

[PATCH v3] Btrfs: optimize function btrfs_read_chunk_tree

2013-07-30 Thread Filipe David Borba Manana
in the chunks tree. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Simplified logic inside the loop (suggested by Josef Bacik on irc). V3: Updated comment to comply with kernel coding style. fs/btrfs/volumes.c | 30 +++--- 1 file changed, 11 insertions

[PATCH v3] Btrfs-progs: optimize function btrfs_read_chunk_tree

2013-07-30 Thread Filipe David Borba Manana
in the chunks tree. This is a port of the corresponding kernel patch to keep both kernel and btrfs-progs identical: https://patchwork.kernel.org/patch/2835529/ Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Simplified logic inside the loop (suggested by Josef Bacik on irc). V3

[PATCH v4] Btrfs-progs: add missing path alloc return value check

2013-07-30 Thread Filipe David Borba Manana
Also remove unused path in extent-tree.c:finish_current_insert(). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: added 1 more path alloc check and removed unnecessary path allocation in extent-tree.c:finish_current_insert(). V3: added missing path alloc checks to dir

[PATCH] Btrfs: add missing error check to find_parent_nodes

2013-07-30 Thread Filipe David Borba Manana
Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/backref.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 8bc5e8c..1ba87c5 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -935,6 +935,8 @@ again

[PATCH v2] Btrfs: add missing error check to find_parent_nodes

2013-07-30 Thread Filipe David Borba Manana
Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Ensure extent buffer is freed on error. fs/btrfs/backref.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 8bc5e8c..980e85a 100644 --- a/fs/btrfs

[PATCH] Btrfs: add missing error handling to read_tree_block

2013-07-30 Thread Filipe David Borba Manana
Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/disk-io.c |4 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 254cdc8..b71e882 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1148,6 +1148,10 @@ struct

[PATCH v5] Btrfs-progs: restore can now recover file xattrs

2013-08-03 Thread Filipe David Borba Manana
This change adds a new option to the restore command, named -x, that makes it restore file extented attributes too. This is an optional behaviour and it's disabled by default. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Added missing new line at end of error message. V3

[PATCH] Btrfs: race free update of super flags

2013-08-03 Thread Filipe David Borba Manana
Before updating the super block's flags, which is a non-atomic operation, grab the super_lock in the fs_info structure. At the moment only 2 different code paths can update these flags in parallel: 1) when adding a new device 2) writing all super block copies to disk Signed-off-by: Filipe David

[PATCH v6] Btrfs-progs: restore can now recover file xattrs

2013-08-04 Thread Filipe David Borba Manana
This change adds a new option to the restore command, named -x, that makes it restore file extented attributes too. This is an optional behaviour and it's disabled by default. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Added missing new line at end of error message. V3

[PATCH] Btrfs: don't ignore errors from btrfs_run_delayed_items

2013-08-04 Thread Filipe David Borba Manana
tree-log.c was ignoring the return value from btrfs_run_delayed_items() in several places. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/tree-log.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree

[PATCH v2] Btrfs: don't ignore errors from btrfs_run_delayed_items

2013-08-05 Thread Filipe David Borba Manana
tree-log.c was ignoring the return value from btrfs_run_delayed_items() in several places. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Ensure no line exceeds 80 characters. fs/btrfs/tree-log.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff

[PATCH] Btrfs: return ENOSPC when target space is full

2013-08-05 Thread Filipe David Borba Manana
. This was inconsistent, as -ENOSPC should be returned if the space is full and a chunk allocation needs to performed. If the space is full but no chunk allocation is needed, just return 0 (success). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/extent-tree.c |6 +- 1 file

[PATCH RFC] Btrfs-progs: allow btrfstune to set persistent mount options

2013-08-06 Thread Filipe David Borba Manana
This is the complement to the corresponding kernel patch that adds support for permanent options. NOTE: Like the corresponding kernel patch, this is a WIP with the goal o gathering feedback. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- btrfstune.c | 105

[PATCH RFC] Btrfs: track compression algorithm on inodes

2013-08-07 Thread Filipe David Borba Manana
at: https://patchwork.kernel.org/patch/2839534/ Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/btrfs_inode.h | 10 +- fs/btrfs/ctree.h | 12 +++- fs/btrfs/delayed-inode.c |3 +++ fs/btrfs/inode.c | 20 ++-- fs/btrfs

[PATCH] Btrfs: fix race between removing a dev and writing sbs

2013-08-08 Thread Filipe David Borba Manana
happen. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/disk-io.c |2 +- fs/btrfs/volumes.c | 11 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 254cdc8..c4b24c7 100644 --- a/fs/btrfs/disk-io.c

[PATCH] Btrfs: set default max_inline to 8KiB instead of 8MiB

2013-08-08 Thread Filipe David Borba Manana
8MiB is way too large and likely set by mistake. This is not a significant issue as in practice the max amount of data added to an inline extent is also limited by the page cache and btree leaf sizes. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/disk-io.c |2

[PATCH v2] Btrfs: fix race between removing a dev and writing sbs

2013-08-09 Thread Filipe David Borba Manana
-io.c:next_root_backup(), called by open_ctree() during mount time where concurrency issues can't happen. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Restored Stefan Behrens's comment as it's about a different issue, and updated the commit message to be more detailed. fs

[PATCH] Btrfs: fix race conditions in BTRFS_IOC_FS_INFO ioctl

2013-08-12 Thread Filipe David Borba Manana
and others part of the new fsid). Also, it could read a number of devices that doesn't match the number of devices in the list and the max device id, as explained before. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ioctl.c |2 +- fs/btrfs/volumes.c |5

[PATCH 0/2] BTRFS_IOC_INO_LOOKUP ioctl fixes

2013-08-13 Thread Filipe David Borba Manana
This set of patches fixes 2 issues with the BTRFS_IOC_INO_LOOKUP ioctl: 1) missing error code return when path is too long; 2) ocassional ENOENT error even when the desired inode ref items exist. Filipe David Borba Manana (2): Btrfs: add missing error code to BTRFS_IOC_INO_LOOKUP handler

[PATCH] Btrfs: reset force_compress on btrfs_file_defrag failure

2013-08-16 Thread Filipe David Borba Manana
David Borba Manana fdman...@gmail.com --- fs/btrfs/ioctl.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 107c5f4..411dc0a 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1272,9 +1272,6 @@ int

[PATCH] Btrfs-progs: add restore command's -x flag to man page

2013-08-17 Thread Filipe David Borba Manana
This is a recent flag added to the restore command that allows to restore xattrs. It was missing in the man page. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- NOTE: this patch is based on top of David Sterba's integration branch integration-20130810. man/btrfs.8

[PATCH] Btrfs-progs: mkfs can now create fs with skinny extents

2013-08-17 Thread Filipe David Borba Manana
Before this change, passing -O skinny-metadata to mkfs.btrfs would only set the skinny metadata incompat flag in the super block after the filesystem was created. This change makes mkfs.btrfs directly create a filesystem with only skinny extents for metadata. Signed-off-by: Filipe David Borba

[PATCH v2] Btrfs-progs: mkfs can now create fs with skinny extents

2013-08-17 Thread Filipe David Borba Manana
Before this change, passing -O skinny-metadata to mkfs.btrfs would only set the skinny metadata incompat flag in the super block after the filesystem was created. This change makes mkfs.btrfs directly create a filesystem with only skinny extents for metadata. Signed-off-by: Filipe David Borba

[PATCH v2] Btrfs: fix memory leak of orphan block rsv

2013-08-19 Thread Filipe David Borba Manana
] 0x This affects btrfs-next, revision be8e3cd00d7293dd177e3f8a4a1645ce09ca3acb (Btrfs: separate out tests into their own directory). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: removed atomic_t member in struct btrfs_block_rsv, as suggested by Josef Bacik, and use

[PATCH v3] Btrfs: fix memory leak of orphan block rsv

2013-08-19 Thread Filipe David Borba Manana
be8e3cd00d7293dd177e3f8a4a1645ce09ca3acb (Btrfs: separate out tests into their own directory). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: removed atomic_t member in struct btrfs_block_rsv, as suggested by Josef Bacik, and use instead the condition reserved == 0 to decide

[PATCH v4] Btrfs: fix memory leak of orphan block rsv

2013-08-19 Thread Filipe David Borba Manana
be8e3cd00d7293dd177e3f8a4a1645ce09ca3acb (Btrfs: separate out tests into their own directory). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: removed atomic_t member in struct btrfs_block_rsv, as suggested by Josef Bacik, and use instead the condition reserved == 0 to decide

[PATCH v5] Btrfs: fix memory leak of orphan block rsv

2013-08-19 Thread Filipe David Borba Manana
be8e3cd00d7293dd177e3f8a4a1645ce09ca3acb (Btrfs: separate out tests into their own directory). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: removed atomic_t member in struct btrfs_block_rsv, as suggested by Josef Bacik, and use instead the condition reserved == 0 to decide

[PATCH v6] Btrfs: fix memory leak of orphan block rsv

2013-08-19 Thread Filipe David Borba Manana
be8e3cd00d7293dd177e3f8a4a1645ce09ca3acb (Btrfs: separate out tests into their own directory). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: removed atomic_t member in struct btrfs_block_rsv, as suggested by Josef Bacik, and use instead the condition reserved == 0 to decide

[PATCH] Btrfs: fix printing of non NULL terminated string

2013-08-20 Thread Filipe David Borba Manana
The name buffer is not terminated by a '\0' character, therefore it needs to be printed with %.*s and use the length of the buffer. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/delayed-inode.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git

[PATCH] Btrfs: fix memory leak of uuid_root in free_fs_info

2013-08-24 Thread Filipe David Borba Manana
Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ctree.h |1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index c90be01..742dea1 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3460,6 +3460,7 @@ static inline void

[RFC PATCH] Btrfs: WIP, fix broken ctree.c:btrfs_prev_leaf()

2013-08-26 Thread Filipe David Borba Manana
5093453824) The above fs tree was produced with the following code: $ mkfs.btrfs -f /dev/sdb3 $ mount /dev/sdb3 /mnt/btrfs $ dd if=/dev/zero of=/mnt/btrfs/foobar bs=4096 count=1000 $ umount /mnt/btrfs $ btrfs-debug-tree /dev/sdb3 Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs

[PATCH] Btrfs: fix deadlock in uuid scan kthread

2013-08-27 Thread Filipe David Borba Manana
] system_call_fastpath+0x16/0x1b Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/volumes.c | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index f42e412..44cd21b 100644 --- a/fs/btrfs/volumes.c +++ b/fs

[PATCH v2] Btrfs: fix deadlock in uuid scan kthread

2013-08-27 Thread Filipe David Borba Manana
] system_call_fastpath+0x16/0x1b Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Removed wrong assignment of NULL to transaction pointer, and addressed code style comment from Josef. fs/btrfs/volumes.c | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff

[PATCH v4] Btrfs: fix deadlock in uuid scan kthread

2013-08-27 Thread Filipe David Borba Manana
] system_call_fastpath+0x16/0x1b Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Removed wrong assignment of NULL to transaction pointer, and addressed code style comment from Josef. V3: Removed unnecessary if statement to check if trans is NULL, as it can't be NULL anymore in that section

[PATCH v5] Btrfs: fix deadlock in uuid scan kthread

2013-08-27 Thread Filipe David Borba Manana
] system_call_fastpath+0x16/0x1b Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Removed wrong assignment of NULL to transaction pointer, and addressed code style comment from Josef. V3: Removed unnecessary if statement to check if trans is NULL, as it can't be NULL anymore in that section

[PATCH v6] Btrfs: fix deadlock in uuid scan kthread

2013-08-27 Thread Filipe David Borba Manana
] system_call_fastpath+0x16/0x1b Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Removed wrong assignment of NULL to transaction pointer, and addressed code style comment from Josef. V3: Removed unnecessary if statement to check if trans is NULL, as it can't be NULL anymore in that section

[PATCH v7] Btrfs: fix deadlock in uuid scan kthread

2013-08-28 Thread Filipe David Borba Manana
] system_call_fastpath+0x16/0x1b Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Removed wrong assignment of NULL to transaction pointer, and addressed code style comment from Josef. V3: Removed unnecessary if statement to check if trans is NULL, as it can't be NULL anymore in that section

[PATCH] Btrfs: optimize key searches in btrfs_search_slot

2013-08-29 Thread Filipe David Borba Manana
:14 | 301.232 - 585.313: 1 | 585.313 - 8303.000: 1 | These samples were captured during a run of the btrfs tests 001, 002 and 004 in the xfstests, with a leaf/node size of 4Kb. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ctree.c | 61

[PATCH v2] Btrfs: optimize key searches in btrfs_search_slot

2013-08-29 Thread Filipe David Borba Manana
:14 | 301.232 - 585.313: 1 | 585.313 - 8303.000: 1 | These samples were captured during a run of the btrfs tests 001, 002 and 004 in the xfstests, with a leaf/node size of 4Kb. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Simplified code, removed unnecessary code

[PATCH v3] Btrfs: optimize key searches in btrfs_search_slot

2013-08-29 Thread Filipe David Borba Manana
:14 | 301.232 - 585.313: 1 | 585.313 - 8303.000: 1 | These samples were captured during a run of the btrfs tests 001, 002 and 004 in the xfstests, with a leaf/node size of 4Kb. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Simplified code, removed unnecessary code

[PATCH v4] Btrfs: optimize key searches in btrfs_search_slot

2013-08-29 Thread Filipe David Borba Manana
:14 | 301.232 - 585.313: 1 | 585.313 - 8303.000: 1 | These samples were captured during a run of the btrfs tests 001, 002 and 004 in the xfstests, with a leaf/node size of 4Kb. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Simplified code, removed unnecessary code

[PATCH v5] Btrfs: optimize key searches in btrfs_search_slot

2013-08-30 Thread Filipe David Borba Manana
- 100.087: 9 | 100.087 - 135.000: 6 | These samples were captured during a run of the btrfs tests 001, 002 and 004 in the xfstests, with a leaf/node size of 4Kb. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Simplified code, removed unnecessary code. V3: Replaced BUG_ON

[PATCH v6] Btrfs: optimize key searches in btrfs_search_slot

2013-08-31 Thread Filipe David Borba Manana
- 100.087: 9 | 100.087 - 135.000: 6 | These samples were captured during a run of the btrfs tests 001, 002 and 004 in the xfstests, with a leaf/node size of 4Kb. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com Signed-off-by: Josef Bacik jba...@fusionio.com --- V2: Simplified code

[PATCH] Btrfs: more efficient inode tree replace operation

2013-09-02 Thread Filipe David Borba Manana
Instead of removing the current inode from the red black tree and then add the new one, just use the red black tree replace operation, which is more efficient. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/inode.c | 10 +- 1 file changed, 5 insertions(+), 5

  1   2   3   4   >