[PATCH 03/10] SQUASHME pnfs-submit: clear page lseg on partial i/o

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andy Adamson <andros@xxxxxxxxxx>

partial reads or writes use a single page not the page list.

Signed-off-by: Andy Adamson <andros@xxxxxxxxxx>
---
 fs/nfs/pnfs.h |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index c60eff6..70f1d97 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -91,10 +91,18 @@ static inline int pnfs_enabled_sb(struct nfs_server *nfss)
 	return nfss->pnfs_curr_ld != NULL;
 }
 
-static inline void _pnfs_clear_lseg_from_pages(struct list_head *head)
+static inline void _pnfs_clear_lseg_from_pages(struct nfs_page *partial,
+					       struct list_head *head)
 {
 	struct nfs_page *req;
 
+	/* partial_read or partial_write */
+	if (list_empty(head)) {
+		put_lseg(partial->wb_lseg);
+		partial->wb_lseg = NULL;
+		return;
+	}
+	/* full_read or full_write */
 	list_for_each_entry(req, head, wb_list) {
 		put_lseg(req->wb_lseg);
 		req->wb_lseg = NULL;
@@ -114,7 +122,7 @@ pnfs_try_to_read_data(struct nfs_read_data *data,
 	if (ret == PNFS_ATTEMPTED)
 		nfs_inc_stats(inode, NFSIOS_PNFS_READ);
 	else
-		_pnfs_clear_lseg_from_pages(&data->pages);
+		_pnfs_clear_lseg_from_pages(data->req, &data->pages);
 	return ret;
 }
 
@@ -132,7 +140,7 @@ pnfs_try_to_write_data(struct nfs_write_data *data,
 	if (ret == PNFS_ATTEMPTED)
 		nfs_inc_stats(inode, NFSIOS_PNFS_WRITE);
 	else
-		_pnfs_clear_lseg_from_pages(&data->pages);
+		_pnfs_clear_lseg_from_pages(data->req, &data->pages);
 	return ret;
 }
 
@@ -153,7 +161,7 @@ pnfs_try_to_commit(struct nfs_write_data *data,
 	if (ret == PNFS_ATTEMPTED)
 		nfs_inc_stats(inode, NFSIOS_PNFS_COMMIT);
 	else
-		_pnfs_clear_lseg_from_pages(&data->pages);
+		_pnfs_clear_lseg_from_pages(data->req, &data->pages);
 	return ret;
 }
 
-- 
1.6.6

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux