From patchwork Fri Nov 21 10:08:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 5353881 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5A1419F2F1 for ; Fri, 21 Nov 2014 10:09:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 86EAB200E6 for ; Fri, 21 Nov 2014 10:09:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC696200E0 for ; Fri, 21 Nov 2014 10:09:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758241AbaKUKJU (ORCPT ); Fri, 21 Nov 2014 05:09:20 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:64071 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758212AbaKUKJJ (ORCPT ); Fri, 21 Nov 2014 05:09:09 -0500 Received: by mail-pa0-f52.google.com with SMTP id eu11so4534917pac.25 for ; Fri, 21 Nov 2014 02:09:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=VWWyz+1QFegn8T1YUZG1xtvEKxRiDcfyfysFUPTK38Q=; b=jx4O7bM6zcfOoAjRb7XxlQ0eEMy03kV35LviDI8RFY3cSGX0Ud5GdG4Aob2ww6TL/f fNNRefxk3sUlaRmynYiYm2m0nX2ANVxNpfcm1jWSRe0mVuEgPrSdVnLxGkxS+vG5LE1/ IWGo0ZlahNBK3Cq7+Frj6dwiuhu8Or6SwtUUxEWVg5SR7wQLpxCs8wrU79lBe+JHiONG LBWQh2L9VJBvUniLEry8IDIr/nQPOhoqkZ2cGio64yoKUgtfwRz1Xi8hqUCiErUpmFrm IRGuDJqgVe+uwEmr7DSdhR9P4uoes/W7Byh+8gg6SVuuC3bUDJDFO2W3n6GyJ/iTcc0u Plug== X-Gm-Message-State: ALoCoQmOH4lq7jSITvvzBF1yRajGNYTz9jT3Lhl7sxhAFUgFOY9AoBo8KM8MNtBg+L3tnZ+l80+X X-Received: by 10.68.65.2 with SMTP id t2mr5431442pbs.39.1416564548692; Fri, 21 Nov 2014 02:09:08 -0800 (PST) Received: from mew.localdomain ([24.19.133.29]) by mx.google.com with ESMTPSA id g12sm4391480pdj.27.2014.11.21.02.09.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Nov 2014 02:09:08 -0800 (PST) From: Omar Sandoval To: Alexander Viro , Andrew Morton , Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, Trond Myklebust , Mel Gorman Cc: Omar Sandoval Subject: [PATCH v2 2/5] nfs: don't dirty ITER_BVEC pages read through direct I/O Date: Fri, 21 Nov 2014 02:08:28 -0800 Message-Id: <6f2a9d098e9b558cf551aa32f668d5eb95c96406.1416563833.git.osandov@osandov.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As with the generic blockdev code, kernel pages shouldn't be dirtied by the direct I/O path. Signed-off-by: Omar Sandoval --- fs/nfs/direct.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 10bf072..a67fa2c 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -88,6 +88,7 @@ struct nfs_direct_req { struct pnfs_ds_commit_info ds_cinfo; /* Storage for cinfo */ struct work_struct work; int flags; + int should_dirty; /* should we mark read pages dirty? */ #define NFS_ODIRECT_DO_COMMIT (1) /* an unstable reply was received */ #define NFS_ODIRECT_RESCHED_WRITES (2) /* write verification failed */ struct nfs_writeverf verf; /* unstable write verifier */ @@ -370,7 +371,8 @@ static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) struct nfs_page *req = nfs_list_entry(hdr->pages.next); struct page *page = req->wb_page; - if (!PageCompound(page) && bytes < hdr->good_bytes) + if (!PageCompound(page) && bytes < hdr->good_bytes && + dreq->should_dirty) set_page_dirty(page); bytes += req->wb_bytes; nfs_list_remove_request(req); @@ -542,6 +544,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, dreq->inode = inode; dreq->bytes_left = count; dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); + dreq->should_dirty = !(iter->type & ITER_BVEC); l_ctx = nfs_get_lock_context(dreq->ctx); if (IS_ERR(l_ctx)) { result = PTR_ERR(l_ctx);