From patchwork Thu Jun 4 19:27:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 1303703 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49dG5X1PW8z9sPF for ; Fri, 5 Jun 2020 05:28:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 899B138930D5; Thu, 4 Jun 2020 19:27:56 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [IPv6:2a0c:e300::1]) by sourceware.org (Postfix) with ESMTPS id 2CE713840C0C for ; Thu, 4 Jun 2020 19:27:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2CE713840C0C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 62D4AE84; Thu, 4 Jun 2020 21:27:51 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wctwm-gHCYTd; Thu, 4 Jun 2020 21:27:50 +0200 (CEST) Received: from function (unknown [IPv6:2a01:cb19:956:1b00:9eb6:d0ff:fe88:c3c7]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 76A38CCC; Thu, 4 Jun 2020 21:27:50 +0200 (CEST) Received: from samy by function with local (Exim 4.93) (envelope-from ) id 1jgvWm-00AXER-Qx; Thu, 04 Jun 2020 21:27:48 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [commited] support: Fix detecting hole support on >2KB-block filesystems Date: Thu, 4 Jun 2020 21:27:48 +0200 Message-Id: <20200604192748.2510982-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" When detecting hole support, we write at 16MiB, and filesystems will typically need two levels of data to record that. On filesystems with 8KB block, the two indirection blocks will require a total of 16KB overhead, thus 32 512-byte sectors. Spotted on GNU/Hurd with a 4KB blocks filesystem, but also happens on Linux with 4KB or 8KB blocks filesystems. * support/support_descriptor_supports_holes.c (support_descriptor_supports_holes): Set block_headroom to 32. --- support/support_descriptor_supports_holes.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/support/support_descriptor_supports_holes.c b/support/support_descriptor_supports_holes.c index fc2aa76f10..d3d5d3a938 100644 --- a/support/support_descriptor_supports_holes.c +++ b/support/support_descriptor_supports_holes.c @@ -34,8 +34,10 @@ support_descriptor_supports_holes (int fd) write_offset = 16 * 1024 * 1024, /* Our write may add this number of additional blocks (see - block_limit below). */ - block_headroom = 8, + block_limit below): writing at offset 16M can require two data block + indirections, each of which can be as large as 8KB on ext2, thus 32 + 512B sectors. */ + block_headroom = 32, }; struct stat64 st;