All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: silence sparse check warning for function ext4_trim_extent.
@ 2014-04-13  2:25 jon ernst
  2014-04-13  3:06 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: jon ernst @ 2014-04-13  2:25 UTC (permalink / raw)
  To: linux-ext4@vger.kernel.org List, Theodore Ts'o

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" <jonernst07@gmail.com>
---
 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;
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: silence sparse check warning for function ext4_trim_extent.
  2014-04-13  2:25 [PATCH] ext4: silence sparse check warning for function ext4_trim_extent jon ernst
@ 2014-04-13  3:06 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2014-04-13  3:06 UTC (permalink / raw)
  To: jon ernst; +Cc: linux-ext4@vger.kernel.org List

On Sat, Apr 12, 2014 at 10:25:45PM -0400, jon ernst wrote:
> 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
> 
> Signed-off-by: "Jon Ernst" <jonernst07@gmail.com>

Thanks, applied.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-13  3:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-13  2:25 [PATCH] ext4: silence sparse check warning for function ext4_trim_extent jon ernst
2014-04-13  3:06 ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.