All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fred Isaman <iisaman@netapp.com>
To: linux-nfs@vger.kernel.org
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Subject: [PATCH 18/26] NFS: prepare coalesce testing for directio
Date: Mon,  9 Apr 2012 16:52:16 -0400	[thread overview]
Message-ID: <1334004744-31842-19-git-send-email-iisaman@netapp.com> (raw)
In-Reply-To: <1334004744-31842-1-git-send-email-iisaman@netapp.com>

The coalesce code made assumptions that will no longer be true once
non-page aligned io occurs.  This introduces no change in
current behavior, but allows for more general situations to come.

Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/nfs4filelayout.c |   17 ++++++++++++++++-
 fs/nfs/pagelist.c       |    4 +---
 fs/nfs/pnfs.c           |    8 ++++++++
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 2c78a46..0afa735 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -779,6 +779,16 @@ filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,
 {
 	BUG_ON(pgio->pg_lseg != NULL);
 
+	if (req->wb_offset != req->wb_pgbase) {
+		/*
+		 * Handling unaligned pages is difficult, because have to
+		 * somehow split a req in two in certain cases in the
+		 * pg.test code.  Avoid this by just not using pnfs
+		 * in this case.
+		 */
+		nfs_pageio_reset_read_mds(pgio);
+		return;
+	}
 	pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
 					   req->wb_context,
 					   0,
@@ -796,6 +806,8 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
 {
 	BUG_ON(pgio->pg_lseg != NULL);
 
+	if (req->wb_offset != req->wb_pgbase)
+		goto out_mds;
 	pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
 					   req->wb_context,
 					   0,
@@ -804,7 +816,10 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
 					   GFP_NOFS);
 	/* If no lseg, fall back to write through mds */
 	if (pgio->pg_lseg == NULL)
-		nfs_pageio_reset_write_mds(pgio);
+		goto out_mds;
+	return;
+out_mds:
+	nfs_pageio_reset_write_mds(pgio);
 }
 
 static const struct nfs_pageio_ops filelayout_pg_read_ops = {
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index b360d08..bd201d1 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -278,12 +278,10 @@ static bool nfs_can_coalesce_requests(struct nfs_page *prev,
 		return false;
 	if (req->wb_context->state != prev->wb_context->state)
 		return false;
-	if (req->wb_index != (prev->wb_index + 1))
+	if (req_offset(req) != req_offset(prev) + prev->wb_bytes)
 		return false;
 	if (req->wb_pgbase != 0)
 		return false;
-	if (prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE)
-		return false;
 	return pgio->pg_ops->pg_test(pgio, prev, req);
 }
 
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 02dd84b..da3c183 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1082,6 +1082,10 @@ pnfs_generic_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *r
 {
 	BUG_ON(pgio->pg_lseg != NULL);
 
+	if (req->wb_offset != req->wb_pgbase) {
+		nfs_pageio_reset_read_mds(pgio);
+		return;
+	}
 	pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
 					   req->wb_context,
 					   req_offset(req),
@@ -1100,6 +1104,10 @@ pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *
 {
 	BUG_ON(pgio->pg_lseg != NULL);
 
+	if (req->wb_offset != req->wb_pgbase) {
+		nfs_pageio_reset_write_mds(pgio);
+		return;
+	}
 	pgio->pg_lseg = pnfs_update_layout(pgio->pg_inode,
 					   req->wb_context,
 					   req_offset(req),
-- 
1.7.2.1


  parent reply	other threads:[~2012-04-09 20:52 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-09 20:51 [PATCH 00/26] directio rewrite Fred Isaman
2012-04-09 20:51 ` [PATCH 01/26] NFS: check for req==NULL in nfs_try_to_update_request cleanup Fred Isaman
2012-04-09 20:52 ` [PATCH 02/26] NFS4.1: make pnfs_ld_[read|write]_done consistent Fred Isaman
2012-04-09 20:52 ` [PATCH 03/26] NFS4.1: Add lseg to struct nfs4_fl_commit_bucket Fred Isaman
2012-04-13 15:47   ` Myklebust, Trond
2012-04-13 16:50     ` Fred Isaman
2012-04-09 20:52 ` [PATCH 04/26] NFS: add a struct nfs_commit_data to replace nfs_write_data in commits Fred Isaman
2012-04-09 20:52 ` [PATCH 05/26] NFS: grab open context in direct read Fred Isaman
2012-04-09 20:52 ` [PATCH 06/26] NFS: dprintks in directio code were referencing task after put Fred Isaman
2012-04-09 20:52 ` [PATCH 07/26] NFS: reverse arg order in nfs_initiate_[read|write] Fred Isaman
2012-04-09 20:52 ` [PATCH 08/26] NFS: remove unnecessary casts of void pointers in nfs4filelayout.c Fred Isaman
2012-04-09 20:52 ` [PATCH 09/26] NFS: use req_offset where appropriate Fred Isaman
2012-04-09 20:52 ` [PATCH 10/26] NFS: put open context on error in nfs_pagein_multi Fred Isaman
2012-04-13 15:52   ` Myklebust, Trond
2012-04-09 20:52 ` [PATCH 11/26] NFS: put open context on error in nfs_flush_multi Fred Isaman
2012-04-13 15:52   ` Myklebust, Trond
2012-04-09 20:52 ` [PATCH 12/26] NFS: create common nfs_pgio_header for both read and write Fred Isaman
2012-04-09 20:52 ` [PATCH 13/26] NFS: create struct nfs_page_array Fred Isaman
2012-04-09 20:52 ` [PATCH 14/26] NFS: merge _full and _partial read rpc_ops Fred Isaman
2012-04-16 20:28   ` Myklebust, Trond
2012-04-17 15:37     ` Fred Isaman
2012-04-17 16:13       ` Myklebust, Trond
2012-04-17 16:16         ` Fred Isaman
2012-04-16 20:41   ` Myklebust, Trond
2012-04-17 15:38     ` Fred Isaman
2012-04-09 20:52 ` [PATCH 15/26] NFS: merge _full and _partial write rpc_ops Fred Isaman
2012-04-09 20:52 ` [PATCH 16/26] NFS: create completion structure to pass into page_init functions Fred Isaman
2012-04-16 21:07   ` Myklebust, Trond
2012-04-09 20:52 ` [PATCH 17/26] NFS: remove unused wb_complete field from struct nfs_page Fred Isaman
2012-04-09 20:52 ` Fred Isaman [this message]
2012-04-09 20:52 ` [PATCH 19/26] NFS: rewrite directio read to use async coalesce code Fred Isaman
2012-04-16 21:22   ` Myklebust, Trond
2012-04-17 15:41     ` Fred Isaman
2012-04-09 20:52 ` [PATCH 20/26] NFS: create nfs_generic_commit_list Fred Isaman
2012-04-09 20:52 ` [PATCH 21/26] NFS: create struct nfs_commit_info Fred Isaman
2012-04-09 20:52 ` [PATCH 22/26] NFS: create nfs_commit_completion_ops Fred Isaman
2012-04-09 20:52 ` [PATCH 23/26] NFS: add dreq to nfs_commit_info Fred Isaman
2012-04-09 20:52 ` [PATCH 24/26] NFS: avoid some stat gathering for direct io Fred Isaman
2012-04-09 20:52 ` [PATCH 25/26] NFS: move allocation of nfs4_fl_commit_info to write's pg_init Fred Isaman
2012-04-09 20:52 ` [PATCH 26/26] NFS: rewrite directio write to use async coalesce code Fred Isaman

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=1334004744-31842-19-git-send-email-iisaman@netapp.com \
    --to=iisaman@netapp.com \
    --cc=Trond.Myklebust@netapp.com \
    --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.