Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/viro/vfs-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
  get rid of BKL in fs/sysv
  get rid of BKL in fs/minix
  get rid of BKL in fs/efs
  befs ->pust_super() doesn't need BKL
  Cleanup of adfs headers
  9P doesn't need BKL in ->umount_begin()
  fuse doesn't need BKL in ->umount_begin()
  No instance of ->bmap() needs BKL
  remove unlock_kernel() left accidentally
  ext4: avoid unnecessary spinlock in critical POSIX ACL path
  ext3: avoid unnecessary spinlock in critical POSIX ACL path
  • Loading branch information
torvalds committed Jun 17, 2009
2 parents 65795ef + 5ac3455 commit feb72ce
Show file tree
Hide file tree
Showing 27 changed files with 95 additions and 219 deletions.
2 changes: 1 addition & 1 deletion Documentation/filesystems/Locking
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ readpages: no
write_begin: no locks the page yes
write_end: no yes, unlocks yes
perform_write: no n/a yes
bmap: yes
bmap: no
invalidatepage: no yes
releasepage: no yes
direct_IO: no
Expand Down
3 changes: 0 additions & 3 deletions fs/9p/vfs_super.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <linux/mount.h>
#include <linux/idr.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <net/9p/9p.h>
#include <net/9p/client.h>

Expand Down Expand Up @@ -231,10 +230,8 @@ v9fs_umount_begin(struct super_block *sb)
{
struct v9fs_session_info *v9ses;

lock_kernel();
v9ses = sb->s_fs_info;
v9fs_session_cancel(v9ses);
unlock_kernel();
}

static const struct super_operations v9fs_super_ops = {
Expand Down
55 changes: 55 additions & 0 deletions fs/adfs/adfs.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include <linux/fs.h>
#include <linux/adfs_fs.h>

/* Internal data structures for ADFS */

#define ADFS_FREE_FRAG 0
Expand All @@ -16,6 +19,58 @@

struct buffer_head;

/*
* adfs file system inode data in memory
*/
struct adfs_inode_info {
loff_t mmu_private;
unsigned long parent_id; /* object id of parent */
__u32 loadaddr; /* RISC OS load address */
__u32 execaddr; /* RISC OS exec address */
unsigned int filetype; /* RISC OS file type */
unsigned int attr; /* RISC OS permissions */
unsigned int stamped:1; /* RISC OS file has date/time */
struct inode vfs_inode;
};

/*
* Forward-declare this
*/
struct adfs_discmap;
struct adfs_dir_ops;

/*
* ADFS file system superblock data in memory
*/
struct adfs_sb_info {
struct adfs_discmap *s_map; /* bh list containing map */
struct adfs_dir_ops *s_dir; /* directory operations */

uid_t s_uid; /* owner uid */
gid_t s_gid; /* owner gid */
umode_t s_owner_mask; /* ADFS owner perm -> unix perm */
umode_t s_other_mask; /* ADFS other perm -> unix perm */

__u32 s_ids_per_zone; /* max. no ids in one zone */
__u32 s_idlen; /* length of ID in map */
__u32 s_map_size; /* sector size of a map */
unsigned long s_size; /* total size (in blocks) of this fs */
signed int s_map2blk; /* shift left by this for map->sector */
unsigned int s_log2sharesize;/* log2 share size */
__le32 s_version; /* disc format version */
unsigned int s_namelen; /* maximum number of characters in name */
};

static inline struct adfs_sb_info *ADFS_SB(struct super_block *sb)
{
return sb->s_fs_info;
}

static inline struct adfs_inode_info *ADFS_I(struct inode *inode)
{
return container_of(inode, struct adfs_inode_info, vfs_inode);
}

/*
* Directory handling
*/
Expand Down
8 changes: 0 additions & 8 deletions fs/adfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@
*
* Common directory handling for ADFS
*/
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/adfs_fs.h>
#include <linux/time.h>
#include <linux/stat.h>
#include <linux/spinlock.h>
#include <linux/smp_lock.h>
#include <linux/buffer_head.h> /* for file_fsync() */

#include "adfs.h"

/*
Expand Down
8 changes: 0 additions & 8 deletions fs/adfs/dir_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@
*
* E and F format directory handling
*/
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/adfs_fs.h>
#include <linux/time.h>
#include <linux/stat.h>
#include <linux/spinlock.h>
#include <linux/buffer_head.h>
#include <linux/string.h>

#include "adfs.h"
#include "dir_f.h"

Expand Down
8 changes: 0 additions & 8 deletions fs/adfs/dir_fplus.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/adfs_fs.h>
#include <linux/time.h>
#include <linux/stat.h>
#include <linux/spinlock.h>
#include <linux/buffer_head.h>
#include <linux/string.h>

#include "adfs.h"
#include "dir_fplus.h"

Expand Down
4 changes: 0 additions & 4 deletions fs/adfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
*
* adfs regular file handling primitives
*/
#include <linux/fs.h>
#include <linux/buffer_head.h> /* for file_fsync() */
#include <linux/adfs_fs.h>

#include "adfs.h"

const struct file_operations adfs_file_operations = {
Expand Down
10 changes: 0 additions & 10 deletions fs/adfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,8 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/adfs_fs.h>
#include <linux/time.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/smp_lock.h>
#include <linux/module.h>
#include <linux/buffer_head.h>

#include "adfs.h"

/*
Expand Down Expand Up @@ -395,4 +386,3 @@ int adfs_write_inode(struct inode *inode, int wait)
unlock_kernel();
return ret;
}
MODULE_LICENSE("GPL");
6 changes: 0 additions & 6 deletions fs/adfs/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/adfs_fs.h>
#include <linux/spinlock.h>
#include <linux/buffer_head.h>

#include <asm/unaligned.h>

#include "adfs.h"

/*
Expand Down
17 changes: 2 additions & 15 deletions fs/adfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,12 @@
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/adfs_fs.h>
#include <linux/slab.h>
#include <linux/time.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/buffer_head.h>
#include <linux/vfs.h>
#include <linux/parser.h>
#include <linux/bitops.h>
#include <linux/mount.h>
#include <linux/seq_file.h>

#include <asm/uaccess.h>
#include <asm/system.h>

#include <stdarg.h>

#include <linux/statfs.h>
#include "adfs.h"
#include "dir_f.h"
#include "dir_fplus.h"
Expand Down Expand Up @@ -534,3 +520,4 @@ static void __exit exit_adfs_fs(void)

module_init(init_adfs_fs)
module_exit(exit_adfs_fs)
MODULE_LICENSE("GPL");
4 changes: 0 additions & 4 deletions fs/befs/linuxvfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,6 @@ parse_options(char *options, befs_mount_options * opts)
static void
befs_put_super(struct super_block *sb)
{
lock_kernel();

kfree(BEFS_SB(sb)->mount_opts.iocharset);
BEFS_SB(sb)->mount_opts.iocharset = NULL;

Expand All @@ -747,8 +745,6 @@ befs_put_super(struct super_block *sb)

kfree(sb->s_fs_info);
sb->s_fs_info = NULL;

unlock_kernel();
}

/* Allocate private field of the superblock, fill it.
Expand Down
5 changes: 1 addition & 4 deletions fs/efs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/

#include <linux/buffer_head.h>
#include <linux/smp_lock.h>
#include "efs.h"

static int efs_readdir(struct file *, void *, filldir_t);

const struct file_operations efs_dir_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir,
.readdir = efs_readdir,
};
Expand All @@ -33,8 +33,6 @@ static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
if (inode->i_size & (EFS_DIRBSIZE-1))
printk(KERN_WARNING "EFS: WARNING: readdir(): directory size not a multiple of EFS_DIRBSIZE\n");

lock_kernel();

/* work out where this entry can be found */
block = filp->f_pos >> EFS_DIRBSIZE_BITS;

Expand Down Expand Up @@ -107,7 +105,6 @@ static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) {

filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot;
out:
unlock_kernel();
return 0;
}

9 changes: 1 addition & 8 deletions fs/efs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <linux/buffer_head.h>
#include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/exportfs.h>
#include "efs.h"

Expand Down Expand Up @@ -63,16 +62,12 @@ struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, struct namei
efs_ino_t inodenum;
struct inode * inode = NULL;

lock_kernel();
inodenum = efs_find_entry(dir, dentry->d_name.name, dentry->d_name.len);
if (inodenum) {
inode = efs_iget(dir->i_sb, inodenum);
if (IS_ERR(inode)) {
unlock_kernel();
if (IS_ERR(inode))
return ERR_CAST(inode);
}
}
unlock_kernel();

return d_splice_alias(inode, dentry);
}
Expand Down Expand Up @@ -115,11 +110,9 @@ struct dentry *efs_get_parent(struct dentry *child)
struct dentry *parent = ERR_PTR(-ENOENT);
efs_ino_t ino;

lock_kernel();
ino = efs_find_entry(child->d_inode, "..", 2);
if (ino)
parent = d_obtain_alias(efs_iget(child->d_inode->i_sb, ino));
unlock_kernel();

return parent;
}
7 changes: 1 addition & 6 deletions fs/efs/symlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <linux/string.h>
#include <linux/pagemap.h>
#include <linux/buffer_head.h>
#include <linux/smp_lock.h>
#include "efs.h"

static int efs_symlink_readpage(struct file *file, struct page *page)
Expand All @@ -22,9 +21,8 @@ static int efs_symlink_readpage(struct file *file, struct page *page)

err = -ENAMETOOLONG;
if (size > 2 * EFS_BLOCKSIZE)
goto fail_notlocked;
goto fail;

lock_kernel();
/* read first 512 bytes of link target */
err = -EIO;
bh = sb_bread(inode->i_sb, efs_bmap(inode, 0));
Expand All @@ -40,14 +38,11 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
brelse(bh);
}
link[size] = '\0';
unlock_kernel();
SetPageUptodate(page);
kunmap(page);
unlock_page(page);
return 0;
fail:
unlock_kernel();
fail_notlocked:
SetPageError(page);
kunmap(page);
unlock_page(page);
Expand Down
13 changes: 8 additions & 5 deletions fs/ext3/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,15 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size)
static inline struct posix_acl *
ext3_iget_acl(struct inode *inode, struct posix_acl **i_acl)
{
struct posix_acl *acl = EXT3_ACL_NOT_CACHED;
struct posix_acl *acl = ACCESS_ONCE(*i_acl);

spin_lock(&inode->i_lock);
if (*i_acl != EXT3_ACL_NOT_CACHED)
acl = posix_acl_dup(*i_acl);
spin_unlock(&inode->i_lock);
if (acl) {
spin_lock(&inode->i_lock);
acl = *i_acl;
if (acl != EXT3_ACL_NOT_CACHED)
acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock);
}

return acl;
}
Expand Down
13 changes: 8 additions & 5 deletions fs/ext4/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,15 @@ ext4_acl_to_disk(const struct posix_acl *acl, size_t *size)
static inline struct posix_acl *
ext4_iget_acl(struct inode *inode, struct posix_acl **i_acl)
{
struct posix_acl *acl = EXT4_ACL_NOT_CACHED;
struct posix_acl *acl = ACCESS_ONCE(*i_acl);

spin_lock(&inode->i_lock);
if (*i_acl != EXT4_ACL_NOT_CACHED)
acl = posix_acl_dup(*i_acl);
spin_unlock(&inode->i_lock);
if (acl) {
spin_lock(&inode->i_lock);
acl = *i_acl;
if (acl != EXT4_ACL_NOT_CACHED)
acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock);
}

return acl;
}
Expand Down
Loading

0 comments on commit feb72ce

Please sign in to comment.