diff options
author | Jan Kara <jack@suse.cz> | 2010-10-20 17:24:12 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2011-01-06 11:03:56 -0500 |
commit | d1668fe390c1e84580575965684a8fa7e4626dee (patch) | |
tree | 36e1b6720a0f8f4910339a9ba188c49bfa4c191c /fs/udf/super.c | |
parent | 7abc2e45e48ca04206949682402d5d55bc64a16b (diff) |
udf: Remove BKL from free space counting functions
udf_count_free_bitmap() does not need BKL because bitmaps are in a fixed
place on disk and so we can count set bits without serialization.
udf_count_free_table() is now protected by s_alloc_mutex instead of BKL
to get a consistent view of free space extents.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r-- | fs/udf/super.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index 4cf6121ab41a..d2ec9f31e843 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -2207,8 +2207,6 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb, | |||
2207 | uint16_t ident; | 2207 | uint16_t ident; |
2208 | struct spaceBitmapDesc *bm; | 2208 | struct spaceBitmapDesc *bm; |
2209 | 2209 | ||
2210 | lock_kernel(); | ||
2211 | |||
2212 | loc.logicalBlockNum = bitmap->s_extPosition; | 2210 | loc.logicalBlockNum = bitmap->s_extPosition; |
2213 | loc.partitionReferenceNum = UDF_SB(sb)->s_partition; | 2211 | loc.partitionReferenceNum = UDF_SB(sb)->s_partition; |
2214 | bh = udf_read_ptagged(sb, &loc, 0, &ident); | 2212 | bh = udf_read_ptagged(sb, &loc, 0, &ident); |
@@ -2245,10 +2243,7 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb, | |||
2245 | } | 2243 | } |
2246 | } | 2244 | } |
2247 | brelse(bh); | 2245 | brelse(bh); |
2248 | |||
2249 | out: | 2246 | out: |
2250 | unlock_kernel(); | ||
2251 | |||
2252 | return accum; | 2247 | return accum; |
2253 | } | 2248 | } |
2254 | 2249 | ||
@@ -2261,8 +2256,7 @@ static unsigned int udf_count_free_table(struct super_block *sb, | |||
2261 | int8_t etype; | 2256 | int8_t etype; |
2262 | struct extent_position epos; | 2257 | struct extent_position epos; |
2263 | 2258 | ||
2264 | lock_kernel(); | 2259 | mutex_lock(&UDF_SB(sb)->s_alloc_mutex); |
2265 | |||
2266 | epos.block = UDF_I(table)->i_location; | 2260 | epos.block = UDF_I(table)->i_location; |
2267 | epos.offset = sizeof(struct unallocSpaceEntry); | 2261 | epos.offset = sizeof(struct unallocSpaceEntry); |
2268 | epos.bh = NULL; | 2262 | epos.bh = NULL; |
@@ -2271,8 +2265,7 @@ static unsigned int udf_count_free_table(struct super_block *sb, | |||
2271 | accum += (elen >> table->i_sb->s_blocksize_bits); | 2265 | accum += (elen >> table->i_sb->s_blocksize_bits); |
2272 | 2266 | ||
2273 | brelse(epos.bh); | 2267 | brelse(epos.bh); |
2274 | 2268 | mutex_unlock(&UDF_SB(sb)->s_alloc_mutex); | |
2275 | unlock_kernel(); | ||
2276 | 2269 | ||
2277 | return accum; | 2270 | return accum; |
2278 | } | 2271 | } |