From patchwork Tue Sep 30 22:01:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 5008461 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CA06F9F327 for ; Tue, 30 Sep 2014 22:01:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E150620131 for ; Tue, 30 Sep 2014 22:01:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0817820127 for ; Tue, 30 Sep 2014 22:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752472AbaI3WBJ (ORCPT ); Tue, 30 Sep 2014 18:01:09 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:36524 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755260AbaI3WAu (ORCPT ); Tue, 30 Sep 2014 18:00:50 -0400 Received: by mail-pa0-f43.google.com with SMTP id hz1so7122639pad.16 for ; Tue, 30 Sep 2014 15:00:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=4JzoPDCaIn9/ItjXCuA9QOCAEd9nHQm/tqyJmBnkanw=; b=JtHzWR+wrep8EJACz3YXUWVg6MWyIUPcp9EfKMf1xra3QsU3+gdREn88CuNmg7pjCN T9BDpwEma4wPcsskYOplwimi7LoaWuTGoSy2Wn/ogPFbGLBCcMJG95pcgjiLpx4fVTX+ /Om02X1QdKovd0S3VIoOJ6smvifvvpgMZyo+mDQJM/+cDS2qc/tuzudk7e++DYltsf0r 56Yptkb1uUYCm8FSV6Ap2Pqe9rdDgbShbZXcxpKWfMr0aU1tAHplV2yku736XLKqp0c5 aFrCZwQOhCB7X4G3KVfTcG347mg3CAw4BmyeEeZM1AnF9fGMfMF+GiEiH/3/gbYTKB9+ apQQ== X-Gm-Message-State: ALoCoQnfn9bIJ6Rez8PfOEikYF/L1pcYa92AABBN9pIh1AsBhQjmO35A4jr1auo70WjvEq9QltM/ X-Received: by 10.68.95.129 with SMTP id dk1mr73200609pbb.25.1412114449453; Tue, 30 Sep 2014 15:00:49 -0700 (PDT) Received: from molino.home.network (c-24-19-133-29.hsd1.wa.comcast.net. [24.19.133.29]) by mx.google.com with ESMTPSA id nz4sm16076560pdb.51.2014.09.30.15.00.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 30 Sep 2014 15:00:48 -0700 (PDT) From: Omar Sandoval To: Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: David Sterba , Zach Brown Subject: [PATCH v2 3/3] btrfs: fix sparse lock context warnings Date: Tue, 30 Sep 2014 15:01:42 -0700 Message-Id: <0f2aec95ffee1c6b7b7b65366d4aba98c4df1d09.1412114127.git.osandov@osandov.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix several sparse warnings that can easily be addressed with context annotations. These annotations also provide some sort of documentation for the internal helper functions. Signed-off-by: Omar Sandoval Reviewed-by: David Sterba --- fs/btrfs/extent-tree.c | 1 + fs/btrfs/extent_io.c | 2 +- fs/btrfs/free-space-cache.c | 1 + fs/btrfs/locking.c | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3efe1c3..281f30f 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -6387,6 +6387,7 @@ static struct btrfs_block_group_cache * btrfs_lock_cluster(struct btrfs_block_group_cache *block_group, struct btrfs_free_cluster *cluster, int delalloc) +__acquires(&cluster->refill_lock) { struct btrfs_block_group_cache *used_bg; bool locked = false; diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index af0359d..cc6b1fc 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -4775,8 +4775,8 @@ static inline void btrfs_release_extent_buffer_rcu(struct rcu_head *head) __free_extent_buffer(eb); } -/* Expects to have eb->eb_lock already held */ static int release_extent_buffer(struct extent_buffer *eb) +__releases(&eb->refs_lock) { WARN_ON(atomic_read(&eb->refs) == 0); if (atomic_dec_and_test(&eb->refs)) { diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 2b0a627..41c6cd5 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -1838,6 +1838,7 @@ static struct btrfs_free_space_op free_space_op = { static int insert_into_bitmap(struct btrfs_free_space_ctl *ctl, struct btrfs_free_space *info) +__must_hold(&ctl->tree_lock) { struct btrfs_free_space *bitmap_info; struct btrfs_block_group_cache *block_group = NULL; diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 5665d21..47bdc2c 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c @@ -222,6 +222,7 @@ void btrfs_tree_read_unlock_blocking(struct extent_buffer *eb) * blocking readers or writers */ void btrfs_tree_lock(struct extent_buffer *eb) +__acquires(&eb->lock) { again: wait_event(eb->read_lock_wq, atomic_read(&eb->blocking_readers) == 0);