Skip to content

Commit 18f4129

Browse files
author
Trond Myklebust
committed
NFS/pNFS: Allow O_DIRECT to release the DS commitinfo
Add a pNFS callback to allow the O_DIRECT code to release the DS commitinfo when freeing the dreq. Signed-off-by: Trond Myklebust <[email protected]>
1 parent 0cb1f6d commit 18f4129

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

fs/nfs/direct.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ static void nfs_direct_req_free(struct kref *kref)
317317
{
318318
struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref);
319319

320+
pnfs_release_ds_info(&dreq->ds_cinfo, dreq->inode);
320321
nfs_free_pnfs_ds_cinfo(&dreq->ds_cinfo);
321322
if (dreq->l_ctx != NULL)
322323
nfs_put_lock_context(dreq->l_ctx);

fs/nfs/pnfs.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ struct pnfs_layoutdriver_type {
149149
const struct nfs_pageio_ops *pg_write_ops;
150150

151151
struct pnfs_ds_commit_info *(*get_ds_info) (struct inode *inode);
152+
void (*release_ds_info)(struct pnfs_ds_commit_info *,
153+
struct inode *inode);
152154
void (*mark_request_commit) (struct nfs_page *req,
153155
struct pnfs_layout_segment *lseg,
154156
struct nfs_commit_info *cinfo,
@@ -468,6 +470,15 @@ pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
468470
INIT_LIST_HEAD(&fl_cinfo->commits);
469471
}
470472

473+
static inline void
474+
pnfs_release_ds_info(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
475+
{
476+
struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
477+
478+
if (ld != NULL && ld->release_ds_info != NULL)
479+
ld->release_ds_info(fl_cinfo, inode);
480+
}
481+
471482
static inline void
472483
pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node)
473484
{
@@ -770,6 +781,11 @@ pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
770781
{
771782
}
772783

784+
static inline void
785+
pnfs_release_ds_info(struct pnfs_ds_commit_info *fl_cinfo, struct inode *inode)
786+
{
787+
}
788+
773789
static inline bool
774790
pnfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg,
775791
struct nfs_commit_info *cinfo, u32 ds_commit_idx)

0 commit comments

Comments
 (0)