cookie.c (f1615bbe9be4def59c3b3eaddb60722efeed16c2) | cookie.c (743162013d40ca612b4cb53d3a200dff2d9ab26e) |
---|---|
1/* netfs cookie management 2 * 3 * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved. 4 * Written by David Howells (dhowells@redhat.com) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 146 unchanged lines hidden (view full) --- 155 */ 156void __fscache_enable_cookie(struct fscache_cookie *cookie, 157 bool (*can_enable)(void *data), 158 void *data) 159{ 160 _enter("%p", cookie); 161 162 wait_on_bit_lock(&cookie->flags, FSCACHE_COOKIE_ENABLEMENT_LOCK, | 1/* netfs cookie management 2 * 3 * Copyright (C) 2004-2007 Red Hat, Inc. All Rights Reserved. 4 * Written by David Howells (dhowells@redhat.com) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 146 unchanged lines hidden (view full) --- 155 */ 156void __fscache_enable_cookie(struct fscache_cookie *cookie, 157 bool (*can_enable)(void *data), 158 void *data) 159{ 160 _enter("%p", cookie); 161 162 wait_on_bit_lock(&cookie->flags, FSCACHE_COOKIE_ENABLEMENT_LOCK, |
163 fscache_wait_bit, TASK_UNINTERRUPTIBLE); | 163 TASK_UNINTERRUPTIBLE); |
164 165 if (test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags)) 166 goto out_unlock; 167 168 if (can_enable && !can_enable(data)) { 169 /* The netfs decided it didn't want to enable after all */ 170 } else if (cookie->def->type != FSCACHE_COOKIE_TYPE_INDEX) { 171 /* Wait for outstanding disablement to complete */ --- 78 unchanged lines hidden (view full) --- 250 fscache_raise_event(object, FSCACHE_OBJECT_EV_NEW_CHILD); 251 252 spin_unlock(&cookie->lock); 253 254 /* we may be required to wait for lookup to complete at this point */ 255 if (!fscache_defer_lookup) { 256 _debug("non-deferred lookup %p", &cookie->flags); 257 wait_on_bit(&cookie->flags, FSCACHE_COOKIE_LOOKING_UP, | 164 165 if (test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags)) 166 goto out_unlock; 167 168 if (can_enable && !can_enable(data)) { 169 /* The netfs decided it didn't want to enable after all */ 170 } else if (cookie->def->type != FSCACHE_COOKIE_TYPE_INDEX) { 171 /* Wait for outstanding disablement to complete */ --- 78 unchanged lines hidden (view full) --- 250 fscache_raise_event(object, FSCACHE_OBJECT_EV_NEW_CHILD); 251 252 spin_unlock(&cookie->lock); 253 254 /* we may be required to wait for lookup to complete at this point */ 255 if (!fscache_defer_lookup) { 256 _debug("non-deferred lookup %p", &cookie->flags); 257 wait_on_bit(&cookie->flags, FSCACHE_COOKIE_LOOKING_UP, |
258 fscache_wait_bit, TASK_UNINTERRUPTIBLE); | 258 TASK_UNINTERRUPTIBLE); |
259 _debug("complete"); 260 if (test_bit(FSCACHE_COOKIE_UNAVAILABLE, &cookie->flags)) 261 goto unavailable; 262 } 263 264 up_read(&fscache_addremove_sem); 265 _leave(" = 0 [deferred]"); 266 return 0; --- 191 unchanged lines hidden (view full) --- 458/* 459 * Wait for object invalidation to complete. 460 */ 461void __fscache_wait_on_invalidate(struct fscache_cookie *cookie) 462{ 463 _enter("%p", cookie); 464 465 wait_on_bit(&cookie->flags, FSCACHE_COOKIE_INVALIDATING, | 259 _debug("complete"); 260 if (test_bit(FSCACHE_COOKIE_UNAVAILABLE, &cookie->flags)) 261 goto unavailable; 262 } 263 264 up_read(&fscache_addremove_sem); 265 _leave(" = 0 [deferred]"); 266 return 0; --- 191 unchanged lines hidden (view full) --- 458/* 459 * Wait for object invalidation to complete. 460 */ 461void __fscache_wait_on_invalidate(struct fscache_cookie *cookie) 462{ 463 _enter("%p", cookie); 464 465 wait_on_bit(&cookie->flags, FSCACHE_COOKIE_INVALIDATING, |
466 fscache_wait_bit_interruptible, | |
467 TASK_UNINTERRUPTIBLE); 468 469 _leave(""); 470} 471EXPORT_SYMBOL(__fscache_wait_on_invalidate); 472 473/* 474 * update the index entries backing a cookie --- 45 unchanged lines hidden (view full) --- 520 521 if (atomic_read(&cookie->n_children) != 0) { 522 pr_err("Cookie '%s' still has children\n", 523 cookie->def->name); 524 BUG(); 525 } 526 527 wait_on_bit_lock(&cookie->flags, FSCACHE_COOKIE_ENABLEMENT_LOCK, | 466 TASK_UNINTERRUPTIBLE); 467 468 _leave(""); 469} 470EXPORT_SYMBOL(__fscache_wait_on_invalidate); 471 472/* 473 * update the index entries backing a cookie --- 45 unchanged lines hidden (view full) --- 519 520 if (atomic_read(&cookie->n_children) != 0) { 521 pr_err("Cookie '%s' still has children\n", 522 cookie->def->name); 523 BUG(); 524 } 525 526 wait_on_bit_lock(&cookie->flags, FSCACHE_COOKIE_ENABLEMENT_LOCK, |
528 fscache_wait_bit, TASK_UNINTERRUPTIBLE); | 527 TASK_UNINTERRUPTIBLE); |
529 if (!test_and_clear_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags)) 530 goto out_unlock_enable; 531 532 /* If the cookie is being invalidated, wait for that to complete first 533 * so that we can reuse the flag. 534 */ 535 __fscache_wait_on_invalidate(cookie); 536 --- 187 unchanged lines hidden --- | 528 if (!test_and_clear_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags)) 529 goto out_unlock_enable; 530 531 /* If the cookie is being invalidated, wait for that to complete first 532 * so that we can reuse the flag. 533 */ 534 __fscache_wait_on_invalidate(cookie); 535 --- 187 unchanged lines hidden --- |