[PATCH 1/2] CacheFiles: Slightly simplify 'cachefiles_has_space()'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The "CACHEFILES_CULLING" bit is tested twice. Once with 'test_bit()' and
once with 'test_and_clear_bit()'.
Remove the first test.

While at it, bring back a ')' at the end of a line to be more compliant
with Linux coding style.

Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
If testing the bit first was a kind of optimization, a few words shoul
explained it.
---
 fs/cachefiles/daemon.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c
index 752c1e43416f..be8f2ec453b6 100644
--- a/fs/cachefiles/daemon.c
+++ b/fs/cachefiles/daemon.c
@@ -725,11 +725,9 @@ int cachefiles_has_space(struct cachefiles_cache *cache,
 	    stats.f_bavail < cache->bcull)
 		goto begin_cull;
 
-	if (test_bit(CACHEFILES_CULLING, &cache->flags) &&
-	    stats.f_ffree >= cache->frun &&
+	if (stats.f_ffree >= cache->frun &&
 	    stats.f_bavail >= cache->brun &&
-	    test_and_clear_bit(CACHEFILES_CULLING, &cache->flags)
-	    ) {
+	    test_and_clear_bit(CACHEFILES_CULLING, &cache->flags)) {
 		_debug("cease culling");
 		cachefiles_state_changed(cache);
 	}
-- 
2.30.2




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux