diff options
author | David Howells <dhowells@redhat.com> | 2017-11-02 11:27:44 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2017-11-13 10:38:16 -0500 |
commit | 5e4def20381678ba3ce0a4e117f97e378ecd81bc (patch) | |
tree | 455d2c682d9430a06bf2eb91b12e7eba9b1a645e /fs | |
parent | 81445e63e67a1e98b1c2575fa2b406d4289d2754 (diff) |
Pass mode to wait_on_atomic_t() action funcs and provide default actions
Make wait_on_atomic_t() pass the TASK_* mode onto its action function as an
extra argument and make it 'unsigned int throughout.
Also, consolidate a bunch of identical action functions into a default
function that can do the appropriate thing for the mode.
Also, change the argument name in the bit_wait*() function declarations to
reflect the fact that it's the mode and not the bit number.
[Peter Z gives this a grudging ACK, but thinks that the whole atomic_t wait
should be done differently, though he's not immediately sure as to how]
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
cc: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/afs/rxrpc.c | 8 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 27 | ||||
-rw-r--r-- | fs/fscache/cookie.c | 2 | ||||
-rw-r--r-- | fs/fscache/internal.h | 2 | ||||
-rw-r--r-- | fs/fscache/main.c | 9 | ||||
-rw-r--r-- | fs/nfs/inode.c | 4 | ||||
-rw-r--r-- | fs/nfs/internal.h | 2 | ||||
-rw-r--r-- | fs/ocfs2/filecheck.c | 8 |
8 files changed, 9 insertions, 53 deletions
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index bb1e2caa1720..77f5420a1a24 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c | |||
@@ -41,12 +41,6 @@ static void afs_charge_preallocation(struct work_struct *); | |||
41 | 41 | ||
42 | static DECLARE_WORK(afs_charge_preallocation_work, afs_charge_preallocation); | 42 | static DECLARE_WORK(afs_charge_preallocation_work, afs_charge_preallocation); |
43 | 43 | ||
44 | static int afs_wait_atomic_t(atomic_t *p) | ||
45 | { | ||
46 | schedule(); | ||
47 | return 0; | ||
48 | } | ||
49 | |||
50 | /* | 44 | /* |
51 | * open an RxRPC socket and bind it to be a server for callback notifications | 45 | * open an RxRPC socket and bind it to be a server for callback notifications |
52 | * - the socket is left in blocking mode and non-blocking ops use MSG_DONTWAIT | 46 | * - the socket is left in blocking mode and non-blocking ops use MSG_DONTWAIT |
@@ -121,7 +115,7 @@ void afs_close_socket(void) | |||
121 | } | 115 | } |
122 | 116 | ||
123 | _debug("outstanding %u", atomic_read(&afs_outstanding_calls)); | 117 | _debug("outstanding %u", atomic_read(&afs_outstanding_calls)); |
124 | wait_on_atomic_t(&afs_outstanding_calls, afs_wait_atomic_t, | 118 | wait_on_atomic_t(&afs_outstanding_calls, atomic_t_wait, |
125 | TASK_UNINTERRUPTIBLE); | 119 | TASK_UNINTERRUPTIBLE); |
126 | _debug("no outstanding calls"); | 120 | _debug("no outstanding calls"); |
127 | 121 | ||
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index e2d7e86b51d1..24cefde30e30 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -4016,16 +4016,9 @@ void btrfs_dec_nocow_writers(struct btrfs_fs_info *fs_info, u64 bytenr) | |||
4016 | btrfs_put_block_group(bg); | 4016 | btrfs_put_block_group(bg); |
4017 | } | 4017 | } |
4018 | 4018 | ||
4019 | static int btrfs_wait_nocow_writers_atomic_t(atomic_t *a) | ||
4020 | { | ||
4021 | schedule(); | ||
4022 | return 0; | ||
4023 | } | ||
4024 | |||
4025 | void btrfs_wait_nocow_writers(struct btrfs_block_group_cache *bg) | 4019 | void btrfs_wait_nocow_writers(struct btrfs_block_group_cache *bg) |
4026 | { | 4020 | { |
4027 | wait_on_atomic_t(&bg->nocow_writers, | 4021 | wait_on_atomic_t(&bg->nocow_writers, atomic_t_wait, |
4028 | btrfs_wait_nocow_writers_atomic_t, | ||
4029 | TASK_UNINTERRUPTIBLE); | 4022 | TASK_UNINTERRUPTIBLE); |
4030 | } | 4023 | } |
4031 | 4024 | ||
@@ -6595,12 +6588,6 @@ void btrfs_dec_block_group_reservations(struct btrfs_fs_info *fs_info, | |||
6595 | btrfs_put_block_group(bg); | 6588 | btrfs_put_block_group(bg); |
6596 | } | 6589 | } |
6597 | 6590 | ||
6598 | static int btrfs_wait_bg_reservations_atomic_t(atomic_t *a) | ||
6599 | { | ||
6600 | schedule(); | ||
6601 | return 0; | ||
6602 | } | ||
6603 | |||
6604 | void btrfs_wait_block_group_reservations(struct btrfs_block_group_cache *bg) | 6591 | void btrfs_wait_block_group_reservations(struct btrfs_block_group_cache *bg) |
6605 | { | 6592 | { |
6606 | struct btrfs_space_info *space_info = bg->space_info; | 6593 | struct btrfs_space_info *space_info = bg->space_info; |
@@ -6623,8 +6610,7 @@ void btrfs_wait_block_group_reservations(struct btrfs_block_group_cache *bg) | |||
6623 | down_write(&space_info->groups_sem); | 6610 | down_write(&space_info->groups_sem); |
6624 | up_write(&space_info->groups_sem); | 6611 | up_write(&space_info->groups_sem); |
6625 | 6612 | ||
6626 | wait_on_atomic_t(&bg->reservations, | 6613 | wait_on_atomic_t(&bg->reservations, atomic_t_wait, |
6627 | btrfs_wait_bg_reservations_atomic_t, | ||
6628 | TASK_UNINTERRUPTIBLE); | 6614 | TASK_UNINTERRUPTIBLE); |
6629 | } | 6615 | } |
6630 | 6616 | ||
@@ -11106,12 +11092,6 @@ int btrfs_start_write_no_snapshotting(struct btrfs_root *root) | |||
11106 | return 1; | 11092 | return 1; |
11107 | } | 11093 | } |
11108 | 11094 | ||
11109 | static int wait_snapshotting_atomic_t(atomic_t *a) | ||
11110 | { | ||
11111 | schedule(); | ||
11112 | return 0; | ||
11113 | } | ||
11114 | |||
11115 | void btrfs_wait_for_snapshot_creation(struct btrfs_root *root) | 11095 | void btrfs_wait_for_snapshot_creation(struct btrfs_root *root) |
11116 | { | 11096 | { |
11117 | while (true) { | 11097 | while (true) { |
@@ -11120,8 +11100,7 @@ void btrfs_wait_for_snapshot_creation(struct btrfs_root *root) | |||
11120 | ret = btrfs_start_write_no_snapshotting(root); | 11100 | ret = btrfs_start_write_no_snapshotting(root); |
11121 | if (ret) | 11101 | if (ret) |
11122 | break; | 11102 | break; |
11123 | wait_on_atomic_t(&root->will_be_snapshotted, | 11103 | wait_on_atomic_t(&root->will_be_snapshotted, atomic_t_wait, |
11124 | wait_snapshotting_atomic_t, | ||
11125 | TASK_UNINTERRUPTIBLE); | 11104 | TASK_UNINTERRUPTIBLE); |
11126 | } | 11105 | } |
11127 | } | 11106 | } |
diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c index 40d61077bead..ff84258132bb 100644 --- a/fs/fscache/cookie.c +++ b/fs/fscache/cookie.c | |||
@@ -558,7 +558,7 @@ void __fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate) | |||
558 | * have completed. | 558 | * have completed. |
559 | */ | 559 | */ |
560 | if (!atomic_dec_and_test(&cookie->n_active)) | 560 | if (!atomic_dec_and_test(&cookie->n_active)) |
561 | wait_on_atomic_t(&cookie->n_active, fscache_wait_atomic_t, | 561 | wait_on_atomic_t(&cookie->n_active, atomic_t_wait, |
562 | TASK_UNINTERRUPTIBLE); | 562 | TASK_UNINTERRUPTIBLE); |
563 | 563 | ||
564 | /* Make sure any pending writes are cancelled. */ | 564 | /* Make sure any pending writes are cancelled. */ |
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h index 97ec45110957..0ff4b49a0037 100644 --- a/fs/fscache/internal.h +++ b/fs/fscache/internal.h | |||
@@ -97,8 +97,6 @@ static inline bool fscache_object_congested(void) | |||
97 | return workqueue_congested(WORK_CPU_UNBOUND, fscache_object_wq); | 97 | return workqueue_congested(WORK_CPU_UNBOUND, fscache_object_wq); |
98 | } | 98 | } |
99 | 99 | ||
100 | extern int fscache_wait_atomic_t(atomic_t *); | ||
101 | |||
102 | /* | 100 | /* |
103 | * object.c | 101 | * object.c |
104 | */ | 102 | */ |
diff --git a/fs/fscache/main.c b/fs/fscache/main.c index b39d487ccfb0..249968dcbf5c 100644 --- a/fs/fscache/main.c +++ b/fs/fscache/main.c | |||
@@ -195,12 +195,3 @@ static void __exit fscache_exit(void) | |||
195 | } | 195 | } |
196 | 196 | ||
197 | module_exit(fscache_exit); | 197 | module_exit(fscache_exit); |
198 | |||
199 | /* | ||
200 | * wait_on_atomic_t() sleep function for uninterruptible waiting | ||
201 | */ | ||
202 | int fscache_wait_atomic_t(atomic_t *p) | ||
203 | { | ||
204 | schedule(); | ||
205 | return 0; | ||
206 | } | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 134d9f560240..1629056aa2c9 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -85,9 +85,9 @@ int nfs_wait_bit_killable(struct wait_bit_key *key, int mode) | |||
85 | } | 85 | } |
86 | EXPORT_SYMBOL_GPL(nfs_wait_bit_killable); | 86 | EXPORT_SYMBOL_GPL(nfs_wait_bit_killable); |
87 | 87 | ||
88 | int nfs_wait_atomic_killable(atomic_t *p) | 88 | int nfs_wait_atomic_killable(atomic_t *p, unsigned int mode) |
89 | { | 89 | { |
90 | return nfs_wait_killable(TASK_KILLABLE); | 90 | return nfs_wait_killable(mode); |
91 | } | 91 | } |
92 | 92 | ||
93 | /** | 93 | /** |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index f9a4a5524bd5..5ab17fd4700a 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -388,7 +388,7 @@ extern void nfs_evict_inode(struct inode *); | |||
388 | void nfs_zap_acl_cache(struct inode *inode); | 388 | void nfs_zap_acl_cache(struct inode *inode); |
389 | extern bool nfs_check_cache_invalid(struct inode *, unsigned long); | 389 | extern bool nfs_check_cache_invalid(struct inode *, unsigned long); |
390 | extern int nfs_wait_bit_killable(struct wait_bit_key *key, int mode); | 390 | extern int nfs_wait_bit_killable(struct wait_bit_key *key, int mode); |
391 | extern int nfs_wait_atomic_killable(atomic_t *p); | 391 | extern int nfs_wait_atomic_killable(atomic_t *p, unsigned int mode); |
392 | 392 | ||
393 | /* super.c */ | 393 | /* super.c */ |
394 | extern const struct super_operations nfs_sops; | 394 | extern const struct super_operations nfs_sops; |
diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c index 2cabbcf2f28e..e87279e49ba3 100644 --- a/fs/ocfs2/filecheck.c +++ b/fs/ocfs2/filecheck.c | |||
@@ -129,19 +129,13 @@ static struct kobj_attribute ocfs2_attr_filecheck_set = | |||
129 | ocfs2_filecheck_show, | 129 | ocfs2_filecheck_show, |
130 | ocfs2_filecheck_store); | 130 | ocfs2_filecheck_store); |
131 | 131 | ||
132 | static int ocfs2_filecheck_sysfs_wait(atomic_t *p) | ||
133 | { | ||
134 | schedule(); | ||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | static void | 132 | static void |
139 | ocfs2_filecheck_sysfs_free(struct ocfs2_filecheck_sysfs_entry *entry) | 133 | ocfs2_filecheck_sysfs_free(struct ocfs2_filecheck_sysfs_entry *entry) |
140 | { | 134 | { |
141 | struct ocfs2_filecheck_entry *p; | 135 | struct ocfs2_filecheck_entry *p; |
142 | 136 | ||
143 | if (!atomic_dec_and_test(&entry->fs_count)) | 137 | if (!atomic_dec_and_test(&entry->fs_count)) |
144 | wait_on_atomic_t(&entry->fs_count, ocfs2_filecheck_sysfs_wait, | 138 | wait_on_atomic_t(&entry->fs_count, atomic_t_wait, |
145 | TASK_UNINTERRUPTIBLE); | 139 | TASK_UNINTERRUPTIBLE); |
146 | 140 | ||
147 | spin_lock(&entry->fs_fcheck->fc_lock); | 141 | spin_lock(&entry->fs_fcheck->fc_lock); |