xfs
[Top] [All Lists]

Re: REVIEW: Improve caching in libxfs

To: "Christoph Hellwig" <hch@xxxxxxxxxxxxx>
Subject: Re: REVIEW: Improve caching in libxfs
From: "Barry Naujok" <bnaujok@xxxxxxx>
Date: Thu, 04 Sep 2008 16:02:14 +1000
Cc: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
In-reply-to: <20080903234758.GA18368@xxxxxxxxxxxxx>
Organization: SGI
References: <op.ugv7ekj83jf8g2@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20080903234758.GA18368@xxxxxxxxxxxxx>
User-agent: Opera Mail/9.51 (Win32)
On Thu, 04 Sep 2008 09:47:58 +1000, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

 void
 cache_node_put(
+       struct cache *          cache,
        struct cache_node *     node)
 {
+       struct cache_mru *      mru;
+
        pthread_mutex_lock(&node->cn_mutex);
 #ifdef CACHE_DEBUG
        if (node->cn_count < 1) {
@@ -368,8 +372,23 @@ cache_node_put(
                                __FUNCTION__, node->cn_count, node);
                cache_abort();
        }
+       if (!list_empty(&node->cn_mru)) {
+               fprintf(stderr, "%s: node put on node (%p) in MRU list\n",
+                               __FUNCTION__, node);
+               cache_abort();
+       }

Assert that we don't put a node that's already on the mru list, okay.
Shouldn't this be ASSERT?

I chose to make this always abort as it can be triggered outside of
libxfs by xfsprogs usage of it (ie. doing a "put" on a buffer that has
already been "put").

So, I thought this needs to always work, debug or non-debug and
halt immediately if it happens.

<Prev in Thread] Current Thread [Next in Thread>