fscache: Introduce fscache_cookie_is_dropped()
Bugzilla: http://bugzilla.redhat.com/1229736 commit 5c4588aea6675b69e328d468c5b6be5127e19a79 Author: Yue Hu <zbestahu@gmail.com> Date: Wed May 25 10:51:50 2022 +0800 fscache: Introduce fscache_cookie_is_dropped() FSCACHE_COOKIE_STATE_DROPPED will be read more than once, so let's add a helper to avoid code duplication. Signed-off-by: Yue Hu <huyue2@coolpad.com> Signed-off-by: David Howells <dhowells@redhat.com> Link: https://listman.redhat.com/archives/linux-cachefs/2022-May/006919.html Signed-off-by: Jeffrey Layton <jlayton@redhat.com>
This commit is contained in:
parent
4e5007697b
commit
a977c5f4b1
|
@ -372,17 +372,22 @@ nomem:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline bool fscache_cookie_is_dropped(struct fscache_cookie *cookie)
|
||||
{
|
||||
return READ_ONCE(cookie->state) == FSCACHE_COOKIE_STATE_DROPPED;
|
||||
}
|
||||
|
||||
static void fscache_wait_on_collision(struct fscache_cookie *candidate,
|
||||
struct fscache_cookie *wait_for)
|
||||
{
|
||||
enum fscache_cookie_state *statep = &wait_for->state;
|
||||
|
||||
wait_var_event_timeout(statep, READ_ONCE(*statep) == FSCACHE_COOKIE_STATE_DROPPED,
|
||||
wait_var_event_timeout(statep, fscache_cookie_is_dropped(wait_for),
|
||||
20 * HZ);
|
||||
if (READ_ONCE(*statep) != FSCACHE_COOKIE_STATE_DROPPED) {
|
||||
if (!fscache_cookie_is_dropped(wait_for)) {
|
||||
pr_notice("Potential collision c=%08x old: c=%08x",
|
||||
candidate->debug_id, wait_for->debug_id);
|
||||
wait_var_event(statep, READ_ONCE(*statep) == FSCACHE_COOKIE_STATE_DROPPED);
|
||||
wait_var_event(statep, fscache_cookie_is_dropped(wait_for));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue