diff options
author | David Howells <dhowells@redhat.com> | 2015-02-25 13:26:39 +0000 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2015-04-02 14:28:53 +0100 |
commit | 1339ec98e32b4bc8efb6fbb71c006a465130aaba (patch) | |
tree | 78b13a5a55590da6f4fc69b7a39d359255397a34 /fs/fscache | |
parent | 418b7eb9e1011bc11220a03ad0045885d04698d2 (diff) | |
download | linux-1339ec98e32b4bc8efb6fbb71c006a465130aaba.tar.gz linux-1339ec98e32b4bc8efb6fbb71c006a465130aaba.tar.bz2 linux-1339ec98e32b4bc8efb6fbb71c006a465130aaba.zip |
FS-Cache: Out of line fscache_operation_init()
Out of line fscache_operation_init() so that it can access internal FS-Cache
features, such as stats, in a later commit.
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Steve Dickson <steved@redhat.com>
Acked-by: Jeff Layton <jeff.layton@primarydata.com>
Diffstat (limited to 'fs/fscache')
-rw-r--r-- | fs/fscache/operation.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c index 67594a8d791a..61a6e78b85fa 100644 --- a/fs/fscache/operation.c +++ b/fs/fscache/operation.c @@ -21,6 +21,28 @@ atomic_t fscache_op_debug_id; EXPORT_SYMBOL(fscache_op_debug_id); /** + * fscache_operation_init - Do basic initialisation of an operation + * @op: The operation to initialise + * @release: The release function to assign + * + * Do basic initialisation of an operation. The caller must still set flags, + * object and processor if needed. + */ +void fscache_operation_init(struct fscache_operation *op, + fscache_operation_processor_t processor, + fscache_operation_release_t release) +{ + INIT_WORK(&op->work, fscache_op_work_func); + atomic_set(&op->usage, 1); + op->state = FSCACHE_OP_ST_INITIALISED; + op->debug_id = atomic_inc_return(&fscache_op_debug_id); + op->processor = processor; + op->release = release; + INIT_LIST_HEAD(&op->pend_link); +} +EXPORT_SYMBOL(fscache_operation_init); + +/** * fscache_enqueue_operation - Enqueue an operation for processing * @op: The operation to enqueue * |