Skip to contentSkip to conversation

SQUASHME pnfs-submit: pnfs_try_to_commit can release nfs_write_data

PATCH New [email protected] 1 participant 5 messages Jul 14, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 SQUASHME pnfs-submit: pnfs_try_to_commit can release nfs_write_data

From: Andy Adamson <[email protected]>

So don't reference nfs_write_data.

---
 fs/nfs/pnfs.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
fs/nfs/pnfs.c +3 -3
index 3018ed6..56c3af4 100644
@@ -1373,7 +1373,7 @@ enum pnfs_try_status
 pnfs_try_to_commit(struct nfs_write_data *data,
 		    const struct rpc_call_ops *call_ops, int sync)
 {
-	struct nfs_inode *nfsi = NFS_I(data->inode);
+	struct inode *inode = data->inode;
 	struct nfs_server *nfss = NFS_SERVER(data->inode);
 	enum pnfs_try_status trypnfs;
 
@@ -1389,12 +1389,12 @@ pnfs_try_to_commit(struct nfs_write_data *data,
 	data->pdata.call_ops = call_ops;
 	data->pdata.how = sync;
 	data->pdata.lseg = NULL;
-	trypnfs = nfss->pnfs_curr_ld->ld_io_ops->commit(nfsi->layout,
+	trypnfs = nfss->pnfs_curr_ld->ld_io_ops->commit(NFS_I(inode)->layout,
 							sync, data);
 	if (trypnfs == PNFS_NOT_ATTEMPTED)
 		_pnfs_clear_lseg_from_pages(&data->pages);
 	else
-		nfs_inc_stats(data->inode, NFSIOS_PNFS_COMMIT);
+		nfs_inc_stats(inode, NFSIOS_PNFS_COMMIT);
 	dprintk("%s End (trypnfs:%d)\n", __func__, trypnfs);
 	return trypnfs;
 }
Signature · 1 line
1.6.6
#1 lore raw

PATCH 2/5 SQUASHME pnfs-submit remove gather_across_stripes policy

From: Andy Adamson <[email protected]>

Unused by the file layout. Will restore.

---
 fs/nfs/pnfs.c             |    4 ----
 include/linux/nfs4_pnfs.h |   10 ----------
 2 files changed, 0 insertions(+), 14 deletions(-)
fs/nfs/pnfs.c +0 -4
index 56c3af4..d3df8df 100644
@@ -1191,10 +1191,6 @@ pnfs_getboundary(struct inode *inode)
 	if (!policy_ops || !policy_ops->get_stripesize)
 		goto out;
 
-	/* The default is to not gather across stripes */
-	if (pnfs_ld_gather_across_stripes(nfss->pnfs_curr_ld))
-		goto out;
-
 	spin_lock(&inode->i_lock);
 	if (NFS_I(inode)->layout)
 		stripe_size = policy_ops->get_stripesize(NFS_I(inode)->layout);
include/linux/nfs4_pnfs.h +0 -10
index 9eebbdd..eb9dfe4 100644
@@ -156,9 +156,6 @@ struct layoutdriver_io_operations {
 };
 
 enum layoutdriver_policy_flags {
-	/* Should the NFS req. gather algorithm cross stripe boundaries? */
-	PNFS_GATHER_ACROSS_STRIPES	= 1 << 1,
-
 	/* Should the pNFS client commit and return the layout upon a setattr */
 	PNFS_LAYOUTRET_ON_SETATTR	= 1 << 3,
 };
@@ -173,13 +170,6 @@ struct layoutdriver_policy_operations {
 	int (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *);
 };
 
-/* Should the NFS req. gather algorithm cross stripe boundaries? */
-static inline int
-pnfs_ld_gather_across_stripes(struct pnfs_layoutdriver_type *ld)
-{
-	return ld->ld_policy_ops->flags & PNFS_GATHER_ACROSS_STRIPES;
-}
-
 struct pnfs_device {
 	struct pnfs_deviceid dev_id;
 	unsigned int  layout_type;
Signature · 1 line
1.6.6
#2 lore raw

PATCH 3/5 SQUASHME pnfs-submit remove layoutret_on_setattr policy

From: Andy Adamson <[email protected]>

Not used by the file layout driver. Will be restored.

---
 fs/nfs/nfs4proc.c         |    3 ---
 fs/nfs/pnfs.h             |    9 ---------
 include/linux/nfs4_pnfs.h |    7 -------
 3 files changed, 0 insertions(+), 19 deletions(-)
fs/nfs/nfs4proc.c +0 -3
index 288025e..756f6e9 100644
@@ -2358,9 +2358,6 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
 	struct nfs4_state *state = NULL;
 	int status;
 
-	if (pnfs_ld_layoutret_on_setattr(inode))
-		pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
-
 	nfs_fattr_init(fattr);
 	
 	/* Search for an existing open(O_WRITE) file */
fs/nfs/pnfs.h +0 -9
index 71086aa..6bc27af 100644
@@ -92,15 +92,6 @@ static inline int pnfs_enabled_sb(struct nfs_server *nfss)
 	return nfss->pnfs_curr_ld != NULL;
 }
 
-/* Should the pNFS client commit and return the layout upon a setattr
- */
-static inline bool
-pnfs_ld_layoutret_on_setattr(struct inode *inode)
-{
-	return NFS_SERVER(inode)->pnfs_curr_ld->ld_policy_ops->flags &
-		PNFS_LAYOUTRET_ON_SETATTR;
-}
-
 /* Should the pNFS client commit and return the layout on close
  */
 static inline int
include/linux/nfs4_pnfs.h +0 -7
index eb9dfe4..52fe384 100644
@@ -155,14 +155,7 @@ struct layoutdriver_io_operations {
 	int (*uninitialize_mountpoint) (struct nfs_server *server);
 };
 
-enum layoutdriver_policy_flags {
-	/* Should the pNFS client commit and return the layout upon a setattr */
-	PNFS_LAYOUTRET_ON_SETATTR	= 1 << 3,
-};
-
 struct layoutdriver_policy_operations {
-	unsigned flags;
-
 	/* The stripe size of the file system */
 	ssize_t (*get_stripesize) (struct pnfs_layout_type *layoutid);
 
Signature · 1 line
1.6.6
#3 lore raw

PATCH 4/5 post-submit: restore and fix layoutret_on_setattr

From: Andy Adamson <[email protected]>

Add pnfs_enabled_sb check

---
 fs/nfs/nfs4proc.c         |    3 +++
 fs/nfs/pnfs.h             |   10 ++++++++++
 include/linux/nfs4_pnfs.h |    7 +++++++
 3 files changed, 20 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +3 -0
index 756f6e9..288025e 100644
@@ -2358,6 +2358,9 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
 	struct nfs4_state *state = NULL;
 	int status;
 
+	if (pnfs_ld_layoutret_on_setattr(inode))
+		pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
+
 	nfs_fattr_init(fattr);
 	
 	/* Search for an existing open(O_WRITE) file */
fs/nfs/pnfs.h +10 -0
index 6bc27af..d5dc2e2 100644
@@ -92,6 +92,16 @@ static inline int pnfs_enabled_sb(struct nfs_server *nfss)
 	return nfss->pnfs_curr_ld != NULL;
 }
 
+/* Should the pNFS client commit and return the layout upon a setattr */
+static inline bool
+pnfs_ld_layoutret_on_setattr(struct inode *inode)
+{
+	if (!pnfs_enabled_sb(NFS_SERVER(inode)))
+		return false;
+	return NFS_SERVER(inode)->pnfs_curr_ld->ld_policy_ops->flags &
+		PNFS_LAYOUTRET_ON_SETATTR;
+}
+
 /* Should the pNFS client commit and return the layout on close
  */
 static inline int
include/linux/nfs4_pnfs.h +7 -0
index 52fe384..eb9dfe4 100644
@@ -155,7 +155,14 @@ struct layoutdriver_io_operations {
 	int (*uninitialize_mountpoint) (struct nfs_server *server);
 };
 
+enum layoutdriver_policy_flags {
+	/* Should the pNFS client commit and return the layout upon a setattr */
+	PNFS_LAYOUTRET_ON_SETATTR	= 1 << 3,
+};
+
 struct layoutdriver_policy_operations {
+	unsigned flags;
+
 	/* The stripe size of the file system */
 	ssize_t (*get_stripesize) (struct pnfs_layout_type *layoutid);
 
Signature · 1 line
1.6.6
#4 lore raw

PATCH 5/5 pnfs post-submit: restore gather_across_stripes policy

From: Andy Adamson <[email protected]>

---
 fs/nfs/pnfs.c             |    4 ++++
 include/linux/nfs4_pnfs.h |   10 ++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
fs/nfs/pnfs.c +4 -0
index d3df8df..56c3af4 100644
@@ -1191,6 +1191,10 @@ pnfs_getboundary(struct inode *inode)
 	if (!policy_ops || !policy_ops->get_stripesize)
 		goto out;
 
+	/* The default is to not gather across stripes */
+	if (pnfs_ld_gather_across_stripes(nfss->pnfs_curr_ld))
+		goto out;
+
 	spin_lock(&inode->i_lock);
 	if (NFS_I(inode)->layout)
 		stripe_size = policy_ops->get_stripesize(NFS_I(inode)->layout);
include/linux/nfs4_pnfs.h +10 -0
index eb9dfe4..9eebbdd 100644
@@ -156,6 +156,9 @@ struct layoutdriver_io_operations {
 };
 
 enum layoutdriver_policy_flags {
+	/* Should the NFS req. gather algorithm cross stripe boundaries? */
+	PNFS_GATHER_ACROSS_STRIPES	= 1 << 1,
+
 	/* Should the pNFS client commit and return the layout upon a setattr */
 	PNFS_LAYOUTRET_ON_SETATTR	= 1 << 3,
 };
@@ -170,6 +173,13 @@ struct layoutdriver_policy_operations {
 	int (*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *);
 };
 
+/* Should the NFS req. gather algorithm cross stripe boundaries? */
+static inline int
+pnfs_ld_gather_across_stripes(struct pnfs_layoutdriver_type *ld)
+{
+	return ld->ld_policy_ops->flags & PNFS_GATHER_ACROSS_STRIPES;
+}
+
 struct pnfs_device {
 	struct pnfs_deviceid dev_id;
 	unsigned int  layout_type;
Signature · 1 line
1.6.6