diff options
Diffstat (limited to 'lib/xarray.c')
| -rw-r--r-- | lib/xarray.c | 12 | 
1 files changed, 9 insertions, 3 deletions
| diff --git a/lib/xarray.c b/lib/xarray.c index 9644b18af18d..ae3d80f4b4ee 100644 --- a/lib/xarray.c +++ b/lib/xarray.c @@ -1742,20 +1742,23 @@ static inline void *__xa_cmpxchg_raw(struct xarray *xa, unsigned long index,  			void *old, void *entry, gfp_t gfp);  /** - * __xa_cmpxchg() - Store this entry in the XArray. + * __xa_cmpxchg() - Conditionally replace an entry in the XArray.   * @xa: XArray.   * @index: Index into array.   * @old: Old value to test against. - * @entry: New entry. + * @entry: New value to place in array.   * @gfp: Memory allocation flags.   *   * You must already be holding the xa_lock when calling this function.   * It will drop the lock if needed to allocate memory, and then reacquire   * it afterwards.   * + * If the entry at @index is the same as @old, replace it with @entry. + * If the return value is equal to @old, then the exchange was successful. + *   * Context: Any context.  Expects xa_lock to be held on entry.  May   * release and reacquire xa_lock if @gfp flags permit. - * Return: The old entry at this index or xa_err() if an error happened. + * Return: The old value at this index or xa_err() if an error happened.   */  void *__xa_cmpxchg(struct xarray *xa, unsigned long index,  			void *old, void *entry, gfp_t gfp) @@ -1907,6 +1910,7 @@ EXPORT_SYMBOL(xa_store_range);   * @xas: XArray operation state.   *   * Called after xas_load, the xas should not be in an error state. + * The xas should not be pointing to a sibling entry.   *   * Return: A number between 0 and 63 indicating the order of the entry.   */ @@ -1917,6 +1921,8 @@ int xas_get_order(struct xa_state *xas)  	if (!xas->xa_node)  		return 0; +	XA_NODE_BUG_ON(xas->xa_node, xa_is_sibling(xa_entry(xas->xa, +		       xas->xa_node, xas->xa_offset)));  	for (;;) {  		unsigned int slot = xas->xa_offset + (1 << order); | 
