<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/md/persistent-data/dm-space-map-common.c, branch linux-4.9.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.9.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-01-27T07:47:38Z</updated>
<entry>
<title>dm space map common: add bounds check to sm_ll_lookup_bitmap()</title>
<updated>2022-01-27T07:47:38Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2021-12-10T13:49:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=48614c7fdf622ccde68ebbd36b89e801488c3452'/>
<id>urn:sha1:48614c7fdf622ccde68ebbd36b89e801488c3452</id>
<content type='text'>
[ Upstream commit cba23ac158db7f3cd48a923d6861bee2eb7a2978 ]

Corrupted metadata could warrant returning error from sm_ll_lookup_bitmap().

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>dm space map common: fix division bug in sm_ll_find_free_block()</title>
<updated>2021-05-22T08:40:20Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2021-04-13T08:11:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a104a5e703df93d29a17a1d30737ab61b69d63c8'/>
<id>urn:sha1:a104a5e703df93d29a17a1d30737ab61b69d63c8</id>
<content type='text'>
commit 5208692e80a1f3c8ce2063a22b675dd5589d1d80 upstream.

This division bug meant the search for free metadata space could skip
the final allocation bitmap's worth of entries. Fix affects DM thinp,
cache and era targets.

Cc: stable@vger.kernel.org
Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Tested-by: Ming-Hung Tsai &lt;mtsai@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>dm space map common: fix to ensure new block isn't already in use</title>
<updated>2020-02-14T21:31:01Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2020-01-07T11:58:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=17c0d259c157f0e79a489673398be364bea38abe'/>
<id>urn:sha1:17c0d259c157f0e79a489673398be364bea38abe</id>
<content type='text'>
commit 4feaef830de7ffdd8352e1fe14ad3bf13c9688f8 upstream.

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;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>dm persistent data: eliminate unnecessary return values</title>
<updated>2015-10-31T23:06:02Z</updated>
<author>
<name>Mikulas Patocka</name>
</author>
<published>2015-10-22T20:46:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4c7da06f5a780bbf44ebd7547789e48536d0a823'/>
<id>urn:sha1:4c7da06f5a780bbf44ebd7547789e48536d0a823</id>
<content type='text'>
dm_bm_unlock and dm_tm_unlock return an integer value but the returned
value is always 0.  The calling code sometimes checks the return value
and sometimes doesn't.

Eliminate these unnecessary return values and also the checks for them.

Signed-off-by: Mikulas Patocka &lt;mpatocka@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm space map common: make sure new space is used during extend</title>
<updated>2014-01-08T02:05:17Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2014-01-07T15:47:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=12c91a5c2d2a8e8cc40a9552313e1e7b0a2d9ee3'/>
<id>urn:sha1:12c91a5c2d2a8e8cc40a9552313e1e7b0a2d9ee3</id>
<content type='text'>
When extending a low level space map we should update nr_blocks at
the start so the new space is used for the index entries.

Otherwise extend can fail, e.g.: sm_metadata_extend call sequence
that fails:
 -&gt; sm_ll_extend
    -&gt; dm_tm_new_block -&gt; dm_sm_new_block -&gt; sm_bootstrap_new_block
    =&gt; returns -ENOSPC because smm-&gt;begin == smm-&gt;ll.nr_blocks

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Cc: stable@vger.kernel.org
</content>
</entry>
<entry>
<title>dm space map: disallow decrementing a reference count below zero</title>
<updated>2013-12-13T19:22:09Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2013-12-13T12:31:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5b564d80f8bc21094c0cd2b19b679d983aabcc29'/>
<id>urn:sha1:5b564d80f8bc21094c0cd2b19b679d983aabcc29</id>
<content type='text'>
The old behaviour, returning -EINVAL if a ref_count of 0 would be
decremented, was removed in commit f722063 ("dm space map: optimise
sm_ll_dec and sm_ll_inc").  To fix this regression we return an error
code from the mutator function pointer passed to sm_ll_mutate() and have
dec_ref_count() return -EINVAL if the old ref_count is 0.

Add a DMERR to reflect the potential seriousness of this error.

Also, add missing dm_tm_unlock() to sm_ll_mutate()'s error path.

With this fix the following dmts regression test now passes:
 dmtest run --suite cache -n /metadata_use_kernel/

The next patch fixes the higher-level dm-array code that exposed this
regression.

Signed-off-by: Joe Thornber &lt;ejt@redhat.com&gt;
Signed-off-by: Mike Snitzer &lt;snitzer@redhat.com&gt;
Cc: stable@vger.kernel.org # 3.12+
</content>
</entry>
<entry>
<title>dm space map: optimise sm_ll_dec and sm_ll_inc</title>
<updated>2013-08-23T13:02:14Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2013-08-09T12:04:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f722063ee01c0060488e1000006405449451cfa0'/>
<id>urn:sha1:f722063ee01c0060488e1000006405449451cfa0</id>
<content type='text'>
Prior to this patch these methods did a lookup followed by an insert.
Instead they now call a common mutate function that adjusts the value
according to a callback function.  This avoids traversing the data
structures twice and hence improves performance.

Also factor out sm_ll_lookup_big_ref_count() for use by both
sm_ll_lookup() and sm_ll_mutate().

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: use DMERR_LIMIT for errors</title>
<updated>2012-12-21T20:23:34Z</updated>
<author>
<name>Mike Snitzer</name>
</author>
<published>2012-12-21T20:23:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=89ddeb8cb1383bfdfaaeb458f1c4a91e890cc60b'/>
<id>urn:sha1:89ddeb8cb1383bfdfaaeb458f1c4a91e890cc60b</id>
<content type='text'>
Nearly all of persistent-data is in the IO path so throttle error
messages with DMERR_LIMIT to limit the amount logged when
something has gone wrong.

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: convert to use le32_add_cpu</title>
<updated>2012-10-12T15:59:47Z</updated>
<author>
<name>Wei Yongjun</name>
</author>
<published>2012-10-12T15:59:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0bcf08798eb9fc3cd0fe2e6b74b25f3f57fa8af2'/>
<id>urn:sha1:0bcf08798eb9fc3cd0fe2e6b74b25f3f57fa8af2</id>
<content type='text'>
Convert cpu_to_le32(le32_to_cpu(E1) + E2) to use le32_add_cpu().

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun &lt;yongjun_wei@trendmicro.com.cn&gt;
Signed-off-by: Alasdair G Kergon &lt;agk@redhat.com&gt;
</content>
</entry>
<entry>
<title>dm persistent data: only commit space map if index changed</title>
<updated>2012-07-27T14:08:06Z</updated>
<author>
<name>Joe Thornber</name>
</author>
<published>2012-07-27T14:08:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f4b90369d3a9ffe0f48f373c566578c142e95bf2'/>
<id>urn:sha1:f4b90369d3a9ffe0f48f373c566578c142e95bf2</id>
<content type='text'>
Introduce bitmap_index_changed to track whether or not the index changed
then only commit a space map if it did.

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>
</feed>
