mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Lingfeng <lilingfeng3@huawei.com>
To: <thornber@redhat.com>, <dm-devel@redhat.com>, <agk@redhat.com>,
	<snitzer@kernel.org>, Joe Thornber <ejt@redhat.com>
Cc: <linux-kernel@vger.kernel.org>, Hou Tao <houtao1@huawei.com>,
	"zhangyi (F)" <yi.zhang@huawei.com>,
	"yukuai (C)" <yukuai3@huawei.com>,
	yangerkun <yangerkun@huawei.com>
Subject: [Question] Can DATA_DEV_BLOCK_SIZE_MIN_SECTORS be set to a smaller value
Date: Mon, 26 Jun 2023 20:19:03 +0800	[thread overview]
Message-ID: <faeb60a9-8bde-d31d-acf5-a2bcda6cad72@huawei.com> (raw)

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?


             reply	other threads:[~2023-06-26 12:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 12:19 Li Lingfeng [this message]
2023-06-26 12:25 ` [dm-devel] " Zdenek Kabelac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=faeb60a9-8bde-d31d-acf5-a2bcda6cad72@huawei.com \
    --to=lilingfeng3@huawei.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ejt@redhat.com \
    --cc=houtao1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=snitzer@kernel.org \
    --cc=thornber@redhat.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®