From patchwork Thu May 31 18:07:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10441725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D23AF602BC for ; Thu, 31 May 2018 18:07:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B417D28F25 for ; Thu, 31 May 2018 18:07:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A882928FAB; Thu, 31 May 2018 18:07:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B90728F25 for ; Thu, 31 May 2018 18:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756023AbeEaSHf (ORCPT ); Thu, 31 May 2018 14:07:35 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50846 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756013AbeEaSHe (ORCPT ); Thu, 31 May 2018 14:07:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2r1/MqZvfTzjdc7jHbM4pqQ2B1bMFjNOBQjNjJrOclM=; b=jHFy6npDvyGTaby7I7+/VT1Xe 52S4KKsnuCfCcqGQPBWYNTLUixkGCNoM62f2QIc8KChik7iMX454GQi39lLLlW8+Agayq065KT0pF BGoOthKVrYxn6JVA0rzrjA4k6BGm+KdmAdA1rdNazVDmMvNsb4Qv+BNRZpVpo9XQuUUujIGduESJq oFj71ySAoHLLL8cRm/bcrzxL96jDCWqLw2pZ0x72fnwFzEcBoCcYH011Sb0CLp5hHOpbBGlBWC2h1 I3nexhGnyQVNk/iPoxBxF12/XftHZ1JR2shO6MWS3vH1dh4+Tl0ZmRyQVg503yIk3iTvM+vJ+kyeg j0ygdQtgA==; Received: from 213-225-38-123.nat.highway.a1.net ([213.225.38.123] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fORz3-0003aA-TS; Thu, 31 May 2018 18:07:34 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: Andreas Gruenbacher , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org Subject: [PATCH 2/3] fs: remove the buffer_unwritten check in page_seek_hole_data Date: Thu, 31 May 2018 20:07:23 +0200 Message-Id: <20180531180724.21573-3-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531180724.21573-1-hch@lst.de> References: <20180531180724.21573-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We only call into this function through the iomap iterators, so we already know the buffer is unwritten. In addition to that we always require the uptodate flag that is ORed with the result anyway. Signed-off-by: Christoph Hellwig Reviewed-by: Andreas Gruenbacher Reviewed-by: Darrick J. Wong Reviewed-by: Dave Chinner --- fs/iomap.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/fs/iomap.c b/fs/iomap.c index f553a2d8a5fa..e93bd4eb7fa7 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -827,14 +827,9 @@ page_seek_hole_data(struct page *page, loff_t lastoff, int whence) continue; /* - * Unwritten extents that have data in the page cache covering - * them can be identified by the BH_Unwritten state flag. - * Pages with multiple buffers might have a mix of holes, data - * and unwritten extents - any buffer with valid data in it - * should have BH_Uptodate flag set on it. + * Any buffer with valid data in it should have BH_Uptodate set. */ - - if ((buffer_unwritten(bh) || buffer_uptodate(bh)) == seek_data) + if (buffer_uptodate(bh) == seek_data) return lastoff; lastoff = offset; @@ -846,8 +841,8 @@ page_seek_hole_data(struct page *page, loff_t lastoff, int whence) * Seek for SEEK_DATA / SEEK_HOLE in the page cache. * * Within unwritten extents, the page cache determines which parts are holes - * and which are data: unwritten and uptodate buffer heads count as data; - * everything else counts as a hole. + * and which are data: uptodate buffer heads count as data; everything else + * counts as a hole. * * Returns the resulting offset on successs, and -ENOENT otherwise. */