[PATCH 3/3] btrfs-progs: convert: add support for converting reiserfs

2017-07-25 Thread jeffm
From: Jeff Mahoney This patch adds support to convert reiserfs file systems in-place to btrfs. It will convert extended attribute files to btrfs extended attributes, translate ACLs, coalesce tails that consist of multiple items into one item, and convert tails that are too big into indirect file

[PATCH 2/3] btrfs-progs: convert: add missing newlines for printfs

2017-07-25 Thread jeffm
From: Jeff Mahoney There are two printfs with missing newlines that end up making the output wonky. Signed-off-by: Jeff Mahoney --- convert/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/convert/main.c b/convert/main.c index c56382e..01657a6 100644 --- a/convert

[PATCH 1/7] btrfs-progs: check: supplement extent backref list with rbtree

2017-07-25 Thread jeffm
From: Jeff Mahoney For the pathlogical case, like xfstests generic/297 that creates a large file consisting of one, repeating reflinked extent, fsck can take hours. The root cause is that calling find_data_backref while iterating the extent records is an O(n^2) algorithm. For my example test ru

[PATCH 5/7] btrfs-progs: backref: add list_first_pref helper

2017-07-25 Thread jeffm
From: Jeff Mahoney --- backref.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backref.c b/backref.c index ac1b506..be3376a 100644 --- a/backref.c +++ b/backref.c @@ -130,6 +130,11 @@ struct __prelim_ref { u64 wanted_disk_byte; }; +static struct __pre

[PATCH 4/7] btrfs-progs: backref: push state tracking into a helper structure

2017-07-25 Thread jeffm
From: Jeff Mahoney Eventually, we'll have several lists and trees, as well as some statistics. Signed-off-by: Jeff Mahoney --- backref.c | 75 ++- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/backref.c b/backref.c i

[PATCH 2/7] btrfs-progs: check: switch to iterating over the backref_tree

2017-07-25 Thread jeffm
From: Jeff Mahoney We now have two data structures that can be used to iterate the same data set, and there may be quite a few of them in memory. Eliminating the list_head member will reduce memory consumption while iterating over the extent backrefs. Signed-off-by: Jeff Mahoney --- cmds-chec

[PATCH 7/7] btrfs-progs: backref: use separate list for indirect refs

2017-07-25 Thread jeffm
From: Jeff Mahoney Rather than iterate over all outstanding backrefs to resolve indirect refs, use a separate list that only contains indirect refs. When we process missing keys, the ref moves to the indirect ref list. Once the indirect ref is resolved, move the ref to the pending list. Eventua

[PATCH 3/7] btrfs-progs: extent-cache: actually cache extent buffers

2017-07-25 Thread jeffm
From: Jeff Mahoney We have the infrastructure to cache extent buffers but we don't actually do the caching. As soon as the last reference is dropped, the buffer is dropped. This patch keeps the extent buffers around until the max cache size is reached (defaults to 25% of memory) and then it dro

[PATCH 6/7] btrfs-progs: backref: use separate list for missing keys

2017-07-25 Thread jeffm
From: Jeff Mahoney Rather than iterate over all outstanding backrefs to resolve missing keys, use a separate list that only contains refs that need missing keys resolved. Once the missing key is resolved, move the ref to the pending list. Signed-off-by: Jeff Mahoney --- backref.c | 28 +++

[PATCH] btrfs-progs: quota: Add -W option to rescan to wait without starting rescan

2017-07-25 Thread jeffm
From: Jeff Mahoney This patch adds a new -W option to wait for a rescan without starting a new operation. This is useful for things like xfstests where we want do to do a "btrfs quota enable" and not continue until the subsequent rescan has finished. In addition to documenting the new option in

[PATCH v2 2/2] btrfs: Simplify math in should_alloc chunk

2017-06-22 Thread jeffm
From: Nikolay Borisov Currently should_alloc_chunk uses ->total_bytes - ->bytes_readonly to signify the total amount of bytes in this space info. However, given Jeff's patch which adds bytes_pinned and bytes_may_use to the calculation of num_allocated it becomes a lot more clear to just eliminate

[PATCH v2 1/2] btrfs: account for pinned bytes in should_alloc_chunk

2017-06-22 Thread jeffm
From: Jeff Mahoney In a heavy write scenario, we can end up with a large number of pinned bytes. This can translate into (very) premature ENOSPC because pinned bytes must be accounted for when allowing a reservation but aren't accounted for when deciding whether to create a new chunk. This patch

[PATCH] btrfs: add cond_resched to btrfs_qgroup_trace_leaf_items

2017-06-20 Thread jeffm
From: Jeff Mahoney On an uncontended system, we can end up hitting soft lockups while doing replace_path. At the core, and frequently called is btrfs_qgroup_trace_leaf_items, so it makes sense to add a cond_resched there. Signed-off-by: Jeff Mahoney --- fs/btrfs/qgroup.c | 1 + 1 file changed

[PATCH 2/2] btrfs: Simplify math in should_alloc chunk

2017-06-14 Thread jeffm
From: Nikolay Borisov Currently should_alloc_chunk uses ->total_bytes - ->bytes_readonly to signify the total amount of bytes in this space info. However, given Jeff's patch which adds bytes_pinned and bytes_may_use to the calculation of num_allocated it becomes a lot more clear to just eliminate

[PATCH 1/2] btrfs: account for pinned bytes and bytes_may_use in should_alloc_chunk

2017-06-14 Thread jeffm
From: Jeff Mahoney In a heavy write scenario, we can end up with a large number of pinned bytes. This can translate into (very) premature ENOSPC because pinned bytes must be accounted for when allowing a reservation but aren't accounted for when deciding whether to create a new chunk. This patc

[PATCH 3/3] btrfs: remove root usage from can_overcommit

2017-05-17 Thread jeffm
From: Jeff Mahoney can_overcommit using the root to determine the allocation profile is the only use of a root in the call graph below reserve_metadata_bytes. It turns out that we only need to know whether the allocation is for the chunk root or not -- and we can pass that around as a bool inste

[PATCH 1/3] btrfs: fix race with relocation recovery and fs_root setup

2017-05-17 Thread jeffm
From: Jeff Mahoney If we have to recover relocation during mount, we'll ultimately have to evict the orphan inode. That goes through the reservation dance, where priority_reclaim_metadata_space and flush_space expect fs_info->fs_root to be valid. That's the next thing to be set up during mount,

[PATCH 2/3] btrfs: cleanup root usage by btrfs_get_alloc_profile

2017-05-17 Thread jeffm
From: Jeff Mahoney There are two places where we don't already know what kind of alloc profile we need before calling btrfs_get_alloc_profile, but we need access to a root everywhere we call it. This patch adds helpers for btrfs_{data,metadata,system}_alloc_profile() and relegates btrfs_system_a

[PATCH] btrfs: fix memory leak in update_space_info failure path

2017-05-17 Thread jeffm
From: Jeff Mahoney If we fail to add the space_info kobject, we'll leak the memory for the percpu counter. Fixes: 6ab0a2029c (btrfs: publish allocation data in sysfs) Cc: # v3.14+ Signed-off-by: Jeff Mahoney --- fs/btrfs/extent-tree.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btr

[PATCH 8/8] btrfs: use btrfs_debug instead of pr_debug in transaction abort

2017-02-15 Thread jeffm
From: Jeff Mahoney Commit e5d6b12fe14 (Btrfs: don't WARN() in btrfs_transaction_abort() for IO errors) added a pr_debug call to be printed when a transaction is aborted with -EIO instead of WARN. btrfs_debug prints which file system the message is associated with so let's use that instead. Sign

[PATCH 4/8] btrfs: free-space-cache, clean up unnecessary root arguments

2017-02-15 Thread jeffm
From: Jeff Mahoney The free space cache APIs accept a root but always use the tree root. Also, btrfs_truncate_free_space_cache accepts a root AND an inode but the inode always points to the root anyway, so let's just pass the inode. Signed-off-by: Jeff Mahoney --- fs/btrfs/extent-tree.c

[PATCH 3/8] btrfs: convert btrfs_inc_block_group_ro to accept fs_info

2017-02-15 Thread jeffm
From: Jeff Mahoney btrfs_inc_block_group_ro is either passed the extent root or the dev root, but it doesn't do anything with the dev tree. Let's convert to passing an fs_info and using the extent root. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h | 2 +- fs/btrfs/extent-tree.c | 5

[PATCH 0/8] btrfs: cleanup patches

2017-02-15 Thread jeffm
From: Jeff Mahoney Hi all - Here's another around of cleanup patches. The first 7 cleanup API blemishes with unused arguments and/or root -> fs_info conversion. The last converts the pr_debug in btrfs_abort_transaction to use btrfs_debug. -Jeff Jeff Mahoney (8): btrfs: pass fs_info to (mor

[PATCH 1/8] btrfs: pass fs_info to (more) routines that are only called with extent_root

2017-02-15 Thread jeffm
From: Jeff Mahoney Outside of interactions with qgroups, the roots passed in extent-tree.c are usually passed to ensure that we don't do refcounts on log trees or to get the allocation profile for an allocation request. Otherwise, it operates on the extent root. This patch converts some more ro

[PATCH 7/8] btrfs: drop unused extent_op arg from btrfs_add_delayed_data_ref

2017-02-15 Thread jeffm
From: Jeff Mahoney btrfs_add_delayed_data_ref is always called with a NULL extent_op, so let's drop the argument. Signed-off-by: Jeff Mahoney --- fs/btrfs/delayed-ref.c | 6 ++ fs/btrfs/delayed-ref.h | 3 +-- fs/btrfs/extent-tree.c | 7 +++ 3 files changed, 6 insertions(+), 10 deletion

[PATCH 5/8] btrfs: btrfs_wait_cache_io_root doesn't use path argument

2017-02-15 Thread jeffm
From: Jeff Mahoney Signed-off-by: Jeff Mahoney --- fs/btrfs/free-space-cache.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 61a72fb..a1e15f6 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs

[PATCH 6/8] btrfs: btrfs_truncate_free_space_cache always allocates path

2017-02-15 Thread jeffm
From: Jeff Mahoney btrfs_truncate_free_space_cache always allocates a btrfs_path structure but only uses it when the caller passes a block group. Let's move the allocation and free into the conditional. Signed-off-by: Jeff Mahoney --- fs/btrfs/free-space-cache.c | 13 ++--- 1 file cha

[PATCH 2/8] btrfs: flush_space always takes fs_info->fs_root

2017-02-15 Thread jeffm
From: Jeff Mahoney We don't need to pass a root to flush_space since it always uses the fs_root. Signed-off-by: Jeff Mahoney --- fs/btrfs/extent-tree.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c ind

[PATCH 1/2] btrfs-progs: quota: fix printing during wait mode

2017-01-17 Thread jeffm
From: Jeff Mahoney If we call "btrfs quota rescan -w", it will attempt to start the rescan operation, wait for it, and then print the "quota rescan started" message. The wait could last an arbitrary amount of time, so printing it after the wait isn't very helpful. This patch reworks how we print

[PATCH 2/2] btrfs-progs: quota: Add -W option to rescan to wait without starting rescan

2017-01-17 Thread jeffm
From: Jeff Mahoney This patch adds a new -W option to wait for a rescan without starting a new operation. This is useful for things like xfstests where we want do to do a "btrfs quota enable" and not continue until the subsequent rescan has finished. In addition to documenting the new option in

[PATCH 2/2] btrfs: fix locking when we put back a delayed ref that's too new

2016-12-20 Thread jeffm
From: Jeff Mahoney In __btrfs_run_delayed_refs, when we put back a delayed ref that's too new, we have already dropped the lock on locked_ref when we set ->processing = 0. This patch keeps the lock to cover that assignment. Fixes: d7df2c796d7 (Btrfs: attach delayed ref updates to delayed ref he

[PATCH 1/2 v2] btrfs: fix error handling when run_delayed_extent_op fails

2016-12-20 Thread jeffm
From: Jeff Mahoney In __btrfs_run_delayed_refs, the error path when run_delayed_extent_op fails sets locked_ref->processing = 0 but doesn't re-increment delayed_refs->num_heads_ready. As a result, we end up triggering the WARN_ON in btrfs_select_ref_head. Fixes: d7df2c796d7 (Btrfs: attach delay

[PATCH 08/18] btrfs: root->fs_info cleanup, io_ctl_init

2016-12-01 Thread jeffm
From: Jeff Mahoney The io_ctl->root member was only being used to access root->fs_info. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h| 2 +- fs/btrfs/free-space-cache.c | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs

[PATCH 11/18] btrfs: root->fs_info cleanup, lock/unlock_chunks

2016-12-01 Thread jeffm
From: Jeff Mahoney Signed-off-by: Jeff Mahoney --- fs/btrfs/disk-io.c | 4 +-- fs/btrfs/extent-tree.c | 8 +++--- fs/btrfs/free-space-cache.c | 4 +-- fs/btrfs/volumes.c | 70 ++--- fs/btrfs/volumes.h | 8 +++--- 5 file

[PATCH 14/18] btrfs: root->fs_info cleanup, access fs_info->delayed_root directly

2016-12-01 Thread jeffm
From: Jeff Mahoney This results in btrfs_assert_delayed_root_empty and btrfs_destroy_delayed_inode taking an fs_info instead of a root. Signed-off-by: Jeff Mahoney --- fs/btrfs/delayed-inode.c | 23 ++- fs/btrfs/delayed-inode.h | 4 ++-- fs/btrfs/disk-io.c | 8 -

[PATCH 03/18] btrfs: btrfs_init_new_device should use fs_info->dev_root

2016-12-01 Thread jeffm
From: Jeff Mahoney btrfs_init_new_device only uses the root passed in via the ioctl to start the transaction. Nothing else that happens is related to whatever root the user used to initiate the ioctl. We can drop the root requirement and just use fs_info->dev_root instead. Signed-off-by: Jeff

[PATCH 00/18] misc-4.10: root->fs_info patchset

2016-12-01 Thread jeffm
From: Jeff Mahoney Hi all - Here's the latest version of my root->fs_info patchset. It's against Dave's misc-4.10 branch. -Jeff --- Jeff Mahoney (18): btrfs: call functions that overwrite their root parameter with fs_info btrfs: call functions that always use the same root with fs_info

[PATCH 15/18] btrfs: convert extent-tree tracepoints to use fs_info

2016-12-01 Thread jeffm
From: Jeff Mahoney The extent-tree tracepoints all operate on the extent root, regardless of which root is passed in. Let's just use the extent root objectid instead. If it turns out that nobody is depending on the format of this tracepoint, we can drop the root printing entirely. Signed-off-by

[PATCH 02/18] btrfs: call functions that always use the same root with fs_info instead

2016-12-01 Thread jeffm
From: Jeff Mahoney There are many functions that are always called with the same root argument. Rather than passing the same root every time, we can pass an fs_info pointer instead and have the function get the root pointer itself. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h

[PATCH 05/18] btrfs: struct btrfsic_state->root should be an fs_info

2016-12-01 Thread jeffm
From: Jeff Mahoney The root member is never used except for obtaining an fs_info pointer. Signed-off-by: Jeff Mahoney --- fs/btrfs/check-integrity.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.

[PATCH 18/18] btrfs: split btrfs_wait_marked_extents into normal and tree log functions

2016-12-01 Thread jeffm
From: Jeff Mahoney btrfs_write_and_wait_marked_extents and btrfs_sync_log both call btrfs_wait_marked_extents, which provides a core loop and then handles errors differently based on whether it's it's a log root or not. This means that btrfs_write_and_wait_marked_extents needs to take a root bec

[PATCH 10/18] btrfs: root->fs_info cleanup, btrfs_calc_{trans,trunc}_metadata_size

2016-12-01 Thread jeffm
From: Jeff Mahoney Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h| 8 fs/btrfs/delayed-inode.c| 4 ++-- fs/btrfs/extent-tree.c | 35 +++ fs/btrfs/file.c | 4 ++-- fs/btrfs/free-space-cache.c | 4 ++-- fs/btrfs/inode

[PATCH 01/18] btrfs: call functions that overwrite their root parameter with fs_info

2016-12-01 Thread jeffm
From: Jeff Mahoney There are 11 functions that accept a root parameter and immediately overwrite it. We can pass those an fs_info pointer instead. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h| 4 ++-- fs/btrfs/disk-io.c | 4 ++-- fs/btrfs/extent-tree.c | 17 +++

[PATCH 07/18] btrfs: root->fs_info cleanup, use fs_info->dev_root everywhere

2016-12-01 Thread jeffm
From: Jeff Mahoney Signed-off-by: Jeff Mahoney --- fs/btrfs/check-integrity.c | 2 +- fs/btrfs/disk-io.c | 4 +-- fs/btrfs/extent-tree.c | 2 +- fs/btrfs/scrub.c | 86 +++--- fs/btrfs/volumes.c | 41 +++---

[PATCH 04/18] btrfs: alloc_reserved_file_extent trace point should use extent_root

2016-12-01 Thread jeffm
From: Jeff Mahoney Even though a separate root is passed in, we're still operating on the extent root. Let's use that for the trace point. Signed-off-by: Jeff Mahoney --- fs/btrfs/extent-tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/extent-tree.c b/fs/b

[PATCH 06/18] btrfs: struct reada_control.root -> reada_control.fs_info

2016-12-01 Thread jeffm
From: Jeff Mahoney The root is never used. We substitute extent_root in for the reada_find_extent call, since it's only ever used to obtain the node size. This call site will be changed to use fs_info in a later patch. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h | 2 +- fs/btrfs/reada.

[PATCH 12/18] btrfs: root->fs_info cleanup, update_block_group{,flags}

2016-12-01 Thread jeffm
From: Jeff Mahoney Signed-off-by: Jeff Mahoney --- fs/btrfs/extent-tree.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index cc9ae54..2e395d4 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/

[PATCH 16/18] btrfs: simplify btrfs_wait_cache_io prototype

2016-12-01 Thread jeffm
From: Jeff Mahoney With the exception of the one case where btrfs_wait_cache_io is called without a block group, it's called with the same arguments. The root argument is only used in the special case, so let's factor out the core and simplify the call in the normal case to require a trans, bloc

[PATCH 2/2] btrfs: increment ctx->pos for every emitted or skipped dirent in readdir

2016-11-05 Thread jeffm
From: Jeff Mahoney If we process the last item in the leaf and hit an I/O error while reading the next leaf, we return -EIO without having adjusted the position. Since we have emitted dirents, getdents() will return the byte count to the user instead of the error. Subsequent callers will emit t

[PATCH 1/2] btrfs: remove old tree_root dirent processing in btrfs_real_readdir()

2016-11-05 Thread jeffm
From: Jeff Mahoney Commit 3de4586c527 (Btrfs: Allow subvolumes and snapshots anywhere in the directory tree) introduced the current system of placing snapshots in the directory tree. It also introduced the behavior of creating the snapshot and then creating the directory entries for it. We've k

[PATCH] btrfs: remove old tree_root dirent processing in btrfs_real_readdir()

2016-11-04 Thread jeffm
From: Jeff Mahoney Commit 3de4586c527 (Btrfs: Allow subvolumes and snapshots anywhere in the directory tree) introduced the current system of placing snapshots in the directory tree. It also introduced the behavior of creating the snapshot and then creating the directory entries for it. We've k

[PATCH] tests/btrfs: test snapshot/subvol create/destroy ioctls with a regular file

2016-09-21 Thread jeffm
From: Jeff Mahoney There was a bug where the btrfs snapshot/subvol creation ioctls would accept a regular file and then Oops when it tried to use the file inode operations to do a lookup. This also adds an ioctl-helper that can be easily extended to provide direct ioctl access for any file syste

[PATCH] btrfs: ensure that file descriptor used with subvol ioctls is a dir

2016-09-21 Thread jeffm
From: Jeff Mahoney If the subvol/snapshot create/destroy ioctls are passed a regular file with execute permissions set, we'll eventually Oops while trying to do inode->i_op->lookup via lookup_one_len. This patch ensures that the file descriptor refers to a directory. Fixes: cb8e70901d (Btrfs: F

[PATCH 4/5] btrfs: convert pr_* to btrfs_* where possible

2016-09-20 Thread jeffm
From: Jeff Mahoney For many printks, we want to know which file system issued the message. This patch converts most pr_* calls to use the btrfs_* versions instead. In some cases, this means adding plumbing to allow call sites access to an fs_info pointer. fs/btrfs/check-integrity.c is left alon

[PATCH 5/5] btrfs: convert send's verbose_printk to btrfs_debug

2016-09-20 Thread jeffm
From: Jeff Mahoney This was basically an open-coded, less flexible dynamic printk. We can just use btrfs_debug instead. Signed-off-by: Jeff Mahoney diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index ee10345..96bc99d 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -36,10 +36,6 @@ #inc

[PATCH 3/5] btrfs: convert printk(KERN_* to use pr_* calls

2016-09-20 Thread jeffm
From: Jeff Mahoney This patch converts printk(KERN_* style messages to use the pr_* versions. One side effect is that anything that was KERN_DEBUG is now automatically a dynamic debug message. Signed-off-by: Jeff Mahoney diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c ind

[PATCH 2/5] btrfs: unsplit printed strings

2016-09-20 Thread jeffm
From: Jeff Mahoney CodingStyle chapter 2: "[...] never break user-visible strings such as printk messages, because that breaks the ability to grep for them." This patch unsplits user-visible strings. Signed-off-by: Jeff Mahoney diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 455a6b

[PATCH 1/5] btrfs: add dynamic debug support

2016-09-20 Thread jeffm
From: Jeff Mahoney We can re-use the dynamic debugging descriptor to make use of the dynamic debugging mechanism but still use our own printk interface. Defining the DEBUG macro works as it did before. When it's defined, all of the messages default to print. We can also enable all debug messag

[PATCH 0/5] btrfs: printing cleanup patchset

2016-09-20 Thread jeffm
From: Jeff Mahoney This is a patchset I've been working on to clean up message printing, make it adhere to kernel style, and be more consistent. The end result is that we: * use dynamic debugging for debugging messages * merge strings that exceed 80 characters into a single greppable string * co

[PATCH] btrfs: clean the old superblocks before freeing the device

2016-09-20 Thread jeffm
From: Jeff Mahoney btrfs_rm_device frees the block device but then re-opens it using the saved device name. A race exists between the close and the re-open that allows the block size to be changed. The result is getting stuck forever in the reclaim loop in __getblk_slow. This patch moves the s

[PATCH] btrfs: waiting on qgroup rescan should not always be interruptible

2016-08-08 Thread jeffm
From: Jeff Mahoney We wait on qgroup rescan completion in three places: file system shutdown, the quota disable ioctl, and the rescan wait ioctl. If the user sends a signal while we're waiting, we continue happily along. This is expected behavior for the rescan wait ioctl. It's racy in the shu

[PATCH v2 4/4] btrfs/126,127,128: test feature ioctl and sysfs interfaces

2016-06-27 Thread jeffm
From: Jeff Mahoney This tests the exporting of feature information from the kernel via sysfs and ioctl. The first test works whether the sysfs permissions are correct, if the information exported via sysfs matches what the ioctls are reporting, and if they both match the on-disk superblock's vers

[PATCH v2 0/4] btrfs feature testing + props fix

2016-06-27 Thread jeffm
From: Jeff Mahoney Hi all - Thanks, Eryu, for the review. The btrfs feature testing changes were a patchet I wrote three years ago, and it looks like significant cleanup has happened in the xfstests since then. I'm sorry for the level of the review you had to do for them, but do appreciate tha

[PATCH v2 1/4] btrfs/048: extend _filter_btrfs_prop_error to handle additional errors

2016-06-27 Thread jeffm
From: Jeff Mahoney btrfsprogs v4.5.3 changed the formatting of some error messages. This patch extends the filter for btrfs prop to handle those. Signed-off-by: Jeff Mahoney --- common/filter.btrfs | 10 +++--- tests/btrfs/048 | 6 -- tests/btrfs/048.out | 4 ++-- 3 files change

[PATCH v2 3/4] btrfs/125: test sysfs exports of allocation and device membership info

2016-06-27 Thread jeffm
From: Jeff Mahoney This tests the sysfs publishing for btrfs allocation and device membership info under a number of different layouts, similar to the btrfs replace test. We test the allocation files only for existence and that they contain numerical values. We test the device membership by mappi

[PATCH v2 2/4] btrfs/124: test global metadata reservation reporting

2016-06-27 Thread jeffm
From: Jeff Mahoney Btrfs can now report the size of the global metadata reservation via ioctl and sysfs. This test confirms that we get sane results on an empty file system. Signed-off-by: Jeff Mahoney --- .gitignore | 1 + common/btrfs | 43 +++ src/M

[PATCH 08/31] btrfs: copy_to_sk drop unused root parameter

2016-06-24 Thread jeffm
From: Jeff Mahoney The root parameter for copy_to_sk is not used at all. Signed-off-by: Jeff Mahoney --- fs/btrfs/ioctl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ffb1628..81413e6 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/b

[PATCH 24/31] btrfs: root->fs_info cleanup, btrfs_calc_{trans,trunc}_metadata_size

2016-06-24 Thread jeffm
From: Jeff Mahoney Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h| 8 fs/btrfs/delayed-inode.c| 4 ++-- fs/btrfs/extent-tree.c | 29 - fs/btrfs/file.c | 4 ++-- fs/btrfs/free-space-cache.c | 4 ++-- fs/btrfs/inode-map.c

[PATCH 21/31] btrfs: root->fs_info cleanup, use fs_info->dev_root everywhere

2016-06-24 Thread jeffm
From: Jeff Mahoney Signed-off-by: Jeff Mahoney --- fs/btrfs/check-integrity.c | 2 +- fs/btrfs/disk-io.c | 4 +-- fs/btrfs/extent-tree.c | 2 +- fs/btrfs/scrub.c | 87 +++--- fs/btrfs/volumes.c | 41 +++---

[PATCH 04/31] btrfs: tests, move initialization into tests/

2016-06-24 Thread jeffm
From: Jeff Mahoney We have all these stubs that only exist because they're called from btrfs_run_sanity_tests, which is a static inside super.c. Let's just move it all into tests/btrfs-tests.c and only have one stub. Signed-off-by: Jeff Mahoney --- fs/btrfs/super.c | 43 --

[PATCH 22/31] btrfs: root->fs_info cleanup, io_ctl_init

2016-06-24 Thread jeffm
From: Jeff Mahoney The io_ctl->root member was only being used to access root->fs_info. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h| 2 +- fs/btrfs/free-space-cache.c | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs

[PATCH 30/31] btrfs: root->fs_info cleanup, btrfs_commit_transaction already has root

2016-06-24 Thread jeffm
From: Jeff Mahoney btrfs_commit_transaction is always called using the root that was used to create the transaction handle. Passing it separately is unnecessary. Signed-off-by: Jeff Mahoney --- fs/btrfs/dev-replace.c | 10 +- fs/btrfs/disk-io.c | 6 +++--- fs/btrfs/extent

[PATCH 28/31] btrfs: root->fs_info cleanup, access fs_info->delayed_root directly

2016-06-24 Thread jeffm
From: Jeff Mahoney This results in btrfs_assert_delayed_root_empty and btrfs_destroy_delayed_inode taking an fs_info instead of a root. Signed-off-by: Jeff Mahoney --- fs/btrfs/delayed-inode.c | 23 ++- fs/btrfs/delayed-inode.h | 4 ++-- fs/btrfs/disk-io.c | 8 -

[PATCH 03/31] btrfs: btrfs_test_opt and friends should take a btrfs_fs_info

2016-06-24 Thread jeffm
From: Jeff Mahoney btrfs_test_opt and friends only use the root pointer to access the fs_info. Let's pass the fs_info directly in preparation to eliminate similar patterns all over btrfs. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h| 22 fs/btrfs/delayed-inode.c|

[PATCH 02/31] btrfs: prefix fsid to all trace events

2016-06-24 Thread jeffm
From: Jeff Mahoney When using trace events to debug a problem, it's impossible to determine which file system generated a particular event. This patch adds a macro to prefix standard information to the head of a trace event. The extent_state alloc/free events are all that's left without an fs_i

[PATCH 15/31] btrfs: call functions that overwrite their root parameter with fs_info

2016-06-24 Thread jeffm
From: Jeff Mahoney There are 11 functions that accept a root parameter and immediately overwrite it. We can pass those an fs_info pointer instead. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h| 4 ++-- fs/btrfs/disk-io.c | 4 ++-- fs/btrfs/extent-tree.c | 17 +++

[PATCH 17/31] btrfs: btrfs_init_new_device should use fs_info->dev_root

2016-06-24 Thread jeffm
From: Jeff Mahoney btrfs_init_new_device only uses the root passed in via the ioctl to start the transaction. Nothing else that happens is related to whatever root the user used to initiate the ioctl. We can drop the root requirement and just use fs_info->dev_root instead. Signed-off-by: Jeff

[PATCH 20/31] btrfs: struct reada_control.root -> reada_control.fs_info

2016-06-24 Thread jeffm
From: Jeff Mahoney The root is never used. We substitute extent_root in for the reada_find_extent call, since it's only ever used to obtain the node size. This call site will be changed to use fs_info in a later patch. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h | 2 +- fs/btrfs/reada.

[PATCH 11/31] btrfs: convert nodesize macros to static inlines

2016-06-24 Thread jeffm
From: Jeff Mahoney This patch converts the macros used to calculate various node size limits to static inlines. That way we get type checking for free. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h | 48 +--- 1 file changed, 33 insertions(+), 15

[PATCH 05/31] btrfs: tests, require fs_info for root

2016-06-24 Thread jeffm
From: Jeff Mahoney This allows the upcoming patchset to push nodesize and sectorsize into fs_info. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h | 1 + fs/btrfs/disk-io.c | 15 +++ fs/btrfs/disk-io.h | 3 ++- fs/btrfs/t

[PATCH 07/31] btrfs: simpilify btrfs_subvol_inherit_props

2016-06-24 Thread jeffm
From: Jeff Mahoney We just need a superblock, but we look it up using two different roots depending on the call site. Let's just use a superblock pointer initialized at the outset. This is mostly for Coccinelle not to choke on my root push up set. Signed-off-by: Jeff Mahoney --- fs/btrfs/pro

[PATCH 19/31] btrfs: struct btrfsic_state->root should be an fs_info

2016-06-24 Thread jeffm
From: Jeff Mahoney The root member is never used except for obtaining an fs_info pointer. Signed-off-by: Jeff Mahoney --- fs/btrfs/check-integrity.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.

[PATCH 09/31] btrfs: cleanup, remove prototype for btrfs_find_root_ref

2016-06-24 Thread jeffm
From: Jeff Mahoney The function isn't implemented anywhere. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0b107d1..bff6ce6 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2875,9 +2875,6

[PATCH 25/31] btrfs: root->fs_info cleanup, lock/unlock_chunks

2016-06-24 Thread jeffm
From: Jeff Mahoney Signed-off-by: Jeff Mahoney --- fs/btrfs/disk-io.c | 4 +-- fs/btrfs/extent-tree.c | 8 +++--- fs/btrfs/free-space-cache.c | 4 +-- fs/btrfs/volumes.c | 70 ++--- fs/btrfs/volumes.h | 8 +++--- 5 file

[PATCH 12/31] btrfs: btrfs_relocate_chunk pass extent_root to btrfs_end_transaction

2016-06-24 Thread jeffm
From: Jeff Mahoney In btrfs_relocate_chunk, we get a transaction handle via btrfs_start_trans_remove_block_group, which starts the transaction using the extent root. When we call btrfs_end_transaction, we're calling it using the chunk root. Signed-off-by: Jeff Mahoney --- fs/btrfs/volumes.c |

[PATCH 10/31] btrfs: introduce BTRFS_MAX_ITEM_SIZE

2016-06-24 Thread jeffm
From: Jeff Mahoney We use BTRFS_LEAF_DATA_SIZE - sizeof(struct btrfs_item) in several places. This introduces a BTRFS_MAX_ITEM_SIZE macro to do the same. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h | 8 fs/btrfs/extent-tree.c | 2 +- fs/btrfs/file-item.c | 5 ++--- fs/bt

[PATCH 14/31] btrfs: btrfs_abort_transaction, drop root parameter

2016-06-24 Thread jeffm
From: Jeff Mahoney __btrfs_abort_transaction doesn't use its root parameter except to obtain an fs_info pointer. We can obtain that from trans->root->fs_info for now and from trans->fs_info in a later patch. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.c| 12 +++ fs/btrfs/ct

[PATCH 13/31] btrfs: add btrfs_trans_handle->fs_info pointer

2016-06-24 Thread jeffm
From: Jeff Mahoney btrfs_trans_handle->root is documented as for use for confirming that the root passed in to start the transaction is the same as the one ending it. It's used in several places when an fs_info pointer is needed, so let's just add an fs_info pointer directly. Eventually, the ro

[PATCH 26/31] btrfs: root->fs_info cleanup, update_block_group{,flags}

2016-06-24 Thread jeffm
From: Jeff Mahoney Signed-off-by: Jeff Mahoney --- fs/btrfs/extent-tree.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 14f4d05..bc56e04 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/

[PATCH 00/31] btrfs: simplify use of struct btrfs_root pointers

2016-06-24 Thread jeffm
hes in email format is the "squashed" version of the full development series. That series is available at: git://git.kernel.org/pub/scm/linux/kernel/git/jeffm/linux-btrfs.git There are two branches of interest: - btrfs-testing/root-fsinfo-cleanup-squashed contains this series - btrfs-testin

[PATCH 18/31] btrfs: alloc_reserved_file_extent trace point should use extent_root

2016-06-24 Thread jeffm
From: Jeff Mahoney Even though a separate root is passed in, we're still operating on the extent root. Let's use that for the trace point. Signed-off-by: Jeff Mahoney --- fs/btrfs/extent-tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/extent-tree.c b/fs/b

[PATCH 16/31] btrfs: call functions that always use the same root with fs_info instead

2016-06-24 Thread jeffm
From: Jeff Mahoney There are many functions that are always called with the same root argument. Rather than passing the same root every time, we can pass an fs_info pointer instead and have the function get the root pointer itself. Signed-off-by: Jeff Mahoney --- fs/btrfs/ctree.h

[PATCH 06/31] btrfs: tests, use BTRFS_FS_STATE_DUMMY_FS_INFO instead of dummy root

2016-06-24 Thread jeffm
From: Jeff Mahoney Now that we have a dummy fs_info associated with each test that uses a root, we don't need the DUMMY_ROOT bit anymore. This lets us make choices without needing an actual root like in e.g. btrfs_find_create_tree_block. Signed-off-by: Jeff Mahoney --- fs/btrfs/backref.c

[PATCH 31/31] btrfs: root->fs_info cleanup, btrfs_end_transaction{,_throttle} use trans->fs_info instead of parameter

2016-06-24 Thread jeffm
From: Jeff Mahoney Without btrfs_commit_transaction accepting a root parameter, __btrfs_end_transaction doesn't consume one anymore. In theory, we still accept it to compare that the root we used to start the transaction is the same one we used to end it. In practice, the check doesn't exist.

[PATCH 01/31] btrfs: plumb fs_info into btrfs_work

2016-06-24 Thread jeffm
From: Jeff Mahoney In order to provide an fsid for trace events, we'll need a btrfs_fs_info pointer. The most lightweight way to do that for btrfs_work structures is to associate it with the __btrfs_workqueue structure. Each queued btrfs_work structure has a workqueue associated with it, so tha

[PATCH 4/4] fstests: btrfs/126,127,128: test feature ioctl and sysfs interfaces

2016-06-24 Thread jeffm
From: Jeff Mahoney This tests the exporting of feature information from the kernel via sysfs and ioctl. The first test works whether the sysfs permissions are correct, if the information exported via sysfs matches what the ioctls are reporting, and if they both match the on-disk superblock's vers

[PATCH 2/4] fstests: btrfs/124: test global metadata reservation reporting

2016-06-24 Thread jeffm
From: Jeff Mahoney Btrfs can now report the size of the global metadata reservation via ioctl and sysfs. This test confirms that we get sane results on an empty file system. ENOTTY and missing /sys/fs/btrfs//allocation are not considered failures. Signed-off-by: Jeff Mahoney --- common/rc

[PATCH 3/4] fstests: btrfs/125: test sysfs exports of allocation and device membership info

2016-06-24 Thread jeffm
From: Jeff Mahoney This tests the sysfs publishing for btrfs allocation and device membership info under a number of different layouts, similar to the btrfs replace test. We test the allocation files only for existence and that they contain numerical values. We test the device membership by mappi

[PATCH 1/4] fstests: btrfs/048: extend _filter_btrfs_prop_error to handle additional errors

2016-06-24 Thread jeffm
From: Jeff Mahoney btrfsprogs v4.5.3 changed the formatting of some error messages. This patch extends the filter for btrfs prop to handle those. Signed-off-by: Jeff Mahoney --- common/filter.btrfs | 10 +++--- tests/btrfs/048 | 6 -- tests/btrfs/048.out | 4 ++-- 3 files change

[PATCH 0/3] btrfs-progs: check improve 'checking extents' scalability

2016-06-23 Thread jeffm
From: Jeff Mahoney While running xfstests generic/291, which creates a single file populated with reflinks to the same extent, I found that fsck had been running for hours. perf top lead me to find_data_backref as the culprit, and a litte more digging made it clear: For every extent record we ad

<    1   2   3   >