1 ext4: Add sparse annotations for the group info semaphore
3 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
5 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
6 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
8 fs/ext4/mballoc.c | 24 ++++++++++++++++++++----
9 1 files changed, 20 insertions(+), 4 deletions(-)
11 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
12 index 9211397..f4753bd 100644
13 --- a/fs/ext4/mballoc.c
14 +++ b/fs/ext4/mballoc.c
15 @@ -895,6 +895,7 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
16 static noinline_for_stack int
17 ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
18 struct ext4_buddy *e4b)
19 +__acquires(e4b->alloc_semp)
23 @@ -926,6 +927,7 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
24 * till we are done with allocation
26 down_read(e4b->alloc_semp);
27 + __acquire(e4b->alloc_semp);
30 * the buddy cache inode stores the block bitmap
31 @@ -1020,6 +1022,7 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
34 static void ext4_mb_release_desc(struct ext4_buddy *e4b)
35 +__releases(e4b->alloc_semp)
37 if (e4b->bd_bitmap_page)
38 page_cache_release(e4b->bd_bitmap_page);
39 @@ -1027,6 +1030,7 @@ static void ext4_mb_release_desc(struct ext4_buddy *e4b)
40 page_cache_release(e4b->bd_buddy_page);
41 /* Done with the buddy cache */
42 up_read(e4b->alloc_semp);
43 + __release(e4b->alloc_semp);
47 @@ -1468,8 +1472,10 @@ static int ext4_mb_try_best_found(struct ext4_allocation_context *ac,
49 BUG_ON(ex.fe_len <= 0);
50 err = ext4_mb_load_buddy(ac->ac_sb, group, e4b);
53 + __release(e4b->alloc_semp);
57 ext4_lock_group(ac->ac_sb, group);
58 max = mb_find_extent(e4b, 0, ex.fe_start, ex.fe_len, &ex);
59 @@ -1499,8 +1505,10 @@ static int ext4_mb_find_by_goal(struct ext4_allocation_context *ac,
62 err = ext4_mb_load_buddy(ac->ac_sb, group, e4b);
65 + __release(e4b->alloc_semp);
69 ext4_lock_group(ac->ac_sb, group);
70 max = mb_find_extent(e4b, 0, ac->ac_g_ex.fe_start,
71 @@ -1959,8 +1967,10 @@ ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
74 err = ext4_mb_load_buddy(sb, group, &e4b);
77 + __release(e4b->alloc_semp);
81 ext4_lock_group(sb, group);
82 if (!ext4_mb_good_group(ac, group, cr)) {
83 @@ -2271,6 +2281,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
84 sizeof(struct ext4_group_info);
85 err = ext4_mb_load_buddy(sb, group, &e4b);
87 + __release(e4b->alloc_semp);
88 seq_printf(seq, "#%-5u: I/O error\n", group);
91 @@ -3816,6 +3827,7 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,
93 err = ext4_mb_load_buddy(sb, group, &e4b);
95 + __release(e4b->alloc_semp);
96 ext4_error(sb, __func__, "Error in loading buddy "
97 "information for %u\n", group);
99 @@ -3983,6 +3995,7 @@ void ext4_discard_preallocations(struct inode *inode)
101 err = ext4_mb_load_buddy(sb, group, &e4b);
103 + __release(e4b->alloc_semp);
104 ext4_error(sb, __func__, "Error in loading buddy "
105 "information for %u\n", group);
107 @@ -4255,6 +4268,7 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb,
109 ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, NULL);
110 if (ext4_mb_load_buddy(sb, group, &e4b)) {
111 + __release(e4b->alloc_semp);
112 ext4_error(sb, __func__, "Error in loading buddy "
113 "information for %u\n", group);
115 @@ -4715,8 +4729,10 @@ void ext4_mb_free_blocks(handle_t *handle, struct inode *inode,
118 err = ext4_mb_load_buddy(sb, block_group, &e4b);
121 + __release(e4b->alloc_semp);
125 /* blocks being freed are metadata. these blocks shouldn't
126 * be used until this transaction is committed */
131 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
132 the body of a message to majordomo@vger.kernel.org
133 More majordomo info at http://vger.kernel.org/majordomo-info.html