From: Peng Tao <bergwolf@gmail.com>
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, bharrosh@panasas.com,
Peng Tao <tao.peng@emc.com>
Subject: [PATCH-v2 1/3] pnfsblock: bail out partial block direct write
Date: Tue, 29 May 2012 12:38:52 +0800 [thread overview]
Message-ID: <1338266334-11490-2-git-send-email-bergwolf@gmail.com> (raw)
In-Reply-To: <1338266334-11490-1-git-send-email-bergwolf@gmail.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
---
fs/nfs/blocklayout/blocklayout.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index dd392ed..bab432f 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -572,10 +572,13 @@ bl_write_pagelist(struct nfs_write_data *wdata, int sync)
u64 temp;
int npg_per_block =
NFS_SERVER(header->inode)->pnfs_blksize >> PAGE_CACHE_SHIFT;
+ unsigned long blkmask = PAGE_CACHE_MASK;
dprintk("%s enter, %Zu@%lld\n", __func__, count, offset);
/* Check for alignment first */
- if (!bl_check_alignment(offset, count, PAGE_CACHE_MASK))
+ if (header->dreq)
+ blkmask = NFS_SERVER(header->inode)->pnfs_blksize - 1;
+ if (!bl_check_alignment(offset, count, blkmask))
goto out_mds;
/* At this point, wdata->pages is a (sequential) list of nfs_pages.
@@ -1023,7 +1026,15 @@ bl_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
static void
bl_pg_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
{
- if (!bl_check_alignment(req->wb_offset, req->wb_bytes, PAGE_CACHE_MASK))
+ if (pgio->pg_dreq) {
+ /* Direct write should be blksize aligned */
+ unsigned blkmask = NFS_SERVER(pgio->pg_inode)->pnfs_blksize - 1;
+ u64 pos = (req->wb_index << PAGE_CACHE_SHIFT) + req->wb_bytes;
+ if (!bl_check_alignment(pos, 0, blkmask) ||
+ req->wb_bytes != PAGE_CACHE_SIZE)
+ nfs_pageio_reset_write_mds(pgio);
+ } else if (!bl_check_alignment(req->wb_offset, req->wb_bytes,
+ PAGE_CACHE_MASK))
nfs_pageio_reset_write_mds(pgio);
else
pnfs_generic_pg_init_write(pgio, req);
--
1.7.1.262.g5ef3d
next prev parent reply other threads:[~2012-05-29 4:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-29 4:38 [PATCH-v2 0/3] pnfsblock: cope with DIO changes Peng Tao
2012-05-29 4:38 ` Peng Tao [this message]
2012-05-31 21:13 ` [PATCH-v2 1/3] pnfsblock: bail out partial block direct write Myklebust, Trond
2012-05-29 4:38 ` [PATCH-v2 2/3] NFS41: add pg_layout_private and moreio fields Peng Tao
2012-05-29 4:38 ` [PATCH-v2 3/3] pnfsblock: call blk_plug functions for direct IO Peng Tao
2012-05-31 21:22 ` Myklebust, Trond
2012-06-01 2:59 ` tao.peng
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=1338266334-11490-2-git-send-email-bergwolf@gmail.com \
--to=bergwolf@gmail.com \
--cc=Trond.Myklebust@netapp.com \
--cc=bharrosh@panasas.com \
--cc=linux-nfs@vger.kernel.org \
--cc=tao.peng@emc.com \
/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.