aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs
AgeCommit message (Collapse)AuthorFilesLines
2018-03-31btrfs: Drop fs_info parameter from btrfs_finish_extent_commitNikolay Borisov3-5/+4
It's provided by the transaction handle. Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Drop fs_info parameter from btrfs_qgroup_account_extentsNikolay Borisov3-6/+5
It's provided by the transaction handle. Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: drop fs_info parameter from btrfs_run_delayed_refsNikolay Borisov4-20/+18
It's provided by the transaction handle. Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove unused flush var in shrink_delallocNikolay Borisov1-5/+0
Added by 08e007d2e577 ("Btrfs: improve the noflush reservation") and made redundant by 17024ad0a0fd ("Btrfs: fix early ENOSPC due to delalloc"). Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove unused extent_root var from caching_threadNikolay Borisov1-2/+0
Added by b4570aa994b8 ("btrfs: fix compiling with CONFIG_BTRFS_DEBUG enabled.") and obsoleted by 2ff7e61e0d30 ("btrfs: take an fs_info directly when the root is not used otherwise"). Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: remove max_active var from open_ctreeNikolay Borisov1-3/+0
Introduced by 5cdc7ad337fb ("btrfs: Replace fs_info->workers with btrfs_workqueue.") but obsoleted by 2a4581983f90 ("btrfs: factor btrfs_init_workqueues() out of open_ctree()"). Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove unused root var from relink_file_extentsNikolay Borisov1-2/+0
Added in 38c227d87c49 ("Btrfs: snapshot-aware defrag") but subsequently made redundant by 0b246afa62b0 ("btrfs: root->fs_info cleanup, add fs_info convenience variables"). Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove unused tot_len var from lzo_decompressNikolay Borisov1-2/+0
Added already unused in a6fa6fae40ec ("btrfs: Add lzo compression support"). Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove unused length var from scrub_handle_errored_blockNikolay Borisov1-2/+0
Added in b5d67f64f9bc ("Btrfs: change scrub to support big blocks") but rendered redundant by be50a8ddaae1 ("Btrfs: Simplify scrub_setup_recheck_block()'s argument"). Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove unused op_key var from add_delayed_refsNikolay Borisov1-4/+1
Added as part of 86d5f9944252 ("btrfs: convert prelimary reference tracking to use rbtrees") but never used. tmp_op_key essentially subsumed that variable. Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: volumes: Remove the meaningless condition of minimal nr_devs when ↵Qu Wenruo1-3/+2
allocating a chunk When checking the minimal nr_devs, there is one dead and meaningless condition: if (ndevs < devs_increment * sub_stripes || ndevs < devs_min) { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This condition is meaningless, @devs_increment has nothing to do with @sub_stripes. In fact, in btrfs_raid_array[], profile with sub_stripes larger than 1 (RAID10) already has the @devs_increment set to 2. So no need to multiple it by @sub_stripes. And above condition is also dead. For RAID10, @devs_increment * @sub_stripes equals 4, which is also the @devs_min of RAID10. For other profiles, @sub_stripes is always 1, and since @ndevs is rounded down to @devs_increment, the condition will always be true. Remove the meaningless condition to make later reader wander less. Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Document parameters of btrfs_reserve_extentNikolay Borisov1-0/+45
This function is the entry to the extent allocator and as such has quite a number of parameters. Some of those have subtle effects on the allocation algorithm. Document the parameters. Signed-off-by: Nikolay Borisov <[email protected]> Reviewed-by: Anand Jain <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Handle error from btrfs_uuid_tree_rem call in ↵Nikolay Borisov1-4/+11
_btrfs_ioctl_set_received_subvol As with every function which deals with modifying the btree btrfs_uuid_tree_rem can fail for any number of reasons (ie. EIO/ENOMEM). Handle return error value from this function gracefully by aborting the transaction. Fixes: dd5f9615fc5c ("Btrfs: maintain subvolume items in the UUID tree") Signed-off-by: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Use sizeof directly instead of a constant variableNikolay Borisov1-3/+2
The kernel would like to have all stack VLA usage removed[1]. Unfortunately using an integer constant variable as the size of an array is still considered a VLA. Instead let's use directly sizeof(var) which removes the VLA usage. Use the occasion to remove csum_size altogether and use sizeof() also for the size passed to memcmp [1]: https://lkml.org/lkml/2018/3/7/621 Signed-off-by: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: rename submit callbacks and drop double underscoresDavid Sterba2-16/+15
Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: remove unused parameters from extent_submit_bio_done_tDavid Sterba3-8/+4
Remove parameters not used by any of the callbacks. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: remove unused parameters from extent_submit_bio_start_tDavid Sterba3-7/+2
Remove parameters not used by any of the callbacks. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: separate types for submit_bio_start and submit_bio_doneDavid Sterba3-6/+15
The callbacks make use of different parameters that are passed to the other type unnecessarily. This patch adds separate types for each and the unused parameters will be removed. The type extent_submit_bio_hook_t keeps all parameters and can be used where the start/done types are not appropriate. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: kill tree_mod_log_set_root_pointer helperDavid Sterba1-13/+7
A useless wrapper around tree_mod_log_insert_root that hides missing error handling. Move it to the callers. Reviewed-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: kill tree_mod_log_set_node_key helperDavid Sterba1-15/+17
A trivial wrapper that can be simply opencoded and makes the GFP allocation request more visible. The error handling is now moved to the callers. Reviewed-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: kill trivial wrapper tree_mod_log_eb_moveDavid Sterba1-15/+12
The wrapper is effectively an alias for tree_mod_log_insert_move but also hides the missing error handling. To make that more visible, lift the BUG_ON to the callers. Reviewed-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: remove trivial locking wrappers of tree mod logDavid Sterba1-39/+19
The wrappers are trivial and do not bring any extra value on top of the plain locking primitives. Reviewed-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: drop fs_info parameter from __tree_mod_log_oldest_rootDavid Sterba1-6/+5
It's provided by the extent_buffer. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: embed tree_mod_move structure to tree_mod_elemDavid Sterba1-6/+4
The tree_mod_move is not used anywhere and can be embedded as anonymous structure. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: drop unused fs_info parameter from tree_mod_log_eb_moveDavid Sterba1-7/+6
Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: drop fs_info parameter from tree_mod_log_free_ebDavid Sterba1-7/+4
It's provided by the extent_buffer. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: drop fs_info parameter from tree_mod_log_free_ebDavid Sterba1-9/+6
It's provided by the extent_buffer. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: drop fs_info parameter from tree_mod_log_insert_keyDavid Sterba1-15/+12
It's provided by the extent_buffer. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: drop fs_info parameter from tree_mod_log_insert_moveDavid Sterba1-13/+10
It's provided by the extent_buffer. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: drop fs_info parameter from tree_mod_log_set_node_keyDavid Sterba1-11/+8
It's provided by the extent_buffer. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: document more parameters of submit_extent_pageDavid Sterba1-0/+12
Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: cleanup merging conditions in submit_extent_pageDavid Sterba1-17/+9
The merge call was factored out to a separate helper but it's a trivial one and arguably we can opencode it and cache the value. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: remove redundant variable in __do_readpageDavid Sterba1-3/+1
The value of page_end is only stored to end, no other use. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: assume that bio_ret is always valid in submit_extent_pageDavid Sterba1-5/+5
All callers pass a valid pointer so we can drop the redundant checks. The call to submit_one_bio never happend and can be removed. Signed-off-by: David Sterba <[email protected]>
2018-03-31Btrfs: scrub: batch rebuild for raid56Liu Bo1-18/+61
In case of raid56, writes and rebuilds always take BTRFS_STRIPE_LEN(64K) as unit, however, scrub_extent() sets blocksize as unit, so rebuild process may be triggered on every block on a same stripe. A typical example would be that when we're replacing a disappeared disk, all reads on the disks get -EIO, every block (size is 4K if blocksize is 4K) would go thru these, scrub_handle_errored_block scrub_recheck_block # re-read pages one by one scrub_recheck_block # rebuild by calling raid56_parity_recover() page by page Although with raid56 stripe cache most of reads during rebuild can be avoided, the parity recover calculation(xor or raid6 algorithms) needs to be done $(BTRFS_STRIPE_LEN / blocksize) times. This makes it smarter by doing raid56 scrub/replace on stripe length. Signed-off-by: Liu Bo <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: sort and group mount option definitionsDavid Sterba1-53/+86
Sort mount options by the primary name, followed by the 'no-' counterpart if it exists. Group the deprecated and debugging options. Enum and token defintions are synced. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Add nossd_spread mount optionHoward McLauchlan1-4/+7
Btrfs has two mount options for SSD optimizations: ssd and ssd_spread. Presently there is an option to disable all SSD optimizations, but there isn't an option to disable just ssd_spread. This patch adds a mount option nossd_spread that disables ssd_spread only. Reviewed-by: Josef Bacik <[email protected]> Signed-off-by: Howard McLauchlan <[email protected]> Reviewed-by: Omar Sandoval <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove btrfs_fs_info::open_ioctl_transNikolay Borisov3-9/+4
Since userspace transaction have been removed we no longer have use for this field so delete it. Signed-off-by: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove code referencing unused TRANS_USERSPACENikolay Borisov2-26/+7
Now that the userspace transaction ioctls have been removed, TRANS_USERSPACE is no longer used hence we can remove it. Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove btrfs_file_private::transNikolay Borisov1-1/+0
Now that the userspace transaction IOCTL have been removed, this member is no longer used so just remove it Signed-off-by: Nikolay Borisov <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Remove userspace transaction ioctlsNikolay Borisov3-104/+0
Commit 3558d4f88ec8 ("btrfs: Deprecate userspace transaction ioctls") marked the beginning of the end of userspace transaction. This commit finishes the job! There are no known users and ceph does not use the ioctl anymore. Signed-off-by: Nikolay Borisov <[email protected]> Acked-by: Sage Weil <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: qgroup: Fix root item corruption when multiple same source snapshots ↵Qu Wenruo1-1/+9
are created with quota enabled When multiple pending snapshots referring to the same source subvolume are executed, enabled quota will cause root item corruption, where root items are using old bytenr (no backref in extent tree). This can be triggered by fstests btrfs/152. The cause is when source subvolume is still dirty, extra commit (simplied transaction commit) of qgroup_account_snapshot() can skip dirty roots not recorded in current transaction, making root item of source subvolume not updated. Fix it by forcing recording source subvolume in current transaction before qgroup sub-transaction commit. Reported-by: Justin Maggard <[email protected]> Signed-off-by: Qu Wenruo <[email protected]> Reviewed-by: Filipe Manana <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Relax memory barrier in btrfs_tree_unlockNikolay Borisov1-1/+1
When performing an unlock on an extent buffer we'd like to order the decrement of extent_buffer::blocking_writers with waking up any waiters. In such situations it's sufficient to use smp_mb__after_atomic rather than the heavy smp_mb. On architectures where atomic operations are fully ordered (such as x86 or s390) unconditionally executing a heavyweight smp_mb instruction causes a severe hit to performance while bringin no improvements in terms of correctness. The better thing is to use the appropriate smp_mb__after_atomic routine which will do the correct thing (invoke a full smp_mb or in the case of ordered atomics insert a compiler barrier). Put another way, an RMW atomic op + smp_load__after_atomic equals, in terms of semantics, to a full smp_mb. This ensures that none of the problems described in the accompanying comment of waitqueue_active occur. No functional changes. Signed-off-by: Nikolay Borisov <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: add define for oldest generationAnand Jain5-6/+8
Some functions can filter metadata by the generation. Add a define that will annotate such arguments. Signed-off-by: Anand Jain <[email protected]> Reviewed-by: David Sterba <[email protected]> [ update changelog ] Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: open code trivial helper btrfs_page_exists_in_rangeDavid Sterba3-9/+4
The called function name is self explanatory. Signed-off-by: David Sterba <[email protected]>
2018-03-31btrfs: Use filemap_range_has_page()Matthew Wilcox2-71/+5
The current implementation of btrfs_page_exists_in_range() gives the wrong answer if the workingset code has stored a shadow entry in the page cache. The filemap_range_has_page() function does not have this problem, and it's shared code, so use it instead. eigned-off-by: Matthew Wilcox <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-26Btrfs: dev-replace: make sure target is identical to source when raid56 ↵Liu Bo1-2/+11
rebuild fails In the last step of scrub_handle_error_block, we try to combine good copies on all possible mirrors, this works fine for raid1 and raid10, but not for raid56 as it's doing parity rebuild. If parity rebuild doesn't get back with correct data which matches its checksum, in case of replace we'd rather write what is stored in the source device than the data calculuated from parity. Signed-off-by: Liu Bo <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-26Btrfs: raid56: remove redundant async_missing_raid56Liu Bo1-17/+1
async_missing_raid56() is identical to async_read_rebuild(). Signed-off-by: Liu Bo <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
2018-03-26btrfs: adjust return values of btrfs_inode_by_nameSu Yue1-12/+10
Previously, btrfs_inode_by_name() returned 0 which left caller to check objectid of location even location if the type was invalid. Let btrfs_inode_by_name() return -EUCLEAN if a corrupted location of a dir entry is found. Removal of label out_err also simplifies the function. Signed-off-by: Su Yue <[email protected]> Reviewed-by: David Sterba <[email protected]> [ drop unlikely ] Signed-off-by: David Sterba <[email protected]>
2018-03-26btrfs: rename btrfs_close_extra_device to btrfs_free_extra_devidsAnand Jain3-6/+10
This function btrfs_close_extra_devices() is about freeing extra devids which once it may have belonged to this filesystem. So rename it and add the comment. The _devid suffix is appropriate as this function won't handle devices which are outside of the filesytem being mounted. Signed-off-by: Anand Jain <[email protected]> Signed-off-by: David Sterba <[email protected]>