]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFS/pNFS: Allow O_DIRECT to release the DS commitinfo
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 20 Mar 2020 21:08:02 +0000 (17:08 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 27 Mar 2020 20:34:34 +0000 (16:34 -0400)
Add a pNFS callback to allow the O_DIRECT code to release the DS
commitinfo when freeing the dreq.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/direct.c
fs/nfs/pnfs.h

index f9a73febce02f2f8213e140f237cb0d78f22e4ba..7ef7f71ae3152ca83519ffada90bd0eada52f0f9 100644 (file)
@@ -317,6 +317,7 @@ static void nfs_direct_req_free(struct kref *kref)
 {
        struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref);
 
+       pnfs_release_ds_info(&dreq->ds_cinfo, dreq->inode);
        nfs_free_pnfs_ds_cinfo(&dreq->ds_cinfo);
        if (dreq->l_ctx != NULL)
                nfs_put_lock_context(dreq->l_ctx);
index b293afb48d044ced5664a862c9ca98464e072616..2ec97b419b56792a53c167e96abb9e06fbc041fe 100644 (file)
@@ -149,6 +149,8 @@ struct pnfs_layoutdriver_type {
        const struct nfs_pageio_ops *pg_write_ops;
 
        struct pnfs_ds_commit_info *(*get_ds_info) (struct inode *inode);
+       void (*release_ds_info)(struct pnfs_ds_commit_info *,
+                               struct inode *inode);
        void (*mark_request_commit) (struct nfs_page *req,
                                     struct pnfs_layout_segment *lseg,
                                     struct nfs_commit_info *cinfo,
@@ -468,6 +470,15 @@ pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
        INIT_LIST_HEAD(&fl_cinfo->commits);
 }
 
+static inline void
+pnfs_release_ds_info(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
+{
+       struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
+
+       if (ld != NULL && ld->release_ds_info != NULL)
+               ld->release_ds_info(fl_cinfo, inode);
+}
+
 static inline void
 pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node)
 {
@@ -770,6 +781,11 @@ pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
 {
 }
 
+static inline void
+pnfs_release_ds_info(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
+{
+}
+
 static inline bool
 pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
                         struct nfs_commit_info *cinfo, u32 ds_commit_idx)