From: Marco van Wieringen Date: Fri, 11 Nov 2011 11:55:05 +0000 (+0100) Subject: Move the shortcut logic up so its a real shortcut again. X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7091e7e9f86302b6356c11de029dbe98df5a71c9;p=bacula%2Fbacula Move the shortcut logic up so its a real shortcut again. --- diff --git a/bacula/src/lib/mntent_cache.c b/bacula/src/lib/mntent_cache.c index 2c68bdcefc..6d76239980 100644 --- a/bacula/src/lib/mntent_cache.c +++ b/bacula/src/lib/mntent_cache.c @@ -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. */