[patch v3 17/23] btrfs: Make btrfs_invalidate_inodes return void

2011-09-08 Thread jeffm
btrfs_invalidate_inodes has no error conditions and should return void. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/ctree.h |2 +- fs/btrfs/inode.c |3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2590,7 +2590,7 @@

[patch v3 21/23] btrfs: simplify btrfs_submit_bio_hook

2011-09-08 Thread jeffm
btrfs_submit_bio_hook currently calls btrfs_bio_wq_end_io in either case of an if statement that determines one of the arguments. This patch moves the function call outside of the if statement and uses it to only determine the different argument. This allows us to catch an error in one place

[patch v3 10/23] btrfs: Push up non-looped btrfs_start_transaction failures

2011-09-08 Thread jeffm
This patch handles btrfs_start_transaction failures that don't occur in a loop and are obvious to simply push up. In all cases except the mark_garbage_root case, the error is already handled by BUG_ON in the caller. Update v2: This version also checks the returns from btrfs_drop_snapshot.

[patch v3 23/23] btrfs: Push up -submit_bio_hook failures

2011-09-08 Thread jeffm
This pushes failures from the submit_bio_hook callbacks, btrfs_submit_bio_hook and btree_submit_bio_hook into the callers, including callers of submit_one_bio where it catches the failures with BUG_ON. It also pushes up through the -readpage_io_failed_hook to end_bio_extent_writepage where

[patch v3 16/23] btrfs: Make btrfs_init_compress return void

2011-09-08 Thread jeffm
btrfs_init_compress doesn't have any failure conditions, so return void. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/compression.h |2 +- fs/btrfs/super.c |5 + 2 files changed, 2 insertions(+), 5 deletions(-) --- a/fs/btrfs/compression.c +++

[patch v3 04/23] btrfs: Push up lock_extent errors to callers

2011-09-08 Thread jeffm
lock_extent, try_lock_extent, and lock_extent_bits can't currently fail because errors are caught via BUG_ON. This patch pushes the error handling up to callers, which currently only handle them via BUG_ON themselves. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/compression.c

[patch v3 06/23] btrfs: Push up unlock_extent errors to callers

2011-09-08 Thread jeffm
The previous patch pushed the clear_extent_bit error handling up a level, which included unlock_extent and unlock_extent_cache. This patch pushes the BUG_ON up into the callers of those functions. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/compression.c |9 ++--

[patch v3 19/23] btrfs: extent-tree.c: Make functions with no error conditions return void

2011-09-08 Thread jeffm
btrfs_prepare_extent_commit, btrfs_set_block_group_rw, and setup_inline_extent_backref have no error conditions and should return void. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/ctree.h |8 fs/btrfs/extent-tree.c | 20 +--- 2 files changed, 13

[patch v3 12/23] btrfs: extent_io.c: Make functions with no error conditions return void

2011-09-08 Thread jeffm
wait_on_state, wait_extent_bit, __unlock_for_delalloc, check_page_uptodate, check_page_locked, check_page_writeback, and clear_extent_buffer_dirty have no error conditions and should return void. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/extent_io.c | 29

[patch v3 03/23] btrfs: Push up set_extent_bit errors to callers

2011-09-08 Thread jeffm
In the locking case, set_extent_bit can return -EEXIST but callers already handle that. In the non-locking case, it can't fail. Memory allocation failures are handled by BUG_ON. This patch pushes up the BUG_ONs from set_extent_bit to callers, except where -ENOMEM can't occur (e.g.

[patch v3 05/23] btrfs: Push up clear_extent_bit errors to callers

2011-09-08 Thread jeffm
clear_extent_bit can fail with -ENOMEM for a specific case but will BUG on other memory allocation failures. This patch returns -ENOMEM for memory allocation failures and handles them with BUG_ON in callers which don't handle it already. Signed-off-by: Jeff Mahoney je...@suse.com ---

[patch v3 09/23] btrfs: btrfs_drop_snapshot should return int

2011-09-08 Thread jeffm
Commit cb1b69f4 (Btrfs: forced readonly when btrfs_drop_snapshot() fails) made btrfs_drop_snapshot return void because there were no callers checking the return value. That is the wrong order to handle error propogation since the caller will have no idea that an error has occured and continue on

[patch v3 18/23] btrfs: disk-io.c: Make functions with no error conditions return void

2011-09-08 Thread jeffm
btrfs_destroy_delalloc_inodes and __setup_root have no error conditions and should return void. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/disk-io.c | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -54,7

[patch v3 20/23] btrfs: file.c: Make functions with no error conditions return void

2011-09-08 Thread jeffm
btrfs_run_defrag_inodes contains no error conditions and should return void. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/ctree.h |2 +- fs/btrfs/file.c |3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -2612,7

[patch v3 11/23] btrfs: Make set_range_writeback return void

2011-09-08 Thread jeffm
set_range_writeback has no error conditions that aren't fatal logic errors. This patch makes it return void to eliminate an error site. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/extent_io.c |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) ---

[patch v3 08/23] btrfs: Push up btrfs_pin_extent failures

2011-09-08 Thread jeffm
btrfs_pin_extent looks up a block group and then calls pin_down_extent with it. If the lookup fails, it should return -ENOENT to allow callers to handle the error condition. For the three existing callers, it is a logic error if the lookup fails and a panic will occur. Signed-off-by: Jeff

[patch v3 07/23] btrfs: Make pin_down_extent return void

2011-09-08 Thread jeffm
pin_down_extent performs some operations which can't fail and then calls set_extent_dirty, which has two failure cases via set_extent_bit: 1) Return -EEXIST if exclusive bits are set - Since it doesn't use any exclusive bits, this failure case can't occur. 2) Return -ENOMEM if

[patch v3 13/23] btrfs: volumes.c: Make functions with no error conditions return void

2011-09-08 Thread jeffm
btrfs_cleanup_fs_uuids, run_scheduled_bios, btrfs_close_extra_devices, schedule_bio, and fill_device_from_item have no error conditions and should return void. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/volumes.c | 25 + fs/btrfs/volumes.h |4 ++-- 2

[patch v3 00/23] More error handling fixes

2011-09-08 Thread jeffm
Hi all - The following 23 patches add more error handling to the btrfs code: - Add btrfs_panic - Catch locking failures in {set,clear}_extent_bit - Push up set_extent_bit errors to callers - Push up lock_extent errors to callers - Push up clear_extent_bit errors to callers - Push up

[patch v3 14/23] btrfs: async-thread.c: Make functions with no error conditions return void

2011-09-08 Thread jeffm
run_ordered_completions, btrfs_stop_workers, btrfs_requeue_work, and btrfs_queue_worker don't have any error conditions and should return void. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/async-thread.c | 31 ++- fs/btrfs/async-thread.h |7 ---

[patch v3 15/23] btrfs: tree-log.c: Make functions with no error conditions return void

2011-09-08 Thread jeffm
btrfs_end_log_trans and wait_for_writer have no error conditions and should return void. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/tree-log.c |6 ++ fs/btrfs/tree-log.h |2 +- 2 files changed, 3 insertions(+), 5 deletions(-) --- a/fs/btrfs/tree-log.c +++

[patch v3 02/23] btrfs: Catch locking failures in {set,clear}_extent_bit

2011-09-08 Thread jeffm
The *_state functions can only return 0 or -EEXIST. This patch addresses the cases where those functions return -EEXIST, representing a locking failure. It handles them by panicking with an appropriate error message. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/extent_io.c | 42

[patch v3 22/23] btrfs: Factor out tree-ops-merge_bio_hook call

2011-09-08 Thread jeffm
In submit_extent_page, there's a visually noisy if statement that, in the midst of other conditions, does the tree dependency for tree-ops and tree-ops-merge_bio_hook before calling it, and then another condition afterwards. If an error is returned from merge_bio_hook, there's no way to catch

[patch v3 01/23] btrfs: Add btrfs_panic()

2011-09-08 Thread jeffm
As part of the effort to eliminate BUG_ON as an error handling technique, we need to determine which errors are actual logic errors, which are on-disk corruption, and which are normal runtime errors e.g. -ENOMEM. Annotating these error cases is helpful to understand and report them. This

[PATCH] btrfs: cleanup, stop casting for extent_map-lookup everywhere

2015-06-03 Thread jeffm
From: Jeff Mahoney je...@suse.com Overloading extent_map-bdev to struct map_lookup * might have started out as a means to an end, but it's a pattern that's used all over the place now. Let's get rid of the casting and just add a union instead. Signed-off-by: Jeff Mahoney je...@suse.com ---

[PATCH 3/3] btrfs: add missing discards when unpinning extents with -o discard

2015-06-03 Thread jeffm
From: Jeff Mahoney je...@suse.com When we clear the dirty bits in btrfs_delete_unused_bgs for extents in the empty block group, it results in btrfs_finish_extent_commit being unable to discard the freed extents. The block group removal patch added an alternate path to forget extents other than

[PATCH v3] btrfs: fix automatic blockgroup remove + discard

2015-06-03 Thread jeffm
The automatic block group removal patch introduced some regressions in how discards are handled. 1/ FITRIM only iterates over block groups on disk - removed block groups won't be trimmed. 2/ Clearing the dirty bit from extents in removed block groups means that those extents won't be

[PATCH 2/3] btrfs: explictly delete unused block groups in close_ctree and ro-remount

2015-06-03 Thread jeffm
From: Jeff Mahoney je...@suse.com The cleaner thread may already be sleeping by the time we enter close_ctree. If that's the case, we'll skip removing any unused block groups queued for removal, even during a normal umount. They'll be cleaned up automatically at next mount, but users expect a

[PATCH 2/7] btrfs: btrfs_issue_discard ensure offset/length are aligned to sector boundaries

2015-06-15 Thread jeffm
From: Jeff Mahoney je...@suse.com It's possible, though unexpected, to pass unaligned offsets and lengths to btrfs_issue_discard. We then shift the offset/length values to sector units. If an unaligned offset has been passed, it will result in the entire sector being discarded, possibly losing

[PATCH 7/7] btrfs: cleanup, stop casting for extent_map-lookup everywhere

2015-06-15 Thread jeffm
From: Jeff Mahoney je...@suse.com Overloading extent_map-bdev to struct map_lookup * might have started out as a means to an end, but it's a pattern that's used all over the place now. Let's get rid of the casting and just add a union instead. Signed-off-by: Jeff Mahoney je...@suse.com ---

[PATCH 5/7] btrfs: explictly delete unused block groups in close_ctree and ro-remount

2015-06-15 Thread jeffm
From: Jeff Mahoney je...@suse.com The cleaner thread may already be sleeping by the time we enter close_ctree. If that's the case, we'll skip removing any unused block groups queued for removal, even during a normal umount. They'll be cleaned up automatically at next mount, but users expect a

[PATCH 3/7] btrfs: skip superblocks during discard

2015-06-15 Thread jeffm
From: Jeff Mahoney je...@suse.com Btrfs doesn't track superblocks with extent records so there is nothing persistent on-disk to indicate that those blocks are in use. We track the superblocks in memory to ensure they don't get used by removing them from the free space cache when we load a block

[PATCH 1/7] btrfs: make btrfs_issue_discard return bytes discarded

2015-06-15 Thread jeffm
From: Jeff Mahoney je...@suse.com Initially this will just be the length argument passed to it, but the following patches will adjust that to reflect re-alignment and skipped blocks. Signed-off-by: Jeff Mahoney je...@suse.com --- fs/btrfs/extent-tree.c | 19 ++- 1 file changed,

[PATCH 6/7] btrfs: add missing discards when unpinning extents with -o discard

2015-06-15 Thread jeffm
From: Jeff Mahoney je...@suse.com When we clear the dirty bits in btrfs_delete_unused_bgs for extents in the empty block group, it results in btrfs_finish_extent_commit being unable to discard the freed extents. The block group removal patch added an alternate path to forget extents other than

[PATCH 4/7] btrfs: iterate over unused chunk space in FITRIM

2015-06-15 Thread jeffm
From: Jeff Mahoney je...@suse.com Since we now clean up block groups automatically as they become empty, iterating over block groups is no longer sufficient to discard unused space. This patch iterates over the unused chunk space and discards any regions that are unallocated, regardless of

[PATCH 4/4] btrfs: add missing discards when unpinning extents with -o discard

2015-06-11 Thread jeffm
From: Jeff Mahoney je...@suse.com When we clear the dirty bits in btrfs_delete_unused_bgs for extents in the empty block group, it results in btrfs_finish_extent_commit being unable to discard the freed extents. The block group removal patch added an alternate path to forget extents other than

[PATCH 1/4] btrfs: skip superblocks during discard

2015-06-11 Thread jeffm
From: Jeff Mahoney je...@suse.com Btrfs doesn't track superblocks with extent records so there is nothing persistent on-disk to indicate that those blocks are in use. We track the superblocks in memory to ensure they don't get used by removing them from the free space cache when we load a block

[PATCH 2/4] btrfs: iterate over unused chunk space in FITRIM

2015-06-11 Thread jeffm
From: Jeff Mahoney je...@suse.com Since we now clean up block groups automatically as they become empty, iterating over block groups is no longer sufficient to discard unused space. This patch iterates over the unused chunk space and discards any regions that are unallocated, regardless of

[PATCH v4] btrfs: fix automatic blockgroup remove + discard

2015-06-11 Thread jeffm
The automatic block group removal patch introduced some regressions in how discards are handled. 1/ FITRIM only iterates over block groups on disk - removed block groups won't be trimmed. 2/ Clearing the dirty bit from extents in removed block groups means that those extents won't be

[PATCH 1/2] btrfs: plumb fs_info into btrfs_work

2016-06-09 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

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

2016-06-09 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

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

2016-06-23 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

[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

[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

[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

[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 --

[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

[PATCH 2/3] btrfs-progs: check: supplement extent backref list with rbtree

2016-06-23 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

[PATCH 1/3] btrfs-progs: check: add helpers for converting between structures

2016-06-23 Thread jeffm
From: Jeff Mahoney We either open code list_entry calls or outright cast between types. The compiler will do the right thing if we use static inlines to do typesafe conversions. Signed-off-by: Jeff Mahoney --- cmds-check.c | 100

[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

[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 --

[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

[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

[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

[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

[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

[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

[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

[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 +++

[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 ++---

[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

[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 +-

[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

[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

[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

[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

[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 ++--

[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

[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

[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 ++--

[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.

[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

[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 ++--

[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

[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

[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 ---

[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.

[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 ---

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

2016-06-24 Thread jeffm
atches 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-test

[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 ---

[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

[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

[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

[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.

[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

[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 |

[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:

[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

[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

[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 ---

[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 ---

[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

[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

[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

[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

[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

[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

[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

[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

[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

  1   2   3   >