Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16073314rwd; Mon, 26 Jun 2023 05:31:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7r4oAy4tIDQLkGP2ln2vFuW06XXvsrX8w93X+4pCOsjQ+ixJlDyWCRq4ACR9CAZvFSfWh0 X-Received: by 2002:a05:6a00:1804:b0:666:ada0:4b01 with SMTP id y4-20020a056a00180400b00666ada04b01mr17876592pfa.32.1687782703552; Mon, 26 Jun 2023 05:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687782703; cv=none; d=google.com; s=arc-20160816; b=zJsNz1AHGxEZ/LVwKmKp6Fe2iigZ6ktAEAErE3jB2QHLXbCmhqZGPldOglFofSf7L2 TxVuSv411Y4MbMwmYOi2mu031lBw9OfeeB4jTo5HN4YTNC//66E7Hqm7Jm0Kn1XebLDl DgahTt/kih0wcgBL/di6pJZtlZxACTVVX9wThOLaE5Mi1XAm+tKGYUlE9eEsTpYgWPy1 8rRi3tZeWi4TawN5OA7cg/RtHmw6H/KgUrVj79jzFjcfAVsVDT+DSkgjQ+jxlyygQzI3 bXlYetepxfDGraFPYo7q2qQLg0/Bj/HLakH5mjP2ihxN8tJjD49cVtk5A1nwKVQATzSa NN9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:subject:from:cc:to :user-agent:mime-version:date:message-id; bh=UX7jjHT0C2U4Xt3Ji9HCwdX8DaskP9WV7Nt0seudIgs=; fh=pqvRhk+03LOU2rbv+Nt8agFyxbjwQPEc8dsEkCW77u8=; b=gvLiPnfMGl62xwukUF5ao/lpewsWPetWUVXS5xEIvX3PLfFeIZTlMbexaN48ipEjQ7 tzNnCDxvBn2Acm9wJkwhTU1AqtL9Z4vY26nFRilpmWJJwkJFDQFyEsj+ysldF4a3ZYVL h0rujyvltTOyS77Bvd1VyZoHgaKshvKLi989ARfsves3Qg4Th966gQzieLcr4zdXxkfR SV6HtEQ7sU1iDucJW2+prFou7KpDneawY5InMPfj/cvQmNmfNH5E2/AuTJcunFbXx1yE 6nMptOekz937htpeA0HuCM193U0kD/F/SWoD3hNccUVzxJG4CTiiDr31fCAtrL6LpeSm JoYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr11-20020a056a000f0b00b006791029dbedsi1251391pfb.157.2023.06.26.05.31.30; Mon, 26 Jun 2023 05:31:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230457AbjFZMTw (ORCPT + 99 others); Mon, 26 Jun 2023 08:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbjFZMT3 (ORCPT ); Mon, 26 Jun 2023 08:19:29 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAA3E10DE for ; Mon, 26 Jun 2023 05:19:07 -0700 (PDT) Received: from dggpemm500011.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QqRdx6QH2zlVwY; Mon, 26 Jun 2023 20:16:21 +0800 (CST) Received: from [10.174.179.155] (10.174.179.155) by dggpemm500011.china.huawei.com (7.185.36.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 26 Jun 2023 20:19:03 +0800 Message-ID: Date: Mon, 26 Jun 2023 20:19:03 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Thunderbird/104.0 To: , , , , Joe Thornber CC: , Hou Tao , "zhangyi (F)" , "yukuai (C)" , yangerkun From: Li Lingfeng Subject: [Question] Can DATA_DEV_BLOCK_SIZE_MIN_SECTORS be set to a smaller value Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.155] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500011.china.huawei.com (7.185.36.110) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello: Recently, I found that the used space of the thin-pool will keep rising if I use dm-thin as follow: // create dm-thin dmsetup create linear_1 --table "0 2097152 linear /dev/sdc 0" dmsetup create linear_2 --table "0 16777216  linear /dev/sdc 2097153" dd if=/dev/zero of=/dev/mapper/linear_1 bs=4096 count=1 dmsetup create pool --table "0 16777216 thin-pool /dev/mapper/linear_1 /dev/mapper/linear_2 128 0 1 skip_block_zeroing" dmsetup message /dev/mapper/pool 0 "create_thin 0" dmsetup create thin --table "0 14680064 thin /dev/mapper/pool 0" // mkfs and mount with discard mkfs.ext4 /dev/mapper/thin mount /dev/mapper/thin /mnt/test -o discard cd /mnt/test // create a file(17KB) dd if=/dev/random of=testfile bs=1k count=17 oflag=direct sync // truncate the file and write it for many times dd if=/dev/random of=testfile bs=1k count=17 oflag=direct sync ... Ext4 will issue discard IO to dm-thin when truncating file. However, DATA_DEV_BLOCK_SIZE_MIN_SECTORS is set as 64KB which means the discard covers less than a block when I truncating a 17KB file. As the result of it, discard bio will end in process_discard_bio(), and more and more blocks will leak. I'm curious about the reason behind setting DATA_DEV_BLOCK_SIZE_MIN_SECTORS to 64KB. Is there any specific consideration for this? Would it be possible to set this minimum limit to a smaller value, such as 4KB?