From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fengguang Wu Subject: Re: [PATCH 7/7] writeback: Avoid iput() from flusher thread Date: Thu, 22 Mar 2012 11:01:06 +0800 Message-ID: <20120322030106.GB20507@localhost> References: <1332284191-21076-1-git-send-email-jack@suse.cz> <1332284191-21076-8-git-send-email-jack@suse.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoph Hellwig , linux-fsdevel@vger.kernel.org To: Jan Kara Return-path: Received: from mga14.intel.com ([143.182.124.37]:61313 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758290Ab2CVDBJ (ORCPT ); Wed, 21 Mar 2012 23:01:09 -0400 Content-Disposition: inline In-Reply-To: <1332284191-21076-8-git-send-email-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: > +/* > + * Sleep until I_SYNC is cleared. This function must be called with i_lock > + * held and drops it. It is aimed for callers not holding any inode reference > + * so once i_lock is dropped, inode can go away. > + */ > +static void inode_sleep_on_writeback(struct inode *inode) > + __releases(inode->i_lock) > +{ > + DEFINE_WAIT(wait); > + wait_queue_head_t *wqh = bit_waitqueue(&inode->i_state, __I_SYNC); > + int sleep; i_state is "unsigned long", it's better to use the same type. > + > + prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); > + sleep = inode->i_state & I_SYNC; > + spin_unlock(&inode->i_lock); > + if (sleep) > + schedule(); > + finish_wait(wqh, &wait); > +} > +