diff mbox series

[v3] XArray: minor documentation improvements

Message ID 20241010141309.52527-2-tamird@gmail.com (mailing list archive)
State New
Headers show
Series [v3] XArray: minor documentation improvements | expand

Commit Message

Tamir Duberstein Oct. 10, 2024, 2:12 p.m. UTC
- Replace "they" with "you" where "you" is used in the preceding
  sentence fragment.
- Mention `xa_erase` in discussion of multi-index entries.  Split this
  into a separate sentence.
- Add "call" parentheses on "xa_store" for consistency and
  linkification.
- Add caveat that `xa_store` and `xa_erase` are not equivalent in the
  presence of `XA_FLAGS_ALLOC`.

Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
V2 -> V3:
  - metion `xa_erase`/`xa_store(NULL)` in multi-index entry discussion.
  - mention non-equivalent of `xa_erase`/`xa_store(NULL)` in the
    presence of `XA_FLAGS_ALLOC`.
V1 -> V2: s/use/you/ (Darrick J. Wong)

 Documentation/core-api/xarray.rst | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)

Comments

Randy Dunlap Oct. 10, 2024, 9:34 p.m. UTC | #1
Hi Tamir,

On 10/10/24 7:12 AM, Tamir Duberstein wrote:
>  Normal API
>  ==========
> @@ -63,13 +64,14 @@ for statically allocated XArrays or xa_init() for dynamically
>  allocated ones.  A freshly-initialised XArray contains a ``NULL``
>  pointer at every index.
>  
> -You can then set entries using xa_store() and get entries
> -using xa_load().  xa_store will overwrite any entry with the
> -new entry and return the previous entry stored at that index.  You can
> -use xa_erase() instead of calling xa_store() with a
> +You can then set entries using xa_store() and get entries using
> +xa_load().  xa_store() will overwrite any entry with the new entry and
> +return the previous entry stored at that index.  You can unset entries
> +using xa_erase() or by setting the entry to ``NULL`` using xa_store().
>  ``NULL`` entry.  There is no difference between an entry that has never

Is the line above supposed to be here?
Confusing to me.
Thanks.

> -been stored to, one that has been erased and one that has most recently
> -had ``NULL`` stored to it.
> +been stored to and one that has been erased with xa_erase(); an entry
> +that has most recently had ``NULL`` stored to it is also equivalent
> +except if the XArray was initialized with ``XA_FLAGS_ALLOC``.
Tamir Duberstein Oct. 10, 2024, 9:39 p.m. UTC | #2
Hi Randy!

On Thu, Oct 10, 2024 at 5:35 PM Randy Dunlap <rdunlap@infradead.org> wrote:
> > -You can then set entries using xa_store() and get entries
> > -using xa_load().  xa_store will overwrite any entry with the
> > -new entry and return the previous entry stored at that index.  You can
> > -use xa_erase() instead of calling xa_store() with a
> > +You can then set entries using xa_store() and get entries using
> > +xa_load().  xa_store() will overwrite any entry with the new entry and
> > +return the previous entry stored at that index.  You can unset entries
> > +using xa_erase() or by setting the entry to ``NULL`` using xa_store().
> >  ``NULL`` entry.  There is no difference between an entry that has never
>
> Is the line above supposed to be here?
> Confusing to me.
> Thanks.

Ah I think there's a latent sentence fragment there.
diff mbox series

Patch

diff --git a/Documentation/core-api/xarray.rst b/Documentation/core-api/xarray.rst
index 77e0ece2b1d6..78bbb031de91 100644
--- a/Documentation/core-api/xarray.rst
+++ b/Documentation/core-api/xarray.rst
@@ -42,8 +42,8 @@  call xa_tag_pointer() to create an entry with a tag, xa_untag_pointer()
 to turn a tagged entry back into an untagged pointer and xa_pointer_tag()
 to retrieve the tag of an entry.  Tagged pointers use the same bits that
 are used to distinguish value entries from normal pointers, so you must
-decide whether they want to store value entries or tagged pointers in
-any particular XArray.
+decide whether you want to store value entries or tagged pointers in any
+particular XArray.
 
 The XArray does not support storing IS_ERR() pointers as some
 conflict with value entries or internal entries.
@@ -52,8 +52,9 @@  An unusual feature of the XArray is the ability to create entries which
 occupy a range of indices.  Once stored to, looking up any index in
 the range will return the same entry as looking up any other index in
 the range.  Storing to any index will store to all of them.  Multi-index
-entries can be explicitly split into smaller entries, or storing ``NULL``
-into any entry will cause the XArray to forget about the range.
+entries can be explicitly split into smaller entries. Unsetting (using
+xa_erase() or xa_store() with ``NULL``) any entry will cause the XArray
+to forget about the range.
 
 Normal API
 ==========
@@ -63,13 +64,14 @@  for statically allocated XArrays or xa_init() for dynamically
 allocated ones.  A freshly-initialised XArray contains a ``NULL``
 pointer at every index.
 
-You can then set entries using xa_store() and get entries
-using xa_load().  xa_store will overwrite any entry with the
-new entry and return the previous entry stored at that index.  You can
-use xa_erase() instead of calling xa_store() with a
+You can then set entries using xa_store() and get entries using
+xa_load().  xa_store() will overwrite any entry with the new entry and
+return the previous entry stored at that index.  You can unset entries
+using xa_erase() or by setting the entry to ``NULL`` using xa_store().
 ``NULL`` entry.  There is no difference between an entry that has never
-been stored to, one that has been erased and one that has most recently
-had ``NULL`` stored to it.
+been stored to and one that has been erased with xa_erase(); an entry
+that has most recently had ``NULL`` stored to it is also equivalent
+except if the XArray was initialized with ``XA_FLAGS_ALLOC``.
 
 You can conditionally replace an entry at an index by using
 xa_cmpxchg().  Like cmpxchg(), it will only succeed if