From patchwork Fri Jul 25 04:27:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 4621341 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 CE82E9F36A for ; Fri, 25 Jul 2014 04:27:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 14388201EF for ; Fri, 25 Jul 2014 04:27:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 191AA201E4 for ; Fri, 25 Jul 2014 04:27:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752164AbaGYE1f (ORCPT ); Fri, 25 Jul 2014 00:27:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20293 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752087AbaGYE1e (ORCPT ); Fri, 25 Jul 2014 00:27:34 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6P4RXdW020846 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 25 Jul 2014 00:27:33 -0400 Received: from liberator.sandeen.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6P4RWAV030851 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Fri, 25 Jul 2014 00:27:33 -0400 Message-ID: <53D1DCB4.8090409@redhat.com> Date: Thu, 24 Jul 2014 23:27:32 -0500 From: Eric Sandeen MIME-Version: 1.0 To: linux-btrfs Subject: [PATCH] mkfs.btrfs: round all device sizes to sectorsize X-Enigmail-Version: 1.6 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 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.9 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 make_btrfs() rounds down the first device size to a multiple of sectorsize: num_bytes = (num_bytes / sectorsize) * sectorsize; but subsequent device adds don't. This seems a bit odd & inconsistent, and it makes xfstest btrfs/011 _notrun(), because it explicitly checks that devices are the same size. I don't know that there is anything inherently wrong with having a few device bytes extend past the last block, but to be consistent, it seems like btrfs_add_to_fsid() should round the size in the same way. And now btrfs/011 runs more consistently; the test devices don't have to be sectorsize multiples in order for all mkfs'd device sizes to match. Signed-off-by: Eric Sandeen --- ideally this might go into btrfs_device_size(), but we don't have the chosen sector size anywhere near there... -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/utils.c b/utils.c index e130849..4d7ee35 100644 --- a/utils.c +++ b/utils.c @@ -554,7 +554,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans, device->sector_size = sectorsize; device->fd = fd; device->writeable = 1; - device->total_bytes = block_count; + device->total_bytes = (block_count / sectorsize) * sectorsize; device->bytes_used = 0; device->total_ios = 0; device->dev_root = root->fs_info->dev_root;