1- ================================
2- ASYNCHRONOUS OPERATIONS HANDLING
3- ================================
1+ .. SPDX-License-Identifier: GPL-2.0
2+
3+ ================================
4+ Asynchronous Operations Handling
5+ ================================
46
57By: David Howells <dhowells@redhat.com>
68
7- Contents:
9+ .. Contents:
810
911 (*) Overview.
1012
@@ -17,8 +19,7 @@ Contents:
1719 (*) Asynchronous callback.
1820
1921
20- ========
21- OVERVIEW
22+ Overview
2223========
2324
2425FS-Cache has an asynchronous operations handling facility that it uses for its
@@ -33,11 +34,10 @@ backend for completion.
3334To make use of this facility, <linux/fscache-cache.h> should be #included.
3435
3536
36- ===============================
37- OPERATION RECORD INITIALISATION
37+ Operation Record Initialisation
3838===============================
3939
40- An operation is recorded in an fscache_operation struct:
40+ An operation is recorded in an fscache_operation struct::
4141
4242 struct fscache_operation {
4343 union {
@@ -50,7 +50,7 @@ An operation is recorded in an fscache_operation struct:
5050 };
5151
5252Someone wanting to issue an operation should allocate something with this
53- struct embedded in it. They should initialise it by calling:
53+ struct embedded in it. They should initialise it by calling::
5454
5555 void fscache_operation_init(struct fscache_operation *op,
5656 fscache_operation_release_t release);
@@ -67,8 +67,7 @@ FSCACHE_OP_WAITING may be set in op->flags prior to each submission of the
6767operation and waited for afterwards.
6868
6969
70- ==========
71- PARAMETERS
70+ Parameters
7271==========
7372
7473There are a number of parameters that can be set in the operation record's flag
@@ -87,7 +86,7 @@ operations:
8786
8887 If this option is to be used, FSCACHE_OP_WAITING must be set in op->flags
8988 before submitting the operation, and the operating thread must wait for it
90- to be cleared before proceeding:
89+ to be cleared before proceeding::
9190
9291 wait_on_bit(&op->flags, FSCACHE_OP_WAITING,
9392 TASK_UNINTERRUPTIBLE);
@@ -101,7 +100,7 @@ operations:
101100 page to a netfs page after the backing fs has read the page in.
102101
103102 If this option is used, op->fast_work and op->processor must be
104- initialised before submitting the operation:
103+ initialised before submitting the operation::
105104
106105 INIT_WORK(&op->fast_work, do_some_work);
107106
@@ -114,7 +113,7 @@ operations:
114113 pages that have just been fetched from a remote server.
115114
116115 If this option is used, op->slow_work and op->processor must be
117- initialised before submitting the operation:
116+ initialised before submitting the operation::
118117
119118 fscache_operation_init_slow(op, processor)
120119
@@ -132,8 +131,7 @@ Furthermore, operations may be one of two types:
132131 operations running at the same time.
133132
134133
135- =========
136- PROCEDURE
134+ Procedure
137135=========
138136
139137Operations are used through the following procedure:
@@ -143,7 +141,7 @@ Operations are used through the following procedure:
143141 generic op embedded within.
144142
145143 (2) The submitting thread must then submit the operation for processing using
146- one of the following two functions:
144+ one of the following two functions::
147145
148146 int fscache_submit_op(struct fscache_object *object,
149147 struct fscache_operation *op);
@@ -164,7 +162,7 @@ Operations are used through the following procedure:
164162 operation of conflicting exclusivity is in progress on the object.
165163
166164 If the operation is asynchronous, the manager will retain a reference to
167- it, so the caller should put their reference to it by passing it to:
165+ it, so the caller should put their reference to it by passing it to::
168166
169167 void fscache_put_operation(struct fscache_operation *op);
170168
@@ -179,26 +177,25 @@ Operations are used through the following procedure:
179177 (4) The operation holds an effective lock upon the object, preventing other
180178 exclusive ops conflicting until it is released. The operation can be
181179 enqueued for further immediate asynchronous processing by adjusting the
182- CPU time provisioning option if necessary, eg:
180+ CPU time provisioning option if necessary, eg::
183181
184182 op->flags &= ~FSCACHE_OP_TYPE;
185183 op->flags |= ~FSCACHE_OP_FAST;
186184
187- and calling:
185+ and calling::
188186
189187 void fscache_enqueue_operation(struct fscache_operation *op)
190188
191189 This can be used to allow other things to have use of the worker thread
192190 pools.
193191
194192
195- =====================
196- ASYNCHRONOUS CALLBACK
193+ Asynchronous Callback
197194=====================
198195
199196When used in asynchronous mode, the worker thread pool will invoke the
200197processor method with a pointer to the operation. This should then get at the
201- container struct by using container_of():
198+ container struct by using container_of()::
202199
203200 static void fscache_write_op(struct fscache_operation *_op)
204201 {
0 commit comments