async: Add some documentation.
PATCH 2/2 async: Add some documentation.
Add some kerneldoc to the async interface.
--- kernel/async.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
kernel/async.c +47 -0
@@ -205,18 +205,43 @@ static async_cookie_t __async_schedule(areturn newcookie; } +/** +* async_schedule - schedule a function for asynchronous execution +* @ptr: function to execute asynchronously +* @data: data pointer to pass to the function +* +* Returns an async_cookie_t that may be used for checkpointing later. +* Note: This function may be called from atomic or non-atomic contexts. +*/ async_cookie_t async_schedule (async_func_ptr *ptr,void *data) {return __async_schedule (ptr, data, &async_pending); }EXPORT_SYMBOL_GPL (async_schedule); +/** +* async_schedule_special - schedule a function for asynchronous execution with a special running queue +* @ptr: function to execute asynchronously +* @data: data pointer to pass to the function +* @running: list head to add to while running +* +* Returns an async_cookie_t that may be used for checkpointing later. +* @running may be used in the async_synchronize_*_special() functions +* to wait on a special running queue rather than on the global running +* queue. +* Note: This function may be called from atomic or non-atomic contexts. +*/ async_cookie_t async_schedule_special (async_func_ptr *ptr,void *data,struct list_head *running) {return __async_schedule (ptr, data, running); }EXPORT_SYMBOL_GPL (async_schedule_special); +/** +* async_synchronize_full - synchronize all asynchronous function calls +* +* This function waits until all asynchronous function calls have been done. +*/ void async_synchronize_full (void ) { do {
@@ -225,12 +250,27 @@ void async_synchronize_full(void) }EXPORT_SYMBOL_GPL (async_synchronize_full); +/** +* async_synchronize_full_special - synchronize all asynchronous function calls for a running list +* @list: running list to synchronize on +* +* This function waits until all asynchronous function calls for the running +* list @list have been done. +*/ void async_synchronize_full_special (struct list_head *list) {async_synchronize_cookie_special (next_cookie, list); }EXPORT_SYMBOL_GPL (async_synchronize_full_special); +/** +* async_synchronize_cookie_special - synchronize asynchronous function calls on a running list with cookie checkpointing +* @cookie: async_cookie_t to use as checkpoint +* @running: running list to synchronize on +* +* This function waits until all asynchronous function calls for the running +* list @list submitted prior to @cookie have been done. +*/ void async_synchronize_cookie_special (async_cookie_t cookie,struct list_head *running) {ktime_t starttime, delta, endtime;
@@ -252,6 +292,13 @@ void async_synchronize_cookie_special(as }EXPORT_SYMBOL_GPL (async_synchronize_cookie_special); +/** +* async_synchronize_cookie - synchronize asynchronous function calls with cookie checkpointing +* @cookie: async_cookie_t to use as checkpoint +* +* This function waits until all asynchronous function calls prior to @cookie +* have been done. +*/ void async_synchronize_cookie (async_cookie_t cookie) {async_synchronize_cookie_special (cookie, &async_running);
Quoted 16 lines · Cornelia Huck
Add some kerneldoc to the async interface.
Signed-off-by Cornelia Huck <[email protected]>+/**
+ *async_schedule_special- schedule a function for asynchronous execution with a special running queue
+ * @ptr: function to execute asynchronously
+ * @data: data pointer to pass to the function
+ * @running: list head to add to while running
+ *
+ * Returns anasync_cookie_tthat may be used for checkpointing later.
+ * @running may be used in the async_synchronize_*_special() functions
+ * to wait on a special running queue rather than on the global running
+ * queue.
+ * Note: This function may be called from atomic or non-atomic contexts.
+ */
async_cookie_tasync_schedule_special(async_func_ptr *ptr, void *data, struct list_head *running)
Rather than polishing a turd, can we rename this "special" stuff to something more descriptive? I'm not the only person to complain about this. How about async_schedule_list()?
After all, async_schedule_list() describes *exactly* how it is different to async_schedule(), while the "_special" keywords really suck when you consider code is supposed to be self documenting....
Quoted 4 lines
+/**
+ *async_synchronize_cookie_special- synchronize asynchronous function calls on a running list with cookie checkpointing
+ * @cookie:async_cookie_tto use as checkpoint
+ * @running: running list to synchronize on
And I think that description proves my point about the real meaning of "special" in this API.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 18 lines · Dave Chinner
Quoted 16 lines · Cornelia Huck
Add some kerneldoc to the async interface.
Signed-off-by Cornelia Huck <[email protected]>+/**
+ *async_schedule_special- schedule a function for asynchronous execution with a special running queue
+ * @ptr: function to execute asynchronously
+ * @data: data pointer to pass to the function
+ * @running: list head to add to while running
+ *
+ * Returns anasync_cookie_tthat may be used for checkpointing later.
+ * @running may be used in the async_synchronize_*_special() functions
+ * to wait on a special running queue rather than on the global running
+ * queue.
+ * Note: This function may be called from atomic or non-atomic contexts.
+ */
async_cookie_tasync_schedule_special(async_func_ptr *ptr, void *data, struct list_head *running)
Quoted 7 lines
Rather than polishing a turd, can we rename this "special" stuff to something more descriptive? I'm not the only person to complain about this. How about
async_schedule_list()?After all,
async_schedule_list()describes *exactly* how it is different toasync_schedule(), while the "_special" keywords really suck when you consider code is supposed to be self documenting....
async_schedule_list() sounds better, agreed, but I'd prefer to change that in a seperate patch.
Quoted 10 lines · On Wed, 14 Jan 2009 11:24:50 +0100 Cornelia Huck <[email protected]>…
Quoted 7 lines
Rather than polishing a turd, can we rename this "special" stuff to something more descriptive? I'm not the only person to complain about this. How about
async_schedule_list()?After all,
async_schedule_list()describes *exactly* how it is different toasync_schedule(), while the "_special" keywords really suck when you consider code is supposed to be self documenting....
async_schedule_list()sounds better, agreed, but I'd prefer to change that in a seperate patch.
I had it as that at first. But it is ugly; naming a function after its arguments is useless; it should be named after what it does instead.
I buy that "special" is not a good name. Would "local" be better? The name needs to convey that it is for a specific synchronization context....
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 14 lines · Arjan van de Ven
Quoted 10 lines · On Wed, 14 Jan 2009 11:24:50 +0100 Cornelia Huck <[email protected]>…
Quoted 7 lines
Rather than polishing a turd, can we rename this "special" stuff to something more descriptive? I'm not the only person to complain about this. How about
async_schedule_list()?After all,
async_schedule_list()describes *exactly* how it is different toasync_schedule(), while the "_special" keywords really suck when you consider code is supposed to be self documenting....
async_schedule_list()sounds better, agreed, but I'd prefer to change that in a seperate patch.
Quoted 6 lines
I had it as that at first. But it is ugly; naming a function after its arguments is useless; it should be named after what it does instead.
I buy that "special" is not a good name. Would "local" be better? The name needs to convey that it is for a specific synchronization context....
Yeah, local is sounds ok - it's certainly more obvious that it's a scope modifier for the synchronisation primitive.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 18 lines · Dave Chinner
Quoted 17 lines · Arjan van de Ven
Quoted 10 lines · On Wed, 14 Jan 2009 11:24:50 +0100 Cornelia Huck <[email protected]>…
Quoted 7 lines
Rather than polishing a turd, can we rename this "special" stuff to something more descriptive? I'm not the only person to complain about this. How about
async_schedule_list()?After all,
async_schedule_list()describes *exactly* how it is different toasync_schedule(), while the "_special" keywords really suck when you consider code is supposed to be self documenting....
async_schedule_list()sounds better, agreed, but I'd prefer to change that in a seperate patch.I had it as that at first. But it is ugly; naming a function after its arguments is useless; it should be named after what it does instead.
Quoted 6 lines
Quoted 3 lines
I buy that "special" is not a good name. Would "local" be better? The name needs to convey that it is for a specific synchronization context....
Yeah, local is sounds ok - it's certainly more obvious that it's a scope modifier for the synchronisation primitive.
Hm, I don't like _local too much. How about _subset, or _context, or _scope?
Quoted 9 lines · On Mon, 19 Jan 2009 13:27:44 +0100 Cornelia Huck <[email protected]>…
Quoted 9 lines
Quoted 8 lines
I had it as that at first. But it is ugly; naming a function after its arguments is useless; it should be named after what it does instead.
I buy that "special" is not a good name. Would "local" be better? The name needs to convey that it is for a specific synchronization context....
Quoted 5 lines
Quoted 2 lines
Yeah, local is sounds ok - it's certainly more obvious that it's a scope modifier for the synchronisation primitive.
Hm, I don't like
_localtoo much. How about_subset, or_context, or_scope?
or _domain ?
and phrase stuff such that you have synchronization domains?
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org
Quoted 15 lines · Arjan van de Ven
Quoted 12 lines · On Mon, 19 Jan 2009 13:27:44 +0100 Cornelia Huck <[email protected]>…
Quoted 11 lines
Quoted 8 lines
I had it as that at first. But it is ugly; naming a function after its arguments is useless; it should be named after what it does instead.
I buy that "special" is not a good name. Would "local" be better? The name needs to convey that it is for a specific synchronization context....
Yeah, local is sounds ok - it's certainly more obvious that it's a scope modifier for the synchronisation primitive.
Quoted 6 lines
Quoted 2 lines
Hm, I don't like
_localtoo much. How about_subset, or_context, or_scope?or
_domain?and phrase stuff such that you have synchronization domains?
I like that one best so far.
PATCH 1/1 async: Rename _special -> _domain for clarity.
In reply to Arjan van de VenRename the async_*_special() functions to async_*_domain(), which describes the purpose of these functions much better. [Broke up long lines to silence checkpatch]
--- fs/super.c | 4 ++-- include/linux/async.h | 8 +++++--- kernel/async.c | 41 ++++++++++++++++++++++------------------- 3 files changed, 29 insertions(+), 24 deletions(-)
include/linux/async.h +5 -3
@@ -17,9 +17,11 @@ typedef u64 async_cookie_t;typedef void (async_func_ptr ) (void *data,async_cookie_t cookie);extern async_cookie_t async_schedule (async_func_ptr *ptr,void *data); -extern async_cookie_t async_schedule_special (async_func_ptr *ptr,void *data,struct list_head *list); +extern async_cookie_t async_schedule_domain (async_func_ptr *ptr,void *data, +struct list_head *list);extern void async_synchronize_full (void ); -extern void async_synchronize_full_special (struct list_head *list); +extern void async_synchronize_full_domain (struct list_head *list);extern void async_synchronize_cookie (async_cookie_t cookie); -extern void async_synchronize_cookie_special (async_cookie_t cookie,struct list_head *list); +extern void async_synchronize_cookie_domain (async_cookie_t cookie, +struct list_head *list);
kernel/async.c +22 -19
85 lines not on this page · raw message
fs/super.c +2 -2
@@ -301,7 +301,7 @@ void generic_shutdown_super(struct super/* * wait for asynchronous fs operations to finish before going further */ -async_synchronize_full_special (&sb->s_async_list); +async_synchronize_full_domain (&sb->s_async_list);/* bad name - it should be evict_inodes() */ invalidate_inodes (sb);
@@ -470,7 +470,7 @@ restart: sb->s_count++;spin_unlock (&sb_lock);down_read (&sb->s_umount); -async_synchronize_full_special (&sb->s_async_list); +async_synchronize_full_domain (&sb->s_async_list);if (sb->s_root && (wait || sb->s_dirt)) sb->s_op->sync_fs (sb, wait);up_read (&sb->s_umount);
On Tue, 13 Jan 2009 17:43:06 +0100
Cornelia Huck <[email protected]> wrote:
Thanks for providing this documentation!
I'll send this to Linus/Andrew with the next batch
Signature · 3 lines
Arjan van de Ven Intel Open Source Technology Centre For development, discussion and tips for power savings, visit http://www.lesswatts.org