All of lore.kernel.org
 help / color / mirror / Atom feed
From: trondmy@kernel.org
To: linux-nfs@vger.kernel.org
Subject: [PATCH v2 04/22] NFSv4/pnfs: Support a list of commit arrays in struct pnfs_ds_commit_info
Date: Sat, 28 Mar 2020 11:32:02 -0400	[thread overview]
Message-ID: <20200328153220.1352010-5-trondmy@kernel.org> (raw)
In-Reply-To: <20200328153220.1352010-4-trondmy@kernel.org>

From: Trond Myklebust <trond.myklebust@hammerspace.com>

When we have multiple layout segments with different lists of mirrored
data, we need to track the commits on a per layout segment basis.
This patch adds a list to support this tracking in struct
pnfs_ds_commit_info.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/direct.c                        |  1 +
 fs/nfs/filelayout/filelayout.c         |  5 ++++-
 fs/nfs/flexfilelayout/flexfilelayout.c |  1 +
 fs/nfs/pnfs.h                          | 11 +++++++++++
 include/linux/nfs_xdr.h                |  1 +
 5 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index ade2435551c8..f9a73febce02 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -305,6 +305,7 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void)
 	kref_get(&dreq->kref);
 	init_completion(&dreq->completion);
 	INIT_LIST_HEAD(&dreq->mds_cinfo.list);
+	pnfs_init_ds_commit_info(&dreq->ds_cinfo);
 	dreq->verf.committed = NFS_INVALID_STABLE_HOW;	/* not set yet */
 	INIT_WORK(&dreq->work, nfs_direct_write_schedule_work);
 	spin_lock_init(&dreq->lock);
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
index bd234394a87c..b051d5d320ba 100644
--- a/fs/nfs/filelayout/filelayout.c
+++ b/fs/nfs/filelayout/filelayout.c
@@ -1140,7 +1140,10 @@ filelayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
 	struct nfs4_filelayout *flo;
 
 	flo = kzalloc(sizeof(*flo), gfp_flags);
-	return flo != NULL ? &flo->generic_hdr : NULL;
+	if (flo == NULL)
+		return NULL;
+	pnfs_init_ds_commit_info(&flo->commit_info);
+	return &flo->generic_hdr;
 }
 
 static void
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.c b/fs/nfs/flexfilelayout/flexfilelayout.c
index 19728206e9c6..c9e79c8e62cd 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.c
+++ b/fs/nfs/flexfilelayout/flexfilelayout.c
@@ -48,6 +48,7 @@ ff_layout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
 
 	ffl = kzalloc(sizeof(*ffl), gfp_flags);
 	if (ffl) {
+		pnfs_init_ds_commit_info(&ffl->commit_info);
 		INIT_LIST_HEAD(&ffl->error_list);
 		INIT_LIST_HEAD(&ffl->mirrors);
 		ffl->last_report_time = ktime_get();
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index f6b1099aa151..b293afb48d04 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -462,6 +462,12 @@ pnfs_get_ds_info(struct inode *inode)
 	return ld->get_ds_info(inode);
 }
 
+static inline void
+pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
+{
+	INIT_LIST_HEAD(&fl_cinfo->commits);
+}
+
 static inline void
 pnfs_generic_mark_devid_invalid(struct nfs4_deviceid_node *node)
 {
@@ -759,6 +765,11 @@ pnfs_get_ds_info(struct inode *inode)
 	return NULL;
 }
 
+static inline void
+pnfs_init_ds_commit_info(struct pnfs_ds_commit_info *fl_cinfo)
+{
+}
+
 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)
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index e91c917c9c1c..9946787eda72 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1280,6 +1280,7 @@ struct pnfs_commit_array {
 };
 
 struct pnfs_ds_commit_info {
+	struct list_head commits;
 	unsigned int nwritten;
 	unsigned int ncommitting;
 	unsigned int nbuckets;
-- 
2.25.1


  reply	other threads:[~2020-03-28 15:34 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-28 15:31 [PATCH v2 00/22] Fix NFS commit to DS trondmy
2020-03-28 15:31 ` [PATCH v2 01/22] pNFS/flexfiles: Simplify allocation of the mirror array trondmy
2020-03-28 15:32   ` [PATCH v2 02/22] NFS/pNFS: Refactor pnfs_generic_commit_pagelist() trondmy
2020-03-28 15:32     ` [PATCH v2 03/22] pNFS: Add a helper to allocate the array of buckets trondmy
2020-03-28 15:32       ` trondmy [this message]
2020-03-28 15:32         ` [PATCH v2 05/22] NFSv4/pNFS: Scan the full list of commit arrays when committing trondmy
2020-03-28 15:32           ` [PATCH v2 06/22] pNFS: Support per-layout segment commits in pnfs_generic_recover_commit_reqs() trondmy
2020-03-28 15:32             ` [PATCH v2 07/22] pNFS: Support per-layout segment commits in pnfs_generic_commit_pagelist() trondmy
2020-03-28 15:32               ` [PATCH v2 08/22] NFS/pNFS: Allow O_DIRECT to release the DS commitinfo trondmy
2020-03-28 15:32                 ` [PATCH v2 09/22] NFS: commit errors should be fatal trondmy
2020-03-28 15:32                   ` [PATCH v2 10/22] NFS: Fix O_DIRECT commit verifier handling trondmy
2020-03-28 15:32                     ` [PATCH v2 11/22] NFS/pNFS: Support commit arrays in nfs_clear_pnfs_ds_commit_verifiers() trondmy
2020-03-28 15:32                       ` [PATCH v2 12/22] pNFS: Add infrastructure for cleaning up per-layout commit structures trondmy
2020-03-28 15:32                         ` [PATCH v2 13/22] pNFS: Enable per-layout segment " trondmy
2020-03-28 15:32                           ` [PATCH v2 14/22] NFS/pNFS: Add a helper pnfs_generic_search_commit_reqs() trondmy
2020-03-28 15:32                             ` [PATCH v2 15/22] NFS: Remove bucket array from struct pnfs_ds_commit_info trondmy
2020-03-28 15:32                               ` [PATCH v2 16/22] NFS/pNFS: Clean up pNFS commit operations trondmy
2020-03-28 15:32                                 ` [PATCH v2 17/22] NFS/pNFS: Simplify bucket layout segment reference counting trondmy
2020-03-28 15:32                                   ` [PATCH v2 18/22] NFS/pNFS: Fix pnfs_layout_mark_request_commit() invalid layout segment handling trondmy
2020-03-28 15:32                                     ` [PATCH v2 19/22] pNFS/flexfile: Don't merge layout segments if the mirrors don't match trondmy
2020-03-28 15:32                                       ` [PATCH v2 20/22] pNFS/flexfiles: Check the layout segment range before doing I/O trondmy
2020-03-28 15:32                                         ` [PATCH v2 21/22] pNFS/flexfiles: remove requirement for whole file layouts trondmy
2020-03-28 15:32                                           ` [PATCH v2 22/22] pNFS/flexfiles: Specify the layout segment range in LAYOUTGET trondmy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200328153220.1352010-5-trondmy@kernel.org \
    --to=trondmy@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.