Diff for /xfs-linux/xfs_mru_cache.c between versions 1.4 and 1.5

version 1.4, 2007/09/21 16:09:12 version 1.5, 2007/11/02 03:09:06
Line 225  _xfs_mru_cache_list_insert( Line 225  _xfs_mru_cache_list_insert(
  * list need to be deleted.  For each element this involves removing it from the   * list need to be deleted.  For each element this involves removing it from the
  * data store, removing it from the reap list, calling the client's free   * data store, removing it from the reap list, calling the client's free
  * function and deleting the element from the element zone.   * function and deleting the element from the element zone.
    *
    * We get called holding the mru->lock, which we drop and then reacquire.
    * Sparse need special help with this to tell it we know what we are doing.
  */   */
 STATIC void  STATIC void
 _xfs_mru_cache_clear_reap_list(  _xfs_mru_cache_clear_reap_list(
         xfs_mru_cache_t         *mru)          xfs_mru_cache_t         *mru) __releases(mru->lock) __acquires(mru->lock)
   
 {  {
         xfs_mru_cache_elem_t    *elem, *next;          xfs_mru_cache_elem_t    *elem, *next;
         struct list_head        tmp;          struct list_head        tmp;
Line 528  xfs_mru_cache_delete( Line 532  xfs_mru_cache_delete(
  *   *
  * If the element isn't found, this function returns NULL and the spinlock is   * If the element isn't found, this function returns NULL and the spinlock is
  * released.  xfs_mru_cache_done() should NOT be called when this occurs.   * released.  xfs_mru_cache_done() should NOT be called when this occurs.
    *
    * Because sparse isn't smart enough to know about conditional lock return
    * status, we need to help it get it right by annotating the path that does
    * not release the lock.
  */   */
 void *  void *
 xfs_mru_cache_lookup(  xfs_mru_cache_lookup(
Line 545  xfs_mru_cache_lookup( Line 553  xfs_mru_cache_lookup(
         if (elem) {          if (elem) {
                 list_del(&elem->list_node);                  list_del(&elem->list_node);
                 _xfs_mru_cache_list_insert(mru, elem);                  _xfs_mru_cache_list_insert(mru, elem);
         }                  __release(mru_lock); /* help sparse not be stupid */
         else          } else
                 spin_unlock(&mru->lock);                  spin_unlock(&mru->lock);
   
         return elem ? elem->value : NULL;          return elem ? elem->value : NULL;
Line 575  xfs_mru_cache_peek( Line 583  xfs_mru_cache_peek(
         elem = radix_tree_lookup(&mru->store, key);          elem = radix_tree_lookup(&mru->store, key);
         if (!elem)          if (!elem)
                 spin_unlock(&mru->lock);                  spin_unlock(&mru->lock);
           else
                   __release(mru_lock); /* help sparse not be stupid */
   
         return elem ? elem->value : NULL;          return elem ? elem->value : NULL;
 }  }
Line 586  xfs_mru_cache_peek( Line 596  xfs_mru_cache_peek(
  */   */
 void  void
 xfs_mru_cache_done(  xfs_mru_cache_done(
         xfs_mru_cache_t *mru)          xfs_mru_cache_t *mru) __releases(mru->lock)
 {  {
         spin_unlock(&mru->lock);          spin_unlock(&mru->lock);
 }  }

Removed from v.1.4  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>