From patchwork Sun Apr 13 02:25:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jon ernst X-Patchwork-Id: 338724 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D516014008C for ; Sun, 13 Apr 2014 12:32:05 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751105AbaDMCcF (ORCPT ); Sat, 12 Apr 2014 22:32:05 -0400 Received: from mail-qa0-f46.google.com ([209.85.216.46]:55485 "EHLO mail-qa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750876AbaDMCcE (ORCPT ); Sat, 12 Apr 2014 22:32:04 -0400 Received: by mail-qa0-f46.google.com with SMTP id i13so6724286qae.19 for ; Sat, 12 Apr 2014 19:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=rQy9YYFaQaBugK/0QwB+nyXaGyC7xVz2nqi8zcLJiEw=; b=IWFb8YhpfWCDNycaZHNn6lTcVrd0TUr5QbAX8eqEqvntH0LGpK0XvCaWuAG0jCYomx FNjvQgW5CPxQIjyNqHB77MFWqlSiEH3NrozTs7Mu9U72Plg8MR57NW8wVk8L7Qxos4po 8S9+QowsQCO+41G/sQj7n0fdnputyO2X5YRQavqrzWfJfiGInzyp1Fo0To4hQLZNXa8/ 4uNO2ajI9Y86NqyH2E7/SSp5Y6TdntVZIZ6Zl5L8+IuevAeQdNFAizl9MndvwKS0spcL IpWgn+abxOJEGNJ5nb9QwOaxNeEJjzPwvQq9NOrgoYboWowagaQAmvN41UYuTM65I3vI Fy+A== MIME-Version: 1.0 X-Received: by 10.140.92.110 with SMTP id a101mr37961750qge.34.1397355945176; Sat, 12 Apr 2014 19:25:45 -0700 (PDT) Received: by 10.96.93.138 with HTTP; Sat, 12 Apr 2014 19:25:45 -0700 (PDT) Date: Sat, 12 Apr 2014 22:25:45 -0400 Message-ID: Subject: [PATCH] ext4: silence sparse check warning for function ext4_trim_extent. From: jon ernst To: "linux-ext4@vger.kernel.org List" , "Theodore Ts'o" Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org By doing "make M=fs/ext4 C=2" on commit ad6599ab3ac98a4474544086e048ce86ec15a4d1 sparse reports this warning: CHECK fs/ext4/mballoc.c fs/ext4/mballoc.c:5019:9: warning: context imbalance in 'ext4_trim_extent' - unexpected unlock From Documentation/sparse.txt: Using sparse for lock checking ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following macros are undefined for gcc and defined during a sparse run to use the "context" tracking feature of sparse, applied to locking. These annotations tell sparse when a lock is held, with regard to the annotated function's entry and exit. __must_hold - The specified lock is held on function entry and exit. __acquires - The specified lock is held on function exit, but not entry. __releases - The specified lock is held on function entry, but not exit. If the function enters and exits without the lock held, acquiring and releasing the lock inside the function in a balanced way, no annotation is needed. The tree annotations above are for cases where sparse would otherwise report a context imbalance. Signed-off-by: "Jon Ernst" --- fs/ext4/mballoc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 73ccbb3..c8238a2 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -5016,6 +5016,8 @@ error_return: */ static int ext4_trim_extent(struct super_block *sb, int start, int count, ext4_group_t group, struct ext4_buddy *e4b) +__releases(bitlock) +__acquires(bitlock) { struct ext4_free_extent ex; int ret = 0;