From patchwork Mon Dec 15 05:27:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 5490471 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 2653F9F6B5 for ; Mon, 15 Dec 2014 05:28:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C294209E5 for ; Mon, 15 Dec 2014 05:28:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79D17209ED for ; Mon, 15 Dec 2014 05:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751236AbaLOF1u (ORCPT ); Mon, 15 Dec 2014 00:27:50 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:50189 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbaLOF1h (ORCPT ); Mon, 15 Dec 2014 00:27:37 -0500 Received: by mail-pa0-f46.google.com with SMTP id lf10so10470769pab.19 for ; Sun, 14 Dec 2014 21:27:36 -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=ND+7sGJhq+Yt2kBVnmYjjc3x4ldLil4v72njCKJ3hpI=; b=EEZxzqgX+3WRuFcqFY1SjxJGqoIuiHYii7IEaH7v29kUAd4lNMAV1B4+vB5DQIDr1M KC6Yyh/7eORS694RJqXRF9UVkk1fmhz7WLevQnzGSxn+XdRwsNQaJiTv/ETrS1bmUwPV 4cT5sd7unuJ3kWSTifsZ4NLp7Sri+NWOEkcJ8impayA1kAnq4UNCGEqTeY4uAFlhfgzx P9Kipz3AivdMV8DxZePb8QbBGdzV7WxdN9wCwEX0cBIRqmpx1Mcj8lq166FVALRLdbDr 7Ml+GICmJccK5bii0EIuissdNipuok4nDqbXV39XXtuhpZ9oxI6GpFPMzt4bVvzi6Ge0 EA/g== X-Gm-Message-State: ALoCoQkC5FXmVTELfliTCaCKVfZ8o/oBUlZuG4OA4zMka9Do7IRp/3UejbTjTg9Wf7J4ur16tjHt X-Received: by 10.66.235.200 with SMTP id uo8mr47498877pac.108.1418621256421; Sun, 14 Dec 2014 21:27:36 -0800 (PST) Received: from mew.localdomain ([72.192.100.38]) by mx.google.com with ESMTPSA id f12sm7915174pdm.90.2014.12.14.21.27.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 14 Dec 2014 21:27:35 -0800 (PST) From: Omar Sandoval To: Alexander Viro , Andrew Morton , Trond Myklebust , Christoph Hellwig , David Sterba , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Omar Sandoval Subject: [PATCH 6/8] nfs: don't dirty ITER_BVEC pages read through direct I/O Date: Sun, 14 Dec 2014 21:27:00 -0800 Message-Id: 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 9402b96..a502b3f 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);