summaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2010-10-20 23:24:12 +0200
committerJan Kara <jack@suse.cz>2011-01-06 17:03:56 +0100
commitd1668fe390c1e84580575965684a8fa7e4626dee (patch)
tree36e1b6720a0f8f4910339a9ba188c49bfa4c191c /fs/udf
parent7abc2e45e48ca04206949682402d5d55bc64a16b (diff)
downloadlinux-d1668fe390c1e84580575965684a8fa7e4626dee.tar.bz2
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')
-rw-r--r--fs/udf/super.c11
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,
uint16_t ident;
struct spaceBitmapDesc *bm;
- lock_kernel();
-
loc.logicalBlockNum = bitmap->s_extPosition;
loc.partitionReferenceNum = UDF_SB(sb)->s_partition;
bh = udf_read_ptagged(sb, &loc, 0, &ident);
@@ -2245,10 +2243,7 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb,
}
}
brelse(bh);
-
out:
- unlock_kernel();
-
return accum;
}
@@ -2261,8 +2256,7 @@ static unsigned int udf_count_free_table(struct super_block *sb,
int8_t etype;
struct extent_position epos;
- lock_kernel();
-
+ mutex_lock(&UDF_SB(sb)->s_alloc_mutex);
epos.block = UDF_I(table)->i_location;
epos.offset = sizeof(struct unallocSpaceEntry);
epos.bh = NULL;
@@ -2271,8 +2265,7 @@ static unsigned int udf_count_free_table(struct super_block *sb,
accum += (elen >> table->i_sb->s_blocksize_bits);
brelse(epos.bh);
-
- unlock_kernel();
+ mutex_unlock(&UDF_SB(sb)->s_alloc_mutex);
return accum;
}