From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH 15/24] Unionfs: Privileged operations workqueue Date: Mon, 8 Jan 2007 13:27:55 -0800 Message-ID: <20070108132755.41c27142.akpm@osdl.org> References: <1168229596580-git-send-email-jsipek@cs.sunysb.edu> <1168229598972-git-send-email-jsipek@cs.sunysb.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, hch@infradead.org, viro@ftp.linux.org.uk, torvalds@osdl.org, mhalcrow@us.ibm.com, David Quigley , Erez Zadok Return-path: Received: from smtp.osdl.org ([65.172.181.24]:44791 "EHLO smtp.osdl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751037AbXAHV2m (ORCPT ); Mon, 8 Jan 2007 16:28:42 -0500 To: "Josef 'Jeff' Sipek" In-Reply-To: <1168229598972-git-send-email-jsipek@cs.sunysb.edu> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Sun, 7 Jan 2007 23:13:07 -0500 "Josef 'Jeff' Sipek" wrote: > From: Josef "Jeff" Sipek > > Workqueue & helper functions used to perform privileged operations on > behalf of the user process. > > Signed-off-by: Josef "Jeff" Sipek > Signed-off-by: David Quigley > Signed-off-by: Erez Zadok > + > > ... > > +#include "union.h" > + > +/* Super-user IO work Queue - sometimes we need to perform actions which > + * would fail due to the unix permissions on the parent directory (e.g., > + * rmdir a directory which appears empty, but in reality contains > + * whiteouts). > + */ > + > +struct workqueue_struct *sioq; Rather a terse identifier for a global symbol. > +int __init init_sioq(void) > +{ > + int err; > + > + sioq = create_workqueue("unionfs_siod"); > + if (!IS_ERR(sioq)) > + return 0; > + > + err = PTR_ERR(sioq); > + printk(KERN_ERR "create_workqueue failed %d\n", err); > + sioq = NULL; > + return err; > +} > + > +void __exit stop_sioq(void) > +{ > + if (sioq) > + destroy_workqueue(sioq); > +} > + > +void run_sioq(work_func_t func, struct sioq_args *args) > +{ > + INIT_WORK(&args->work, func); > + > + init_completion(&args->comp); > + while (!queue_work(sioq, &args->work)) { > + /* TODO: do accounting if needed */ > + schedule(); > + } That's a busywait. > + wait_for_completion(&args->comp); > +} > + > > ... > > +void __delete_whiteouts(struct work_struct *work) { Misplaced brace.