[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211210073619.21667-6-jefflexu@linux.alibaba.com>
Date: Fri, 10 Dec 2021 15:36:05 +0800
From: Jeffle Xu <jefflexu@...ux.alibaba.com>
To: dhowells@...hat.com, linux-cachefs@...hat.com, xiang@...nel.org,
chao@...nel.org, linux-erofs@...ts.ozlabs.org
Cc: linux-fsdevel@...r.kernel.org, joseph.qi@...ux.alibaba.com,
bo.liu@...ux.alibaba.com, tao.peng@...ux.alibaba.com,
gerry@...ux.alibaba.com, eguan@...ux.alibaba.com,
linux-kernel@...r.kernel.org
Subject: [RFC 05/19] netfs: refactor netfs_alloc_read_request
Signed-off-by: Jeffle Xu <jefflexu@...ux.alibaba.com>
---
fs/netfs/read_helper.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c
index 4247916c7100..9240b85548e4 100644
--- a/fs/netfs/read_helper.c
+++ b/fs/netfs/read_helper.c
@@ -37,7 +37,7 @@ static void netfs_put_subrequest(struct netfs_read_subrequest *subreq,
__netfs_put_subrequest(subreq, was_async);
}
-static struct netfs_read_request *netfs_alloc_read_request(
+static struct netfs_read_request *__netfs_alloc_read_request(
const struct netfs_read_request_ops *ops, void *netfs_priv,
struct file *file)
{
@@ -48,8 +48,6 @@ static struct netfs_read_request *netfs_alloc_read_request(
if (rreq) {
rreq->netfs_ops = ops;
rreq->netfs_priv = netfs_priv;
- rreq->inode = file_inode(file);
- rreq->i_size = i_size_read(rreq->inode);
rreq->debug_id = atomic_inc_return(&debug_ids);
INIT_LIST_HEAD(&rreq->subrequests);
INIT_WORK(&rreq->work, netfs_rreq_work);
@@ -63,6 +61,21 @@ static struct netfs_read_request *netfs_alloc_read_request(
return rreq;
}
+static struct netfs_read_request *netfs_alloc_read_request(
+ const struct netfs_read_request_ops *ops, void *netfs_priv,
+ struct file *file)
+{
+ struct netfs_read_request *rreq;
+
+ rreq = __netfs_alloc_read_request(ops, netfs_priv, file);
+ if (rreq) {
+ rreq->inode = file_inode(file);
+ rreq->i_size = i_size_read(rreq->inode);
+ }
+
+ return rreq;
+}
+
static void netfs_get_read_request(struct netfs_read_request *rreq)
{
refcount_inc(&rreq->usage);
--
2.27.0
Powered by blists - more mailing lists