From patchwork Mon May 2 13:49:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Sterba X-Patchwork-Id: 747242 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p42Dshvd028117 for ; Mon, 2 May 2011 13:56:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759122Ab1EBNuf (ORCPT ); Mon, 2 May 2011 09:50:35 -0400 Received: from cantor.suse.de ([195.135.220.2]:60039 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757730Ab1EBNuf (ORCPT ); Mon, 2 May 2011 09:50:35 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 46E0C90847; Mon, 2 May 2011 15:50:34 +0200 (CEST) Received: by ds.suse.cz (Postfix, from userid 10065) id 6E3C9747DC; Mon, 2 May 2011 15:50:33 +0200 (CEST) From: David Sterba To: linux-btrfs@vger.kernel.org Cc: chris.mason@oracle.com, t-itoh@jp.fujitsu.com, David Sterba Subject: [PATCH] btrfs: Document a mutex lock/unlock sequence Date: Mon, 2 May 2011 15:49:55 +0200 Message-Id: <1304344195-8986-1-git-send-email-dsterba@suse.cz> X-Mailer: git-send-email 1.7.5.rc3 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 02 May 2011 13:56:30 +0000 (UTC) --- fs/btrfs/extent-tree.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a160f11..fba1348 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -756,6 +756,10 @@ again: btrfs_release_path(path); + /* + * Mutex was contended, block until it's released and try + * again + */ mutex_lock(&head->mutex); mutex_unlock(&head->mutex); btrfs_put_delayed_ref(&head->node); @@ -2297,6 +2301,10 @@ again: atomic_inc(&ref->refs); spin_unlock(&delayed_refs->lock); + /* + * Mutex was contended, block until it's + * released and try again + */ mutex_lock(&head->mutex); mutex_unlock(&head->mutex); @@ -2363,6 +2371,10 @@ static noinline int check_delayed_ref(struct btrfs_trans_handle *trans, btrfs_release_path(path); + /* + * Mutex was contended, block until it's released and let + * caller try again + */ mutex_lock(&head->mutex); mutex_unlock(&head->mutex); btrfs_put_delayed_ref(&head->node);