Skip to content

Commit 037c50b

Browse files
committed
Merge tag 'for-5.16-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs updates from David Sterba: "The updates this time are more under the hood and enhancing existing features (subpage with compression and zoned namespaces). Performance related: - misc small inode logging improvements (+3% throughput, -11% latency on sample dbench workload) - more efficient directory logging: bulk item insertion, less tree searches and locking - speed up bulk insertion of items into a b-tree, which is used when logging directories, when running delayed items for directories (fsync and transaction commits) and when running the slow path (full sync) of an fsync (bulk creation run time -4%, deletion -12%) Core: - continued subpage support - make defragmentation work - make compression write work - zoned mode - support ZNS (zoned namespaces), zone capacity is number of usable blocks in each zone - add dedicated block group (zoned) for relocation, to prevent out of order writes in some cases - greedy block group reclaim, pick the ones with least usable space first - preparatory work for send protocol updates - error handling improvements - cleanups and refactoring Fixes: - lockdep warnings - in show_devname callback, on seeding device - device delete on loop device due to conversions to workqueues - fix deadlock between chunk allocation and chunk btree modifications - fix tracking of missing device count and status" * tag 'for-5.16-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (140 commits) btrfs: remove root argument from check_item_in_log() btrfs: remove root argument from add_link() btrfs: remove root argument from btrfs_unlink_inode() btrfs: remove root argument from drop_one_dir_item() btrfs: clear MISSING device status bit in btrfs_close_one_device btrfs: call btrfs_check_rw_degradable only if there is a missing device btrfs: send: prepare for v2 protocol btrfs: fix comment about sector sizes supported in 64K systems btrfs: update device path inode time instead of bd_inode fs: export an inode_update_time helper btrfs: fix deadlock when defragging transparent huge pages btrfs: sysfs: convert scnprintf and snprintf to sysfs_emit btrfs: make btrfs_super_block size match BTRFS_SUPER_INFO_SIZE btrfs: update comments for chunk allocation -ENOSPC cases btrfs: fix deadlock between chunk allocation and chunk btree modifications btrfs: zoned: use greedy gc for auto reclaim btrfs: check-integrity: stop storing the block device name in btrfsic_dev_state btrfs: use btrfs_get_dev_args_from_path in dev removal ioctls btrfs: add a btrfs_get_dev_args_from_path helper btrfs: handle device lookup with btrfs_dev_lookup_args ...
2 parents 2cf3f81 + d1ed82f commit 037c50b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4450
-2905
lines changed

fs/btrfs/block-group.c

Lines changed: 171 additions & 71 deletions
Large diffs are not rendered by default.

fs/btrfs/block-group.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ struct btrfs_block_group {
9898
unsigned int to_copy:1;
9999
unsigned int relocating_repair:1;
100100
unsigned int chunk_item_inserted:1;
101+
unsigned int zone_is_active:1;
101102

102103
int disk_cache_state;
103104

@@ -202,7 +203,10 @@ struct btrfs_block_group {
202203
*/
203204
u64 alloc_offset;
204205
u64 zone_unusable;
206+
u64 zone_capacity;
205207
u64 meta_write_pointer;
208+
struct map_lookup *physical_map;
209+
struct list_head active_bg_list;
206210
};
207211

208212
static inline u64 btrfs_block_group_end(struct btrfs_block_group *block_group)
@@ -280,7 +284,7 @@ int btrfs_start_dirty_block_groups(struct btrfs_trans_handle *trans);
280284
int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans);
281285
int btrfs_setup_space_cache(struct btrfs_trans_handle *trans);
282286
int btrfs_update_block_group(struct btrfs_trans_handle *trans,
283-
u64 bytenr, u64 num_bytes, int alloc);
287+
u64 bytenr, u64 num_bytes, bool alloc);
284288
int btrfs_add_reserved_bytes(struct btrfs_block_group *cache,
285289
u64 ram_bytes, u64 num_bytes, int delalloc);
286290
void btrfs_free_reserved_bytes(struct btrfs_block_group *cache,
@@ -289,6 +293,8 @@ int btrfs_chunk_alloc(struct btrfs_trans_handle *trans, u64 flags,
289293
enum btrfs_chunk_alloc_enum force);
290294
int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, u64 type);
291295
void check_system_chunk(struct btrfs_trans_handle *trans, const u64 type);
296+
void btrfs_reserve_chunk_metadata(struct btrfs_trans_handle *trans,
297+
bool is_item_insertion);
292298
u64 btrfs_get_alloc_profile(struct btrfs_fs_info *fs_info, u64 orig_flags);
293299
void btrfs_put_block_group_cache(struct btrfs_fs_info *info);
294300
int btrfs_free_block_groups(struct btrfs_fs_info *info);

fs/btrfs/btrfs_inode.h

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,17 +138,34 @@ struct btrfs_inode {
138138
/* a local copy of root's last_log_commit */
139139
int last_log_commit;
140140

141-
/* total number of bytes pending delalloc, used by stat to calc the
142-
* real block usage of the file
143-
*/
144-
u64 delalloc_bytes;
145-
146-
/*
147-
* Total number of bytes pending delalloc that fall within a file
148-
* range that is either a hole or beyond EOF (and no prealloc extent
149-
* exists in the range). This is always <= delalloc_bytes.
150-
*/
151-
u64 new_delalloc_bytes;
141+
union {
142+
/*
143+
* Total number of bytes pending delalloc, used by stat to
144+
* calculate the real block usage of the file. This is used
145+
* only for files.
146+
*/
147+
u64 delalloc_bytes;
148+
/*
149+
* The offset of the last dir item key that was logged.
150+
* This is used only for directories.
151+
*/
152+
u64 last_dir_item_offset;
153+
};
154+
155+
union {
156+
/*
157+
* Total number of bytes pending delalloc that fall within a file
158+
* range that is either a hole or beyond EOF (and no prealloc extent
159+
* exists in the range). This is always <= delalloc_bytes and this
160+
* is used only for files.
161+
*/
162+
u64 new_delalloc_bytes;
163+
/*
164+
* The offset of the last dir index key that was logged.
165+
* This is used only for directories.
166+
*/
167+
u64 last_dir_index_offset;
168+
};
152169

153170
/*
154171
* total number of bytes pending defrag, used by stat to check whether
@@ -339,7 +356,12 @@ static inline bool btrfs_inode_in_log(struct btrfs_inode *inode, u64 generation)
339356

340357
struct btrfs_dio_private {
341358
struct inode *inode;
342-
u64 logical_offset;
359+
360+
/*
361+
* Since DIO can use anonymous page, we cannot use page_offset() to
362+
* grab the file offset, thus need a dedicated member for file offset.
363+
*/
364+
u64 file_offset;
343365
u64 disk_bytenr;
344366
/* Used for bio::bi_size */
345367
u32 bytes;

0 commit comments

Comments
 (0)