]> git.sur5r.net Git - bacula/bacula/commitdiff
Move the shortcut logic up so its a real shortcut again.
authorMarco van Wieringen <mvw@planets.elm.net>
Fri, 11 Nov 2011 11:55:05 +0000 (12:55 +0100)
committerMarco van Wieringen <mvw@planets.elm.net>
Sat, 12 Nov 2011 09:09:13 +0000 (10:09 +0100)
bacula/src/lib/mntent_cache.c

index 2c68bdcefcf8be46de449b530de91b2fa79391ef..6d762399805fbdc8b7468b24307e471a3215d024 100644 (file)
@@ -108,8 +108,11 @@ static time_t last_rescan = 0;
  * Add a new entry to the cache.
  * This function should be called with a write lock on the mntent_cache.
  */
-static inline void add_mntent_mapping(uint32_t dev, const char *special, const char *mountpoint,
-                                      const char *fstype, const char *mntopts)
+static inline void add_mntent_mapping(uint32_t dev,
+                                      const char *special,
+                                      const char *mountpoint,
+                                      const char *fstype,
+                                      const char *mntopts)
 {
    int len;
    mntent_cache_entry_t *mce;
@@ -395,6 +398,13 @@ mntent_cache_entry_t *find_mntent_mapping(uint32_t dev)
    mntent_cache_entry_t *mce = NULL;
    time_t now;
 
+   /**
+    * Shortcut when we get a request for the same device again.
+    */
+   if (previous_cache_hit && previous_cache_hit->dev == dev) {
+      return previous_cache_hit;
+   }
+
    /**
     * Initialize the cache if that was not done before.
     */
@@ -414,13 +424,6 @@ mntent_cache_entry_t *find_mntent_mapping(uint32_t dev)
       }
    }
 
-   /**
-    * Shortcut when we get a request for the same device again.
-    */
-   if (previous_cache_hit && previous_cache_hit->dev == dev) {
-      return previous_cache_hit;
-   }
-
    /**
     * Lock the cache while we walk it.
     */