FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

LinkBack Thread Tools
Old 03-25-2012, 10:46 PM
Amar Mudrankit
Default Query about dm device max_discard_sectors

Hi all,

I am building an experimental device mapper target which is supposed to receive
all TRIM requests (REQ_DISCARD).* Irrespective of whether underlying actual
physical block device supports discards or not, my device mapper target should

receive REQ_DISCARD bios.

In my target, I set:

ti->num_discard_requests = 1;
ti->discards_supported = 1;

It looks like setting above 2 parameters did not get me any REQ_DISCARD
requests when "fstrim" utility is used.* The operations fails with "Operation not

supported" from kernel funcion:


because max_discard_sectors for device queue is set to 0.

max_discard_sectors = min(q->limits.max_discard_sectors, UINT_MAX >> 9);

if (unlikely(!max_discard_sectors))
****** return -EOPNOTSUPP;

When I further digged into the device mapper code, I found that
dm_calculate_queue_limits function sets the queue limits to default values
of 0 for both limits as well as ti_limits and thus blk_stack_limits eventually

sets max_discard_sectors to 0 for the device mapper target.

So, if my device mapper target does not implement iterate_devices function
(used to set max_discard_sectors based on underlying physical device's discard

support) or underlying physical device does not support discards, then there
is no way for device mapper target to set max_discard_sectors more than 0
to receive REQ_DISCARD commands.

Is this analysis correct? Or I am missing something?

Appreciate the help / advice.

Thanks and Regards,

dm-devel mailing list

Thread Tools

All times are GMT. The time now is 10:03 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org