<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/drivers/md/persistent-data/dm-space-map-disk.c, branch v6.1.4</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.1.4</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v6.1.4'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2021-06-04T16:07:22Z</updated>
<entry>
<title>dm space maps: improve performance with inc/dec on ranges of blocks</title>
<updated>2021-06-04T16:07:22Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2021-04-13T10:03:45Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=be500ed721a6ec8d49bf0814c277ce7162acee0e'/>
<id>urn:sha1:be500ed721a6ec8d49bf0814c277ce7162acee0e</id>
<content type='text'>
When we break sharing on btree nodes we typically need to increment
the reference counts to every value held in the node.  This can
cause a lot of repeated calls to the space maps.  Fix this by changing
the interface to the space map inc/dec methods to take ranges of
adjacent blocks to be operated on.

For installations that are using a lot of snapshots this will reduce
cpu overhead of fundamental operations such as provisioning a new block,
or deleting a snapshot, by as much as 10 times.

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm space maps: don't reset space map allocation cursor when committing</title>
<updated>2021-06-04T16:07:21Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2021-04-13T08:03:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5faafc77f7de69147d1e818026b9a0cbf036a7b2'/>
<id>urn:sha1:5faafc77f7de69147d1e818026b9a0cbf036a7b2</id>
<content type='text'>
Current commit code resets the place where the search for free blocks
will begin back to the start of the metadata device.  There are a couple
of repercussions to this:

- The first allocation after the commit is likely to take longer than
  normal as it searches for a free block in an area that is likely to
  have very few free blocks (if any).

- Any free blocks it finds will have been recently freed.  Reusing them
  means we have fewer old copies of the metadata to aid recovery from
  hardware error.

Fix these issues by leaving the cursor alone, only resetting when the
search hits the end of the metadata device.

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm space map disk: remove redundant calls to sm_disk_get_nr_free()</title>
<updated>2021-04-19T16:36:46Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2021-03-09T14:56:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d6db294fd8194e05a82f368ad97f4efafbd04f2a'/>
<id>urn:sha1:d6db294fd8194e05a82f368ad97f4efafbd04f2a</id>
<content type='text'>
Both sm_disk_new_block and sm_disk_commit are needlessly calling
sm_disk_get_nr_free(). Looks like old queries used for some
debugging.

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm space map common: fix to ensure new block isn't already in use</title>
<updated>2020-01-15T01:15:53Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2020-01-07T11:58:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4feaef830de7ffdd8352e1fe14ad3bf13c9688f8'/>
<id>urn:sha1:4feaef830de7ffdd8352e1fe14ad3bf13c9688f8</id>
<content type='text'>
The space-maps track the reference counts for disk blocks allocated by
both the thin-provisioning and cache targets.  There are variants for
tracking metadata blocks and data blocks.

Transactionality is implemented by never touching blocks from the
previous transaction, so we can rollback in the event of a crash.

When allocating a new block we need to ensure the block is free (has
reference count of 0) in both the current and previous transaction.
Prior to this fix we were doing this by searching for a free block in
the previous transaction, and relying on a 'begin' counter to track
where the last allocation in the current transaction was.  This
'begin' field was not being updated in all code paths (eg, increment
of a data block reference count due to breaking sharing of a neighbour
block in the same btree leaf).

This fix keeps the 'begin' field, but now it's just a hint to speed up
the search.  Instead the current transaction is searched for a free
block, and then the old transaction is double checked to ensure it's
free.  Much simpler.

This fixes reports of sm_disk_new_block()'s BUG_ON() triggering when
DM thin-provisioning's snapshots are heavily used.

Reported-by: Eric Wheeler &lt;dm-devel@lists.ewheeler.net&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm space map disk: fix some book keeping in the disk space map</title>
<updated>2017-05-15T19:09:50Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2017-05-15T13:45:40Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0377a07c7a035e0d033cd8b29f0cb15244c0916a'/>
<id>urn:sha1:0377a07c7a035e0d033cd8b29f0cb15244c0916a</id>
<content type='text'>
When decrementing the reference count for a block, the free count wasn't
being updated if the reference count went to zero.

Cc: stable@vger.kernel.org
Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm space map disk: fix sm_disk_count_is_more_than_one()</title>
<updated>2015-02-14T00:32:58Z</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2015-02-12T21:25:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=145b9006a0ae753582902170ec1da49f89501845'/>
<id>urn:sha1:145b9006a0ae753582902170ec1da49f89501845</id>
<content type='text'>
dm_tm_shadow_block() is the only caller of
dm_sm_count_is_more_than_one() which only ever operates on a metadata
space-map.  So in practice, sm_disk_count_is_more_than_one() isn't
actually used (which explains why this bug never amounted to anything).

But fix sm_disk_count_is_more_than_one() to properly set *result and
return 0.

Reported-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm space map disk: optimise sm_disk_dec_block</title>
<updated>2013-11-09T23:20:24Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2013-08-09T13:19:32Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=40c57f475f416ab241124e1e6a593b2f982eaae3'/>
<id>urn:sha1:40c57f475f416ab241124e1e6a593b2f982eaae3</id>
<content type='text'>
Don't waste time spotting blocks that have been allocated and then freed
in the same transaction.

The extra lookup is expensive, and I don't think it really gives us much.

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm persistent data: add threshold callback to space map</title>
<updated>2013-05-10T13:37:20Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2013-05-10T13:37:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7c3d3f2a87b01ff167a5f048285d5e3dee920235'/>
<id>urn:sha1:7c3d3f2a87b01ff167a5f048285d5e3dee920235</id>
<content type='text'>
Add a threshold callback function to the persistent data space map
interface for a subsequent patch to use.

dm-thin and dm-cache are interested in knowing when they're getting
low on metadata or data blocks.  This patch introduces a new method
for registering a callback against a threshold.

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm persistent data: remove debug space map checker</title>
<updated>2012-07-27T14:07:58Z</updated>
<author>
<name>Joe Thornber</name>
<email>ejt@redhat.com</email>
</author>
<published>2012-07-27T14:07:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3caf6d73d4dc163b2d135e0b52b052a2b63e5216'/>
<id>urn:sha1:3caf6d73d4dc163b2d135e0b52b052a2b63e5216</id>
<content type='text'>
Remove debug space map checker from dm persistent data.

The space map checker is a wrapper for other space maps that double
checks the reference counts are correct.  It holds all these reference
counts in memory rather than on disk, so uses a lot of memory and is
thus restricted to small pools.

As yet, this checker hasn't found any issues, but has caused a few of
its own due to people turning it on by default with larger pools.

Removing.

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm persistent data: handle space map checker creation failure</title>
<updated>2012-07-03T11:55:35Z</updated>
<author>
<name>Mike Snitzer</name>
<email>snitzer@redhat.com</email>
</author>
<published>2012-07-03T11:55:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=62662303e7f590fdfbb0070ab820a0ad4267c119'/>
<id>urn:sha1:62662303e7f590fdfbb0070ab820a0ad4267c119</id>
<content type='text'>
If CONFIG_DM_DEBUG_SPACE_MAPS is enabled and dm_sm_checker_create()
fails, dm_tm_create_internal() would still return success even though it
cleaned up all resources it was supposed to have created.  This will
lead to a kernel crash:

general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC
...
RIP: 0010:[&lt;ffffffff81593659&gt;]  [&lt;ffffffff81593659&gt;] dm_bufio_get_block_size+0x9/0x20
Call Trace:
  [&lt;ffffffff81599bae&gt;] dm_bm_block_size+0xe/0x10
  [&lt;ffffffff8159b8b8&gt;] sm_ll_init+0x78/0xd0
  [&lt;ffffffff8159c1a6&gt;] sm_ll_new_disk+0x16/0xa0
  [&lt;ffffffff8159c98e&gt;] dm_sm_disk_create+0xfe/0x160
  [&lt;ffffffff815abf6e&gt;] dm_pool_metadata_open+0x16e/0x6a0
  [&lt;ffffffff815aa010&gt;] pool_ctr+0x3f0/0x900
  [&lt;ffffffff8158d565&gt;] dm_table_add_target+0x195/0x450
  [&lt;ffffffff815904c4&gt;] table_load+0xe4/0x330
  [&lt;ffffffff815917ea&gt;] ctl_ioctl+0x15a/0x2c0
  [&lt;ffffffff81591963&gt;] dm_ctl_ioctl+0x13/0x20
  [&lt;ffffffff8116a4f8&gt;] do_vfs_ioctl+0x98/0x560
  [&lt;ffffffff8116aa51&gt;] sys_ioctl+0x91/0xa0
  [&lt;ffffffff81869f52&gt;] system_call_fastpath+0x16/0x1b

Fix the space map checker code to return an appropriate ERR_PTR and have
dm_sm_disk_create() and dm_tm_create_internal() check for it with
IS_ERR.

Reported-by: Vivek Goyal &lt;vgoyal@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
</feed>
