Skip to content

Commit bd1b7c1

Browse files
committed
Merge tag 'for-5.19-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs updates from David Sterba: "Features: - subpage: - support for PAGE_SIZE > 4K (previously only 64K) - make it work with raid56 - repair super block num_devices automatically if it does not match the number of device items - defrag can convert inline extents to regular extents, up to now inline files were skipped but the setting of mount option max_inline could affect the decision logic - zoned: - minimal accepted zone size is explicitly set to 4MiB - make zone reclaim less aggressive and don't reclaim if there are enough free zones - add per-profile sysfs tunable of the reclaim threshold - allow automatic block group reclaim for non-zoned filesystems, with sysfs tunables - tree-checker: new check, compare extent buffer owner against owner rootid Performance: - avoid blocking on space reservation when doing nowait direct io writes (+7% throughput for reads and writes) - NOCOW write throughput improvement due to refined locking (+3%) - send: reduce pressure to page cache by dropping extent pages right after they're processed Core: - convert all radix trees to xarray - add iterators for b-tree node items - support printk message index - user bulk page allocation for extent buffers - switch to bio_alloc API, use on-stack bios where convenient, other bio cleanups - use rw lock for block groups to favor concurrent reads - simplify workques, don't allocate high priority threads for all normal queues as we need only one - refactor scrub, process chunks based on their constraints and similarity - allocate direct io structures on stack and pass around only pointers, avoids allocation and reduces potential error handling Fixes: - fix count of reserved transaction items for various inode operations - fix deadlock between concurrent dio writes when low on free data space - fix a few cases when zones need to be finished VFS, iomap: - add helper to check if sb write has started (usable for assertions) - new helper iomap_dio_alloc_bio, export iomap_dio_bio_end_io" * tag 'for-5.19-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: (173 commits) btrfs: zoned: introduce a minimal zone size 4M and reject mount btrfs: allow defrag to convert inline extents to regular extents btrfs: add "0x" prefix for unsupported optional features btrfs: do not account twice for inode ref when reserving metadata units btrfs: zoned: fix comparison of alloc_offset vs meta_write_pointer btrfs: send: avoid trashing the page cache btrfs: send: keep the current inode open while processing it btrfs: allocate the btrfs_dio_private as part of the iomap dio bio btrfs: move struct btrfs_dio_private to inode.c btrfs: remove the disk_bytenr in struct btrfs_dio_private btrfs: allocate dio_data on stack iomap: add per-iomap_iter private data iomap: allow the file system to provide a bio_set for direct I/O btrfs: add a btrfs_dio_rw wrapper btrfs: zoned: zone finish unused block group btrfs: zoned: properly finish block group on metadata write btrfs: zoned: finish block group when there are no more allocatable bytes left btrfs: zoned: consolidate zone finish functions btrfs: zoned: introduce btrfs_zoned_bg_is_full btrfs: improve error reporting in lookup_inline_extent_backref ...
2 parents 3842007 + 0a05faf commit bd1b7c1

Some content is hidden

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

67 files changed

+4482
-4221
lines changed

fs/btrfs/acl.c

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@ struct posix_acl *btrfs_get_acl(struct inode *inode, int type, bool rcu)
5555
return acl;
5656
}
5757

58-
static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
59-
struct user_namespace *mnt_userns,
60-
struct inode *inode, struct posix_acl *acl, int type)
58+
int __btrfs_set_acl(struct btrfs_trans_handle *trans, struct inode *inode,
59+
struct posix_acl *acl, int type)
6160
{
6261
int ret, size = 0;
6362
const char *name;
@@ -123,40 +122,8 @@ int btrfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
123122
if (ret)
124123
return ret;
125124
}
126-
ret = __btrfs_set_acl(NULL, mnt_userns, inode, acl, type);
125+
ret = __btrfs_set_acl(NULL, inode, acl, type);
127126
if (ret)
128127
inode->i_mode = old_mode;
129128
return ret;
130129
}
131-
132-
int btrfs_init_acl(struct btrfs_trans_handle *trans,
133-
struct inode *inode, struct inode *dir)
134-
{
135-
struct posix_acl *default_acl, *acl;
136-
int ret = 0;
137-
138-
/* this happens with subvols */
139-
if (!dir)
140-
return 0;
141-
142-
ret = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl);
143-
if (ret)
144-
return ret;
145-
146-
if (default_acl) {
147-
ret = __btrfs_set_acl(trans, &init_user_ns, inode, default_acl,
148-
ACL_TYPE_DEFAULT);
149-
posix_acl_release(default_acl);
150-
}
151-
152-
if (acl) {
153-
if (!ret)
154-
ret = __btrfs_set_acl(trans, &init_user_ns, inode, acl,
155-
ACL_TYPE_ACCESS);
156-
posix_acl_release(acl);
157-
}
158-
159-
if (!default_acl && !acl)
160-
cache_no_acl(inode);
161-
return ret;
162-
}

fs/btrfs/async-thread.c

Lines changed: 22 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
enum {
1616
WORK_DONE_BIT,
1717
WORK_ORDER_DONE_BIT,
18-
WORK_HIGH_PRIO_BIT,
1918
};
2019

2120
#define NO_THRESHOLD (-1)
2221
#define DFT_THRESHOLD (32)
2322

24-
struct __btrfs_workqueue {
23+
struct btrfs_workqueue {
2524
struct workqueue_struct *normal_wq;
2625

2726
/* File system this workqueue services */
@@ -48,12 +47,7 @@ struct __btrfs_workqueue {
4847
spinlock_t thres_lock;
4948
};
5049

51-
struct btrfs_workqueue {
52-
struct __btrfs_workqueue *normal;
53-
struct __btrfs_workqueue *high;
54-
};
55-
56-
struct btrfs_fs_info * __pure btrfs_workqueue_owner(const struct __btrfs_workqueue *wq)
50+
struct btrfs_fs_info * __pure btrfs_workqueue_owner(const struct btrfs_workqueue *wq)
5751
{
5852
return wq->fs_info;
5953
}
@@ -66,22 +60,22 @@ struct btrfs_fs_info * __pure btrfs_work_owner(const struct btrfs_work *work)
6660
bool btrfs_workqueue_normal_congested(const struct btrfs_workqueue *wq)
6761
{
6862
/*
69-
* We could compare wq->normal->pending with num_online_cpus()
63+
* We could compare wq->pending with num_online_cpus()
7064
* to support "thresh == NO_THRESHOLD" case, but it requires
7165
* moving up atomic_inc/dec in thresh_queue/exec_hook. Let's
7266
* postpone it until someone needs the support of that case.
7367
*/
74-
if (wq->normal->thresh == NO_THRESHOLD)
68+
if (wq->thresh == NO_THRESHOLD)
7569
return false;
7670

77-
return atomic_read(&wq->normal->pending) > wq->normal->thresh * 2;
71+
return atomic_read(&wq->pending) > wq->thresh * 2;
7872
}
7973

80-
static struct __btrfs_workqueue *
81-
__btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info, const char *name,
82-
unsigned int flags, int limit_active, int thresh)
74+
struct btrfs_workqueue *btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info,
75+
const char *name, unsigned int flags,
76+
int limit_active, int thresh)
8377
{
84-
struct __btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_KERNEL);
78+
struct btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_KERNEL);
8579

8680
if (!ret)
8781
return NULL;
@@ -105,12 +99,8 @@ __btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info, const char *name,
10599
ret->thresh = thresh;
106100
}
107101

108-
if (flags & WQ_HIGHPRI)
109-
ret->normal_wq = alloc_workqueue("btrfs-%s-high", flags,
110-
ret->current_active, name);
111-
else
112-
ret->normal_wq = alloc_workqueue("btrfs-%s", flags,
113-
ret->current_active, name);
102+
ret->normal_wq = alloc_workqueue("btrfs-%s", flags, ret->current_active,
103+
name);
114104
if (!ret->normal_wq) {
115105
kfree(ret);
116106
return NULL;
@@ -119,41 +109,7 @@ __btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info, const char *name,
119109
INIT_LIST_HEAD(&ret->ordered_list);
120110
spin_lock_init(&ret->list_lock);
121111
spin_lock_init(&ret->thres_lock);
122-
trace_btrfs_workqueue_alloc(ret, name, flags & WQ_HIGHPRI);
123-
return ret;
124-
}
125-
126-
static inline void
127-
__btrfs_destroy_workqueue(struct __btrfs_workqueue *wq);
128-
129-
struct btrfs_workqueue *btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info,
130-
const char *name,
131-
unsigned int flags,
132-
int limit_active,
133-
int thresh)
134-
{
135-
struct btrfs_workqueue *ret = kzalloc(sizeof(*ret), GFP_KERNEL);
136-
137-
if (!ret)
138-
return NULL;
139-
140-
ret->normal = __btrfs_alloc_workqueue(fs_info, name,
141-
flags & ~WQ_HIGHPRI,
142-
limit_active, thresh);
143-
if (!ret->normal) {
144-
kfree(ret);
145-
return NULL;
146-
}
147-
148-
if (flags & WQ_HIGHPRI) {
149-
ret->high = __btrfs_alloc_workqueue(fs_info, name, flags,
150-
limit_active, thresh);
151-
if (!ret->high) {
152-
__btrfs_destroy_workqueue(ret->normal);
153-
kfree(ret);
154-
return NULL;
155-
}
156-
}
112+
trace_btrfs_workqueue_alloc(ret, name);
157113
return ret;
158114
}
159115

@@ -162,7 +118,7 @@ struct btrfs_workqueue *btrfs_alloc_workqueue(struct btrfs_fs_info *fs_info,
162118
* This hook WILL be called in IRQ handler context,
163119
* so workqueue_set_max_active MUST NOT be called in this hook
164120
*/
165-
static inline void thresh_queue_hook(struct __btrfs_workqueue *wq)
121+
static inline void thresh_queue_hook(struct btrfs_workqueue *wq)
166122
{
167123
if (wq->thresh == NO_THRESHOLD)
168124
return;
@@ -174,7 +130,7 @@ static inline void thresh_queue_hook(struct __btrfs_workqueue *wq)
174130
* This hook is called in kthread content.
175131
* So workqueue_set_max_active is called here.
176132
*/
177-
static inline void thresh_exec_hook(struct __btrfs_workqueue *wq)
133+
static inline void thresh_exec_hook(struct btrfs_workqueue *wq)
178134
{
179135
int new_current_active;
180136
long pending;
@@ -217,7 +173,7 @@ static inline void thresh_exec_hook(struct __btrfs_workqueue *wq)
217173
}
218174
}
219175

220-
static void run_ordered_work(struct __btrfs_workqueue *wq,
176+
static void run_ordered_work(struct btrfs_workqueue *wq,
221177
struct btrfs_work *self)
222178
{
223179
struct list_head *list = &wq->ordered_list;
@@ -305,7 +261,7 @@ static void btrfs_work_helper(struct work_struct *normal_work)
305261
{
306262
struct btrfs_work *work = container_of(normal_work, struct btrfs_work,
307263
normal_work);
308-
struct __btrfs_workqueue *wq;
264+
struct btrfs_workqueue *wq = work->wq;
309265
int need_order = 0;
310266

311267
/*
@@ -318,7 +274,6 @@ static void btrfs_work_helper(struct work_struct *normal_work)
318274
*/
319275
if (work->ordered_func)
320276
need_order = 1;
321-
wq = work->wq;
322277

323278
trace_btrfs_work_sched(work);
324279
thresh_exec_hook(wq);
@@ -350,8 +305,7 @@ void btrfs_init_work(struct btrfs_work *work, btrfs_func_t func,
350305
work->flags = 0;
351306
}
352307

353-
static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq,
354-
struct btrfs_work *work)
308+
void btrfs_queue_work(struct btrfs_workqueue *wq, struct btrfs_work *work)
355309
{
356310
unsigned long flags;
357311

@@ -366,54 +320,22 @@ static inline void __btrfs_queue_work(struct __btrfs_workqueue *wq,
366320
queue_work(wq->normal_wq, &work->normal_work);
367321
}
368322

369-
void btrfs_queue_work(struct btrfs_workqueue *wq,
370-
struct btrfs_work *work)
371-
{
372-
struct __btrfs_workqueue *dest_wq;
373-
374-
if (test_bit(WORK_HIGH_PRIO_BIT, &work->flags) && wq->high)
375-
dest_wq = wq->high;
376-
else
377-
dest_wq = wq->normal;
378-
__btrfs_queue_work(dest_wq, work);
379-
}
380-
381-
static inline void
382-
__btrfs_destroy_workqueue(struct __btrfs_workqueue *wq)
383-
{
384-
destroy_workqueue(wq->normal_wq);
385-
trace_btrfs_workqueue_destroy(wq);
386-
kfree(wq);
387-
}
388-
389323
void btrfs_destroy_workqueue(struct btrfs_workqueue *wq)
390324
{
391325
if (!wq)
392326
return;
393-
if (wq->high)
394-
__btrfs_destroy_workqueue(wq->high);
395-
__btrfs_destroy_workqueue(wq->normal);
327+
destroy_workqueue(wq->normal_wq);
328+
trace_btrfs_workqueue_destroy(wq);
396329
kfree(wq);
397330
}
398331

399332
void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int limit_active)
400333
{
401-
if (!wq)
402-
return;
403-
wq->normal->limit_active = limit_active;
404-
if (wq->high)
405-
wq->high->limit_active = limit_active;
406-
}
407-
408-
void btrfs_set_work_high_priority(struct btrfs_work *work)
409-
{
410-
set_bit(WORK_HIGH_PRIO_BIT, &work->flags);
334+
if (wq)
335+
wq->limit_active = limit_active;
411336
}
412337

413338
void btrfs_flush_workqueue(struct btrfs_workqueue *wq)
414339
{
415-
if (wq->high)
416-
flush_workqueue(wq->high->normal_wq);
417-
418-
flush_workqueue(wq->normal->normal_wq);
340+
flush_workqueue(wq->normal_wq);
419341
}

fs/btrfs/async-thread.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
struct btrfs_fs_info;
1313
struct btrfs_workqueue;
14-
/* Internal use only */
15-
struct __btrfs_workqueue;
1614
struct btrfs_work;
1715
typedef void (*btrfs_func_t)(struct btrfs_work *arg);
1816
typedef void (*btrfs_work_func_t)(struct work_struct *arg);
@@ -25,7 +23,7 @@ struct btrfs_work {
2523
/* Don't touch things below */
2624
struct work_struct normal_work;
2725
struct list_head ordered_list;
28-
struct __btrfs_workqueue *wq;
26+
struct btrfs_workqueue *wq;
2927
unsigned long flags;
3028
};
3129

@@ -40,9 +38,8 @@ void btrfs_queue_work(struct btrfs_workqueue *wq,
4038
struct btrfs_work *work);
4139
void btrfs_destroy_workqueue(struct btrfs_workqueue *wq);
4240
void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max);
43-
void btrfs_set_work_high_priority(struct btrfs_work *work);
4441
struct btrfs_fs_info * __pure btrfs_work_owner(const struct btrfs_work *work);
45-
struct btrfs_fs_info * __pure btrfs_workqueue_owner(const struct __btrfs_workqueue *wq);
42+
struct btrfs_fs_info * __pure btrfs_workqueue_owner(const struct btrfs_workqueue *wq);
4643
bool btrfs_workqueue_normal_congested(const struct btrfs_workqueue *wq);
4744
void btrfs_flush_workqueue(struct btrfs_workqueue *wq);
4845

0 commit comments

Comments
 (0)