From patchwork Fri Nov 8 22:01:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mason X-Patchwork-Id: 3160051 Return-Path: X-Original-To: patchwork-linux-btrfs@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 8FBBDC045B for ; Fri, 8 Nov 2013 22:01:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91CBF20127 for ; Fri, 8 Nov 2013 22:01:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9E2DD20114 for ; Fri, 8 Nov 2013 22:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758055Ab3KHWBo (ORCPT ); Fri, 8 Nov 2013 17:01:44 -0500 Received: from dkim2.fusionio.com ([66.114.96.54]:44987 "EHLO dkim2.fusionio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757583Ab3KHWBn convert rfc822-to-8bit (ORCPT ); Fri, 8 Nov 2013 17:01:43 -0500 Received: from mx1.fusionio.com (unknown [10.101.1.160]) by dkim2.fusionio.com (Postfix) with ESMTP id E59109A06DB for ; Fri, 8 Nov 2013 15:01:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fusionio.com; s=default; t=1383948102; bh=O9lWm26UZ23mCLy/4izTr9c+Fl4SBh3m4FP3NVprktE=; h=To:From:Subject:Date; b=lQtxzYuTRS1bmTWiwKzkFJ0S4NYswDCHDDiGvo0+vj13GxhqZHWIozXaIoqr1vx3D RfTRaaV4iKWjqsGV+2csHhrmGSnTmWnCelrRZKE8P7ztL71r1q6fOJXN65aKLHAyPi PNIR4pmgwyhEi2DXhpjMbQ4r95kVgxt8/oMZimTY= X-ASG-Debug-ID: 1383948102-03d6a54d1b16a750001-6jHSXT Received: from CAS1.int.fusionio.com ([10.101.1.40]) by mx1.fusionio.com with ESMTP id Loj4XCZjUG4ctdA9 (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Fri, 08 Nov 2013 15:01:42 -0700 (MST) X-Barracuda-Envelope-From: clmason@fusionio.com Received: from localhost (10.101.1.160) by mail.fusionio.com (10.101.1.40) with Microsoft SMTP Server (TLS) id 14.3.158.1; Fri, 8 Nov 2013 15:01:40 -0700 MIME-Version: 1.0 To: "linux-btrfs@vger.kernel.org" , David Sterba , Eric Sandeen Message-ID: <20131108220135.3802.39092@localhost.localdomain> From: Chris Mason User-Agent: alot/0.3.4 Subject: progs integration branch moved to master (new default leafsize) Date: Fri, 8 Nov 2013 17:01:35 -0500 X-ASG-Orig-Subj: progs integration branch moved to master (new default leafsize) X-Originating-IP: [10.101.1.160] X-Barracuda-Connect: UNKNOWN[10.101.1.40] X-Barracuda-Start-Time: 1383948102 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: http://10.101.1.180:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at fusionio.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using per-user scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.142173 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Hi everyone, This patch is now the tip of the master branch for btrfs-progs, which has been updated to include most of the backlogged progs patches. Please take a look and give it a shake. This was based on Dave's integration tree (many thanks Dave!) minus the patches for online dedup. I've pulled in the coverity fixes and a few others from the list as well. The patch below switches our default mkfs leafsize up to 16K. This should be a better choice in almost every workload, but now is your chance to complain if it causes trouble. -------------------------------- 16KB is faster and leads to less metadata fragmentation in almost all workloads. It does slightly increase lock contention on the root nodes in some workloads, but that is best dealt with by adding more subvolumes (for now). This uses 16KB or the page size, whichever is bigger. If you're doing a mixed block group mkfs, it uses the sectorsize instead. Since the kernel refuses to mount a mixed block group FS where the metadata leaf size doesn't match the data sectorsize, this also adds a similar check during mkfs. Signed-off-by: Chris Mason --- mkfs.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/mkfs.c b/mkfs.c index bf8a831..cd0af9e 100644 --- a/mkfs.c +++ b/mkfs.c @@ -46,6 +46,8 @@ static u64 index_cnt = 2; +#define DEFAULT_MKFS_LEAF_SIZE 16384 + struct directory_name_entry { char *dir_name; char *path; @@ -1222,7 +1224,7 @@ int main(int ac, char **av) u64 alloc_start = 0; u64 metadata_profile = 0; u64 data_profile = 0; - u32 leafsize = sysconf(_SC_PAGESIZE); + u32 leafsize = max_t(u32, sysconf(_SC_PAGESIZE), DEFAULT_MKFS_LEAF_SIZE); u32 sectorsize = 4096; u32 nodesize = leafsize; u32 stripesize = 4096; @@ -1232,6 +1234,7 @@ int main(int ac, char **av) int ret; int i; int mixed = 0; + int leaf_forced = 0; int data_profile_opt = 0; int metadata_profile_opt = 0; int discard = 1; @@ -1269,6 +1272,7 @@ int main(int ac, char **av) case 'n': nodesize = parse_size(optarg); leafsize = parse_size(optarg); + leaf_forced = 1; break; case 'L': label = parse_label(optarg); @@ -1386,8 +1390,21 @@ int main(int ac, char **av) BTRFS_BLOCK_GROUP_RAID0 : 0; /* raid0 or single */ } } else { + u32 best_leafsize = max_t(u32, sysconf(_SC_PAGESIZE), sectorsize); metadata_profile = 0; data_profile = 0; + + if (!leaf_forced) { + leafsize = best_leafsize; + nodesize = best_leafsize; + if (check_leaf_or_node_size(leafsize, sectorsize)) + exit(1); + } + if (leafsize != sectorsize) { + fprintf(stderr, "Error: mixed metadata/data block groups " + "require metadata blocksizes equal to the sectorsize\n"); + exit(1); + } } ret = test_num_disk_vs_raid(metadata_profile, data_profile,