From patchwork Wed Jul 3 07:55:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 11029019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3326913B1 for ; Wed, 3 Jul 2019 07:55:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B0F42846D for ; Wed, 3 Jul 2019 07:55:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EEFA28500; Wed, 3 Jul 2019 07:55:38 +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.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 4F7252846D for ; Wed, 3 Jul 2019 07:55:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726764AbfGCHzf (ORCPT ); Wed, 3 Jul 2019 03:55:35 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:2964 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726670AbfGCHzf (ORCPT ); Wed, 3 Jul 2019 03:55:35 -0400 Received: from DGGEMM404-HUB.china.huawei.com (unknown [172.30.72.54]) by Forcepoint Email with ESMTP id D1ABD1DAEB5225495F9E; Wed, 3 Jul 2019 15:55:32 +0800 (CST) Received: from dggeme763-chm.china.huawei.com (10.3.19.109) by DGGEMM404-HUB.china.huawei.com (10.3.20.212) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 3 Jul 2019 15:55:32 +0800 Received: from szvp000201624.huawei.com (10.120.216.130) by dggeme763-chm.china.huawei.com (10.3.19.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 3 Jul 2019 15:55:31 +0800 From: Chao Yu To: , CC: , , , , , Chao Yu Subject: [RFC PATCH] iomap: generalize IOMAP_INLINE to cover tail-packing case Date: Wed, 3 Jul 2019 15:55:02 +0800 Message-ID: <20190703075502.79782-1-yuchao0@huawei.com> X-Mailer: git-send-email 2.18.0.rc1 MIME-Version: 1.0 X-Originating-IP: [10.120.216.130] X-ClientProxiedBy: dggeme717-chm.china.huawei.com (10.1.199.113) To dggeme763-chm.china.huawei.com (10.3.19.109) X-CFilter-Loop: Reflected 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 Some filesystems like erofs/reiserfs have the ability to pack tail data into metadata, e.g.: IOMAP_MAPPED [0, 8192] IOMAP_INLINE [8192, 8200] However current IOMAP_INLINE type has assumption that: - inline data should be locating at page #0. - inline size should equal to .i_size Those restriction fail to convert to use iomap IOMAP_INLINE in erofs, so this patch tries to relieve above limits to make IOMAP_INLINE more generic to cover tail-packing case. Signed-off-by: Chao Yu --- fs/iomap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/iomap.c b/fs/iomap.c index 12654c2e78f8..d1c16b692d31 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -264,13 +264,12 @@ static void iomap_read_inline_data(struct inode *inode, struct page *page, struct iomap *iomap) { - size_t size = i_size_read(inode); + size_t size = iomap->length; void *addr; if (PageUptodate(page)) return; - BUG_ON(page->index); BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data)); addr = kmap_atomic(page); @@ -293,7 +292,6 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, sector_t sector; if (iomap->type == IOMAP_INLINE) { - WARN_ON_ONCE(pos); iomap_read_inline_data(inode, page, iomap); return PAGE_SIZE; }