From patchwork Wed Dec 10 01:45:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 5466351 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 162D59F1CD for ; Wed, 10 Dec 2014 01:55:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3E213200E7 for ; Wed, 10 Dec 2014 01:55:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39F32200E6 for ; Wed, 10 Dec 2014 01:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754846AbaLJByT (ORCPT ); Tue, 9 Dec 2014 20:54:19 -0500 Received: from mail-pd0-f179.google.com ([209.85.192.179]:63900 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754065AbaLJBqj (ORCPT ); Tue, 9 Dec 2014 20:46:39 -0500 Received: by mail-pd0-f179.google.com with SMTP id fp1so1709876pdb.38 for ; Tue, 09 Dec 2014 17:46:39 -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=ekkNnMkE0fsresFOH1zsoSvNQA4opa0m2Y9Nrd8TdXw=; b=bR3PwBt7kNT8mKOd2vgKPyj0s/FveYTQ7ylJJaiEWHMKAkXrNPeqgkzaiCUJyRMpyw 2ovJug+2FJOo1y2UfI3Ueew8J+l3ST4tEjc+kEE2NcQ3oOKXMv2qieioPigTlWIzr5W9 HXQrqOj6a2Ylfo/czs3StdnOs4lXznyTHuTM7cULLlbgJBPpQIN+rg4SzkYaHhRyRKNd KWFNcKwBw8kmnJuZU3ZfIHIfXJ/r6AxbkvcmWYj67lJobK+dAWUsGT9LweQue0EA+PW5 Te4yulFv0AaTVy+oI0K09U0omO5FmBcmz5oLORh3okJbvnC+o/cVYlyJbE7cJ5wsaygb 6BJg== X-Gm-Message-State: ALoCoQmRO8SRBUjTtzF0mTlckr6imfPeJNq/9STPTTR74zK1V9M/wWCXhgZOxLXOWSUeYD9fEbVn X-Received: by 10.68.255.227 with SMTP id at3mr2662008pbd.40.1418175999454; Tue, 09 Dec 2014 17:46:39 -0800 (PST) Received: from mew.localdomain (c-24-19-133-29.hsd1.wa.comcast.net. [24.19.133.29]) by mx.google.com with ESMTPSA id on1sm2602957pdb.32.2014.12.09.17.46.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Dec 2014 17:46:38 -0800 (PST) From: Omar Sandoval To: Alexander Viro , Andrew Morton , Chris Mason , Josef Bacik , Trond Myklebust , Christoph Hellwig , David Sterba , linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Omar Sandoval Subject: [RFC PATCH v3 2/7] nfs: don't dirty ITER_BVEC pages read through direct I/O Date: Tue, 9 Dec 2014 17:45:43 -0800 Message-Id: <55ee5dcf11066baf17b5d8aa485fdcd7be78dec0.1418173063.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);