From patchwork Wed May 9 07:48:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10388533 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 E0650602C2 for ; Wed, 9 May 2018 07:50:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D200728E05 for ; Wed, 9 May 2018 07:50:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4F6C28E68; Wed, 9 May 2018 07:50:52 +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=unavailable 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 34F5D28E05 for ; Wed, 9 May 2018 07:50:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933734AbeEIHur (ORCPT ); Wed, 9 May 2018 03:50:47 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53854 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933966AbeEIHuo (ORCPT ); Wed, 9 May 2018 03:50:44 -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=fFTBV5Obl8n03uogE5L7HLiBMTdVozVH/rnXorrYaRo=; b=ZkGcSQ6R9P7GILzDiYdaawuf6 T+Z7kDTBUgHJp4H2XzCVn59a4R5YXNSEE+6siIf46tuax1GvGQb1IEo6dtNsSsT8EiMj4zyRYkBWV jMoX8Hxl8nyMr0HymDXJBkjXP2g2vVGom6zXZTaNJjc2e6WrV3erqI5tdQL322xGMvsbLBWw4Gj/P x0FyROZKNKTDwED6clxyJRkpz6gZKxNOhhXQpX5mSGpPYhlYjtEwxC3a9kgiKqj1n1pLmZAySWhBY zAPZOSYt3FxoFtplfpVgwev7WHKsnWiFv4f8aAsbcUYulmg54gE6CxtnOE79LuXlo0bRW8upxDFMT ollVbSmRA==; Received: from 213-225-15-246.nat.highway.a1.net ([213.225.15.246] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGJs3-0003RH-6m; Wed, 09 May 2018 07:50:43 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 33/33] fs: remove __block_write_begin and iomap_to_bh Date: Wed, 9 May 2018 09:48:30 +0200 Message-Id: <20180509074830.16196-34-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509074830.16196-1-hch@lst.de> References: <20180509074830.16196-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 Now that the iomap buffered write code stopped using bufferheads these aren't used anymore. Signed-off-by: Christoph Hellwig --- fs/buffer.c | 76 ++++----------------------------------------------- fs/internal.h | 2 -- 2 files changed, 5 insertions(+), 73 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 71ea9a29e9d5..5cdcaa6230ed 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -1863,62 +1862,8 @@ void page_zero_new_buffers(struct page *page, unsigned from, unsigned to) } EXPORT_SYMBOL(page_zero_new_buffers); -static void -iomap_to_bh(struct inode *inode, sector_t block, struct buffer_head *bh, - struct iomap *iomap) -{ - loff_t offset = block << inode->i_blkbits; - - bh->b_bdev = iomap->bdev; - - /* - * Block points to offset in file we need to map, iomap contains - * the offset at which the map starts. If the map ends before the - * current block, then do not map the buffer and let the caller - * handle it. - */ - BUG_ON(offset >= iomap->offset + iomap->length); - - switch (iomap->type) { - case IOMAP_HOLE: - /* - * If the buffer is not up to date or beyond the current EOF, - * we need to mark it as new to ensure sub-block zeroing is - * executed if necessary. - */ - if (!buffer_uptodate(bh) || - (offset >= i_size_read(inode))) - set_buffer_new(bh); - break; - case IOMAP_DELALLOC: - if (!buffer_uptodate(bh) || - (offset >= i_size_read(inode))) - set_buffer_new(bh); - set_buffer_uptodate(bh); - set_buffer_mapped(bh); - set_buffer_delay(bh); - break; - case IOMAP_UNWRITTEN: - /* - * For unwritten regions, we always need to ensure that - * sub-block writes cause the regions in the block we are not - * writing to are zeroed. Set the buffer as new to ensure this. - */ - set_buffer_new(bh); - set_buffer_unwritten(bh); - /* FALLTHRU */ - case IOMAP_MAPPED: - if (offset >= i_size_read(inode)) - set_buffer_new(bh); - bh->b_blocknr = (iomap->addr + offset - iomap->offset) >> - inode->i_blkbits; - set_buffer_mapped(bh); - break; - } -} - -int __block_write_begin_int(struct page *page, loff_t pos, unsigned len, - get_block_t *get_block, struct iomap *iomap) +int __block_write_begin(struct page *page, loff_t pos, unsigned len, + get_block_t *get_block) { unsigned from = pos & (PAGE_SIZE - 1); unsigned to = from + len; @@ -1954,14 +1899,9 @@ int __block_write_begin_int(struct page *page, loff_t pos, unsigned len, clear_buffer_new(bh); if (!buffer_mapped(bh)) { WARN_ON(bh->b_size != blocksize); - if (get_block) { - err = get_block(inode, block, bh, 1); - if (err) - break; - } else { - iomap_to_bh(inode, block, bh, iomap); - } - + err = get_block(inode, block, bh, 1); + if (err) + break; if (buffer_new(bh)) { clean_bdev_bh_alias(bh); if (PageUptodate(page)) { @@ -2001,12 +1941,6 @@ int __block_write_begin_int(struct page *page, loff_t pos, unsigned len, page_zero_new_buffers(page, from, to); return err; } - -int __block_write_begin(struct page *page, loff_t pos, unsigned len, - get_block_t *get_block) -{ - return __block_write_begin_int(page, pos, len, get_block, NULL); -} EXPORT_SYMBOL(__block_write_begin); static int __block_commit_write(struct inode *inode, struct page *page, diff --git a/fs/internal.h b/fs/internal.h index b955232d3d49..47764f739075 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -41,8 +41,6 @@ static inline int __sync_blockdev(struct block_device *bdev, int wait) * buffer.c */ extern void guard_bio_eod(int rw, struct bio *bio); -extern int __block_write_begin_int(struct page *page, loff_t pos, unsigned len, - get_block_t *get_block, struct iomap *iomap); int __generic_write_end(struct inode *inode, loff_t pos, unsigned copied, struct page *page);