From patchwork Sat Dec 20 03:18:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 5521921 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D530ABEEA8 for ; Sat, 20 Dec 2014 03:19:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 07A6E20154 for ; Sat, 20 Dec 2014 03:19:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 336BA2014A for ; Sat, 20 Dec 2014 03:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752738AbaLTDS4 (ORCPT ); Fri, 19 Dec 2014 22:18:56 -0500 Received: from mail-pd0-f170.google.com ([209.85.192.170]:33350 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752749AbaLTDSr (ORCPT ); Fri, 19 Dec 2014 22:18:47 -0500 Received: by mail-pd0-f170.google.com with SMTP id v10so2348513pde.15 for ; Fri, 19 Dec 2014 19:18:47 -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=0LcJ+ES75whsZAJYSkB2UxkXP3cKnMpFLp/FhQXvwtU=; b=PQS6kz3zZ1tP0HpBVkcH2gDgoSH/CHsXW9HX8NLyjAIc8uNNkLzRI66H7g7Ol6QLXj L5aAx3/VjIVWqj2G2jOjavWc3sCH1GWU8yZIClPKKtESJTy3bmxYsXDAC4Y6xoYVPBAI /Ua85RZbvTXJBNrYjU2g4F1lNnhiYOA852mku/JkKPMfbCloiIlfrfStQiHlSHykigGM Ii09kMOB5pdwtwVsJx6QG9jJZyN6uBFVgAp5BM+07TtGL9aGe8MbI18twLtSbGHjmqiV 44tFha0AvHFH9Dwx7O+Jog5WLuJS0IuX0p31DJWTvSqh9iAU0H8uAY/47HtS0Bj0GTVo EVDw== X-Gm-Message-State: ALoCoQnCo6vTgCh5MCBlukku2sP1uRelWGpjeDsINeLz9siOSv+ab0LtIjSIyJ9duJ5vOkkIvgfr X-Received: by 10.70.102.234 with SMTP id fr10mr17145955pdb.145.1419045527165; Fri, 19 Dec 2014 19:18:47 -0800 (PST) Received: from mew.localdomain ([72.192.100.38]) by mx.google.com with ESMTPSA id uq15sm10972638pab.8.2014.12.19.19.18.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Dec 2014 19:18:46 -0800 (PST) From: Omar Sandoval To: Alexander Viro , Andrew Morton , Trond Myklebust , Christoph Hellwig , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Omar Sandoval Subject: [PATCH v2 3/5] nfs: don't dirty ITER_BVEC pages read through direct I/O Date: Fri, 19 Dec 2014 19:18:27 -0800 Message-Id: X-Mailer: git-send-email 2.2.1 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..b6ca65c 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 = !iov_iter_is_bvec(iter); l_ctx = nfs_get_lock_context(dreq->ctx); if (IS_ERR(l_ctx)) { result = PTR_ERR(l_ctx);