* [PATCH] ceph: add a queue_inode_work helper
@ 2020-10-12 15:16 Jeff Layton
0 siblings, 0 replies; only message in thread
From: Jeff Layton @ 2020-10-12 15:16 UTC (permalink / raw)
To: ceph-devel
Currently, this is open-coded everywhere. Add a wrapper around
queue_work that takes an inode pointer.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ceph/inode.c | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 02b11a4a4d39..7c22bc2ea076 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1801,6 +1801,13 @@ bool ceph_inode_set_size(struct inode *inode, loff_t size)
return ret;
}
+static bool queue_inode_work(struct inode *inode)
+{
+ struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
+
+ return queue_work(fsc->inode_wq, &ceph_inode(inode)->i_work);
+}
+
/*
* Put reference to inode, but avoid calling iput_final() in current thread.
* iput_final() may wait for reahahead pages. The wait can cause deadlock in
@@ -1813,8 +1820,7 @@ void ceph_async_iput(struct inode *inode)
for (;;) {
if (atomic_add_unless(&inode->i_count, -1, 1))
break;
- if (queue_work(ceph_inode_to_client(inode)->inode_wq,
- &ceph_inode(inode)->i_work))
+ if (queue_inode_work(inode))
break;
/* queue work failed, i_count must be at least 2 */
}
@@ -1830,8 +1836,7 @@ void ceph_queue_writeback(struct inode *inode)
set_bit(CEPH_I_WORK_WRITEBACK, &ci->i_work_mask);
ihold(inode);
- if (queue_work(ceph_inode_to_client(inode)->inode_wq,
- &ci->i_work)) {
+ if (queue_inode_work(inode)) {
dout("ceph_queue_writeback %p\n", inode);
} else {
dout("ceph_queue_writeback %p already queued, mask=%lx\n",
@@ -1849,8 +1854,7 @@ void ceph_queue_invalidate(struct inode *inode)
set_bit(CEPH_I_WORK_INVALIDATE_PAGES, &ci->i_work_mask);
ihold(inode);
- if (queue_work(ceph_inode_to_client(inode)->inode_wq,
- &ceph_inode(inode)->i_work)) {
+ if (queue_inode_work(inode)) {
dout("ceph_queue_invalidate %p\n", inode);
} else {
dout("ceph_queue_invalidate %p already queued, mask=%lx\n",
@@ -1869,8 +1873,7 @@ void ceph_queue_vmtruncate(struct inode *inode)
set_bit(CEPH_I_WORK_VMTRUNCATE, &ci->i_work_mask);
ihold(inode);
- if (queue_work(ceph_inode_to_client(inode)->inode_wq,
- &ci->i_work)) {
+ if (queue_inode_work(inode)) {
dout("ceph_queue_vmtruncate %p\n", inode);
} else {
dout("ceph_queue_vmtruncate %p already queued, mask=%lx\n",
--
2.26.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-12 15:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 15:16 [PATCH] ceph: add a queue_inode_work helper Jeff Layton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).