From patchwork Sun Sep 28 08:48:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 4991201 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BB85EBEEA6 for ; Sun, 28 Sep 2014 08:48:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF7A3201BC for ; Sun, 28 Sep 2014 08:48:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D230201C7 for ; Sun, 28 Sep 2014 08:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753730AbaI1Irg (ORCPT ); Sun, 28 Sep 2014 04:47:36 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:44232 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753611AbaI1IrU (ORCPT ); Sun, 28 Sep 2014 04:47:20 -0400 Received: by mail-pa0-f45.google.com with SMTP id rd3so6161279pab.32 for ; Sun, 28 Sep 2014 01:47:20 -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:subject:date:message-id:in-reply-to :references; bh=JL/r2h9bRALBnP+0KzjLoRwVBbCSTYjLBLCx4tIce+c=; b=j1HP+B5Iy1teWfoG3sbnerF5mdG8c54xn1xZ7KBwc/9DsIJ9/dfpAecWQ/s7w2LR/3 Ow9gTxK6cqDt3jjqhurjtUGfFUrhGcSoOF47G4eNpuQc7auJ2kKtOvqpZz2sh8AYoS0G yelXpIUYCCANGmVtVOqOPww2T4j9wZcCeEdJO5o2ODHpOIrbVtdMswTBerS3o6Rfwufb 9horVd/EKGRNGkETH3XVJI8ECK+n9/WVmOm/j3czIIz/q9O5njy0CX9vMRfjrBIunsHd UopOhlU+Pa7NWCaNIXyk68DBO14QyKjdYCYXMI4MxHWNHfrmBW328MD+xsBMsgEwLmXf FbbQ== X-Gm-Message-State: ALoCoQkPqnwYViMBgM8/n1btaCQYApPhE5k+xZZw5pD33F4oCUqfI7nXvbKi6KbQFhCUtatEppCO X-Received: by 10.68.171.33 with SMTP id ar1mr2961129pbc.148.1411894040267; Sun, 28 Sep 2014 01:47:20 -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 cf4sm9217882pbb.87.2014.09.28.01.47.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 28 Sep 2014 01:47:19 -0700 (PDT) From: Omar Sandoval To: Chris Mason , Josef Bacik , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] btrfs: fix sparse lock context warnings Date: Sun, 28 Sep 2014 01:48:12 -0700 Message-Id: <1411894092-28784-3-git-send-email-osandov@osandov.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1411894092-28784-1-git-send-email-osandov@osandov.com> References: <1411894092-28784-1-git-send-email-osandov@osandov.com> 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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/ctree.c | 3 ++- fs/btrfs/extent-tree.c | 1 + fs/btrfs/extent_io.c | 2 +- fs/btrfs/free-space-cache.c | 1 + fs/btrfs/locking.c | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 44ee5d2..c1bbc88 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -487,7 +487,8 @@ __tree_mod_log_insert(struct btrfs_fs_info *fs_info, struct tree_mod_elem *tm) * call tree_mod_log_write_unlock() to release. */ static inline int tree_mod_dont_log(struct btrfs_fs_info *fs_info, - struct extent_buffer *eb) { + struct extent_buffer *eb) +{ smp_mb(); if (list_empty(&(fs_info)->tree_mod_seq_list)) return 1; 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);