Messages in this thread Patch in this message | | | From | Christophe JAILLET <> | Subject | [PATCH 1/2] CacheFiles: Slightly simplify 'cachefiles_has_space()' | Date | Sat, 20 Nov 2021 19:22:32 +0100 |
| |
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@wanadoo.fr> --- 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
| |