Skip to contentSkip to conversation

radix-tree: fix comment about "exceptional" bits

PATCH Applied Ross Zwisler 2 participants 2 messages Jul 20, 2016 libnvdimm: non-volatile memory device

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 radix-tree: fix comment about "exceptional" bits

The bottom two bits of radix tree entries are reserved for special use by the radix tree code itself. A comment detailing their usage was added by:

commit 3bcadd6fa6c4 ("radix-tree: free up the bottom bit of exceptional entries for reuse")

This comment states that if the bottom two bits are '11', this means that this is a locked exceptional entry.

It turns out that this bit combination was never actually used. Radix tree locking for DAX was indeed implemented, but it actually used the third LSB:

/* We use lowest available exceptional entry bit for locking */ #define RADIX_DAX_ENTRY_LOCK (1 << RADIX_TREE_EXCEPTIONAL_SHIFT)

This locking code was also made specific to the DAX code instead of being generally implemented in radix-tree.h.

So, fix the comment.

---
 include/linux/radix-tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/radix-tree.h +1 -1
index cb4b7e8..f0fb327 100644
@@ -35,7 +35,7 @@
  * 00 - data pointer
  * 01 - internal entry
  * 10 - exceptional entry
- * 11 - locked exceptional entry
+ * 11 - this bit combination is currently unused/reserved
  *
  * The internal entry may be a pointer to the next level in the tree, a
  * sibling entry, or an indicator that the entry in this slot has been moved
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Ross Zwisler

The bottom two bits of radix tree entries are reserved for special use by the radix tree code itself. A comment detailing their usage was added by:

commit 3bcadd6fa6c4 ("radix-tree: free up the bottom bit of exceptional entries for reuse")

This comment states that if the bottom two bits are '11', this means that this is a locked exceptional entry.

It turns out that this bit combination was never actually used. Radix tree locking for DAX was indeed implemented, but it actually used the third LSB:

/* We use lowest available exceptional entry bit for locking */ #define RADIX_DAX_ENTRY_LOCK (1 << RADIX_TREE_EXCEPTIONAL_SHIFT)

Quoted 6 lines

This locking code was also made specific to the DAX code instead of being generally implemented in radix-tree.h.

So, fix the comment.

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850