From patchwork Wed Dec 11 23:38:38 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandra Seetharaman X-Patchwork-Id: 3329021 Return-Path: X-Original-To: patchwork-linux-btrfs@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 CE8779F3B8 for ; Wed, 11 Dec 2013 23:40:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 122BC2068F for ; Wed, 11 Dec 2013 23:40:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0278920807 for ; Wed, 11 Dec 2013 23:40:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853Ab3LKXky (ORCPT ); Wed, 11 Dec 2013 18:40:54 -0500 Received: from e37.co.us.ibm.com ([32.97.110.158]:59701 "EHLO e37.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751743Ab3LKXkw (ORCPT ); Wed, 11 Dec 2013 18:40:52 -0500 Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 11 Dec 2013 16:40:52 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 11 Dec 2013 16:40:51 -0700 Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 1739C3E40044 for ; Wed, 11 Dec 2013 16:40:51 -0700 (MST) Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by b03cxnp07028.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id rBBLcgjp5964062 for ; Wed, 11 Dec 2013 22:38:42 +0100 Received: from d03av02.boulder.ibm.com (localhost [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id rBBNeoSO031175 for ; Wed, 11 Dec 2013 16:40:50 -0700 Received: from localfs-p1-lp01.austin.ibm.com (localfs-p1-lp01.austin.ibm.com [9.3.192.137]) by d03av02.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id rBBNedZ4029578; Wed, 11 Dec 2013 16:40:50 -0700 From: Chandra Seetharaman To: linux-btrfs@vger.kernel.org Cc: Chandra Seetharaman Subject: [PATCH 3/7] btrfs: subpagesize-blocksize: Handle small extent maps properly Date: Wed, 11 Dec 2013 17:38:38 -0600 Message-Id: <1386805122-23972-4-git-send-email-sekharan@us.ibm.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1386805122-23972-1-git-send-email-sekharan@us.ibm.com> References: <1386805122-23972-1-git-send-email-sekharan@us.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13121123-7164-0000-0000-0000042730F4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This patch makes sure that the size extent maps handles are at least PAGE_CACHE_SIZE for the subpagesize-blocksize case. Signed-off-by: Chandra Seetharaman --- fs/btrfs/inode.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c79c9cd..c0c18ca 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6036,7 +6036,11 @@ next: if (found_type == BTRFS_FILE_EXTENT_REG || found_type == BTRFS_FILE_EXTENT_PREALLOC) { em->start = extent_start; - em->len = extent_end - extent_start; + if (inode->i_sb->s_blocksize < PAGE_CACHE_SIZE && + em->len < PAGE_CACHE_SIZE) + em->len = PAGE_CACHE_SIZE; + else + em->len = extent_end - extent_start; em->orig_start = extent_start - btrfs_file_extent_offset(leaf, item); em->orig_block_len = btrfs_file_extent_disk_num_bytes(leaf, @@ -6077,6 +6081,8 @@ next: extent_offset = page_offset(page) + pg_offset - extent_start; copy_size = min_t(u64, PAGE_CACHE_SIZE - pg_offset, size - extent_offset); + if (inode->i_sb->s_blocksize < PAGE_CACHE_SIZE) + copy_size = max_t(u64, copy_size, PAGE_CACHE_SIZE); em->start = extent_start + extent_offset; em->len = ALIGN(copy_size, btrfs_align_size(inode)); em->orig_block_len = em->len;