| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* FS-Cache object state machine handler |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
|---|
| 4 | 5 | * Written by David Howells (dhowells@redhat.com) |
|---|
| 5 | 6 | * |
|---|
| 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 |
|---|
| 9 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * See Documentation/filesystems/caching/object.txt for a description of the |
|---|
| 7 | + * See Documentation/filesystems/caching/object.rst for a description of the |
|---|
| 12 | 8 | * object state machine and the in-kernel representations. |
|---|
| 13 | 9 | */ |
|---|
| 14 | 10 | |
|---|
| .. | .. |
|---|
| 299 | 295 | * |
|---|
| 300 | 296 | * Initialise a cache object description to its basic values. |
|---|
| 301 | 297 | * |
|---|
| 302 | | - * See Documentation/filesystems/caching/backend-api.txt for a complete |
|---|
| 298 | + * See Documentation/filesystems/caching/backend-api.rst for a complete |
|---|
| 303 | 299 | * description. |
|---|
| 304 | 300 | */ |
|---|
| 305 | 301 | void fscache_object_init(struct fscache_object *object, |
|---|
| .. | .. |
|---|
| 811 | 807 | } |
|---|
| 812 | 808 | EXPORT_SYMBOL(fscache_object_destroy); |
|---|
| 813 | 809 | |
|---|
| 810 | +static DECLARE_WAIT_QUEUE_HEAD(fscache_object_cong_wait); |
|---|
| 811 | + |
|---|
| 814 | 812 | /* |
|---|
| 815 | 813 | * enqueue an object for metadata-type processing |
|---|
| 816 | 814 | */ |
|---|
| .. | .. |
|---|
| 819 | 817 | _enter("{OBJ%x}", object->debug_id); |
|---|
| 820 | 818 | |
|---|
| 821 | 819 | if (fscache_get_object(object, fscache_obj_get_queue) >= 0) { |
|---|
| 822 | | - wait_queue_head_t *cong_wq = |
|---|
| 823 | | - &get_cpu_var(fscache_object_cong_wait); |
|---|
| 824 | 820 | |
|---|
| 825 | 821 | if (queue_work(fscache_object_wq, &object->work)) { |
|---|
| 826 | 822 | if (fscache_object_congested()) |
|---|
| 827 | | - wake_up(cong_wq); |
|---|
| 823 | + wake_up(&fscache_object_cong_wait); |
|---|
| 828 | 824 | } else |
|---|
| 829 | 825 | fscache_put_object(object, fscache_obj_put_queue); |
|---|
| 830 | | - |
|---|
| 831 | | - put_cpu_var(fscache_object_cong_wait); |
|---|
| 832 | 826 | } |
|---|
| 833 | 827 | } |
|---|
| 834 | 828 | |
|---|
| .. | .. |
|---|
| 846 | 840 | */ |
|---|
| 847 | 841 | bool fscache_object_sleep_till_congested(signed long *timeoutp) |
|---|
| 848 | 842 | { |
|---|
| 849 | | - wait_queue_head_t *cong_wq = this_cpu_ptr(&fscache_object_cong_wait); |
|---|
| 850 | 843 | DEFINE_WAIT(wait); |
|---|
| 851 | 844 | |
|---|
| 852 | 845 | if (fscache_object_congested()) |
|---|
| 853 | 846 | return true; |
|---|
| 854 | 847 | |
|---|
| 855 | | - add_wait_queue_exclusive(cong_wq, &wait); |
|---|
| 848 | + add_wait_queue_exclusive(&fscache_object_cong_wait, &wait); |
|---|
| 856 | 849 | if (!fscache_object_congested()) |
|---|
| 857 | 850 | *timeoutp = schedule_timeout(*timeoutp); |
|---|
| 858 | | - finish_wait(cong_wq, &wait); |
|---|
| 851 | + finish_wait(&fscache_object_cong_wait, &wait); |
|---|
| 859 | 852 | |
|---|
| 860 | 853 | return fscache_object_congested(); |
|---|
| 861 | 854 | } |
|---|