diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-19 22:53:01 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2008-06-20 16:05:54 -0400 |
commit | 8f5934278d1d86590244c2791b28f77d67466007 (patch) | |
tree | 7db64d90ad2b1bd9d0c2e13b3b679a5a7d17f969 /fs/fat/file.c | |
parent | 5ca6a93d802a9d110127556e5d3ed032fd273e03 (diff) |
Replace BKL with superblock lock in fat/msdos/vfat
This replaces the use of the BKL in the FAT family of filesystems with the
existing superblock lock instead.
The code already appears to do mostly proper locking with its own private
spinlocks (and mutexes), but while the BKL could possibly have been
dropped entirely, converting it to use the superblock lock (which is just
a regular mutex) is the conservative thing to do.
As a per-filesystem mutex, it not only won't have any of the possible
latency issues related to the BKL, but the lock is obviously private to
the particular filesystem instance and will thus not cause problems for
entirely unrelated users like the BKL can.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'fs/fat/file.c')
-rw-r--r-- | fs/fat/file.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/fat/file.c b/fs/fat/file.c index 27cc1164ec36..7059928fb351 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -229,7 +229,8 @@ static int fat_free(struct inode *inode, int skip) | |||
229 | 229 | ||
230 | void fat_truncate(struct inode *inode) | 230 | void fat_truncate(struct inode *inode) |
231 | { | 231 | { |
232 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); | 232 | struct super_block *sb = inode->i_sb; |
233 | struct msdos_sb_info *sbi = MSDOS_SB(sb); | ||
233 | const unsigned int cluster_size = sbi->cluster_size; | 234 | const unsigned int cluster_size = sbi->cluster_size; |
234 | int nr_clusters; | 235 | int nr_clusters; |
235 | 236 | ||
@@ -242,9 +243,9 @@ void fat_truncate(struct inode *inode) | |||
242 | 243 | ||
243 | nr_clusters = (inode->i_size + (cluster_size - 1)) >> sbi->cluster_bits; | 244 | nr_clusters = (inode->i_size + (cluster_size - 1)) >> sbi->cluster_bits; |
244 | 245 | ||
245 | lock_kernel(); | 246 | lock_super(sb); |
246 | fat_free(inode, nr_clusters); | 247 | fat_free(inode, nr_clusters); |
247 | unlock_kernel(); | 248 | unlock_super(sb); |
248 | fat_flush_inodes(inode->i_sb, inode, NULL); | 249 | fat_flush_inodes(inode->i_sb, inode, NULL); |
249 | } | 250 | } |
250 | 251 | ||
@@ -297,12 +298,13 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode) | |||
297 | 298 | ||
298 | int fat_setattr(struct dentry *dentry, struct iattr *attr) | 299 | int fat_setattr(struct dentry *dentry, struct iattr *attr) |
299 | { | 300 | { |
301 | struct super_block *sb = dentry->d_sb; | ||
300 | struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); | 302 | struct msdos_sb_info *sbi = MSDOS_SB(dentry->d_sb); |
301 | struct inode *inode = dentry->d_inode; | 303 | struct inode *inode = dentry->d_inode; |
302 | int mask, error = 0; | 304 | int mask, error = 0; |
303 | unsigned int ia_valid; | 305 | unsigned int ia_valid; |
304 | 306 | ||
305 | lock_kernel(); | 307 | lock_super(sb); |
306 | 308 | ||
307 | /* | 309 | /* |
308 | * Expand the file. Since inode_setattr() updates ->i_size | 310 | * Expand the file. Since inode_setattr() updates ->i_size |
@@ -356,7 +358,7 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr) | |||
356 | mask = sbi->options.fs_fmask; | 358 | mask = sbi->options.fs_fmask; |
357 | inode->i_mode &= S_IFMT | (S_IRWXUGO & ~mask); | 359 | inode->i_mode &= S_IFMT | (S_IRWXUGO & ~mask); |
358 | out: | 360 | out: |
359 | unlock_kernel(); | 361 | unlock_super(sb); |
360 | return error; | 362 | return error; |
361 | } | 363 | } |
362 | EXPORT_SYMBOL_GPL(fat_setattr); | 364 | EXPORT_SYMBOL_GPL(fat_setattr); |