Commit feb72ce8 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/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
parents 65795efb 5ac3455a
...@@ -187,7 +187,7 @@ readpages: no ...@@ -187,7 +187,7 @@ readpages: no
write_begin: no locks the page yes write_begin: no locks the page yes
write_end: no yes, unlocks yes write_end: no yes, unlocks yes
perform_write: no n/a yes perform_write: no n/a yes
bmap: yes bmap: no
invalidatepage: no yes invalidatepage: no yes
releasepage: no yes releasepage: no yes
direct_IO: no direct_IO: no
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/idr.h> #include <linux/idr.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/smp_lock.h>
#include <net/9p/9p.h> #include <net/9p/9p.h>
#include <net/9p/client.h> #include <net/9p/client.h>
...@@ -231,10 +230,8 @@ v9fs_umount_begin(struct super_block *sb) ...@@ -231,10 +230,8 @@ v9fs_umount_begin(struct super_block *sb)
{ {
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
lock_kernel();
v9ses = sb->s_fs_info; v9ses = sb->s_fs_info;
v9fs_session_cancel(v9ses); v9fs_session_cancel(v9ses);
unlock_kernel();
} }
static const struct super_operations v9fs_super_ops = { static const struct super_operations v9fs_super_ops = {
......
#include <linux/fs.h>
#include <linux/adfs_fs.h>
/* Internal data structures for ADFS */ /* Internal data structures for ADFS */
#define ADFS_FREE_FRAG 0 #define ADFS_FREE_FRAG 0
...@@ -16,6 +19,58 @@ ...@@ -16,6 +19,58 @@
struct buffer_head; 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 * Directory handling
*/ */
......
...@@ -9,15 +9,7 @@ ...@@ -9,15 +9,7 @@
* *
* Common directory handling for ADFS * 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/smp_lock.h>
#include <linux/buffer_head.h> /* for file_fsync() */
#include "adfs.h" #include "adfs.h"
/* /*
......
...@@ -9,15 +9,7 @@ ...@@ -9,15 +9,7 @@
* *
* E and F format directory handling * 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/buffer_head.h>
#include <linux/string.h>
#include "adfs.h" #include "adfs.h"
#include "dir_f.h" #include "dir_f.h"
......
...@@ -7,15 +7,7 @@ ...@@ -7,15 +7,7 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * 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/buffer_head.h>
#include <linux/string.h>
#include "adfs.h" #include "adfs.h"
#include "dir_fplus.h" #include "dir_fplus.h"
......
...@@ -19,10 +19,6 @@ ...@@ -19,10 +19,6 @@
* *
* adfs regular file handling primitives * 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" #include "adfs.h"
const struct file_operations adfs_file_operations = { const struct file_operations adfs_file_operations = {
......
...@@ -7,17 +7,8 @@ ...@@ -7,17 +7,8 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * 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/smp_lock.h>
#include <linux/module.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include "adfs.h" #include "adfs.h"
/* /*
...@@ -395,4 +386,3 @@ int adfs_write_inode(struct inode *inode, int wait) ...@@ -395,4 +386,3 @@ int adfs_write_inode(struct inode *inode, int wait)
unlock_kernel(); unlock_kernel();
return ret; return ret;
} }
MODULE_LICENSE("GPL");
...@@ -7,14 +7,8 @@ ...@@ -7,14 +7,8 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * 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 <linux/buffer_head.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "adfs.h" #include "adfs.h"
/* /*
......
...@@ -8,26 +8,12 @@ ...@@ -8,26 +8,12 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/module.h> #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/init.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/vfs.h>
#include <linux/parser.h> #include <linux/parser.h>
#include <linux/bitops.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/statfs.h>
#include <asm/uaccess.h>
#include <asm/system.h>
#include <stdarg.h>
#include "adfs.h" #include "adfs.h"
#include "dir_f.h" #include "dir_f.h"
#include "dir_fplus.h" #include "dir_fplus.h"
...@@ -534,3 +520,4 @@ static void __exit exit_adfs_fs(void) ...@@ -534,3 +520,4 @@ static void __exit exit_adfs_fs(void)
module_init(init_adfs_fs) module_init(init_adfs_fs)
module_exit(exit_adfs_fs) module_exit(exit_adfs_fs)
MODULE_LICENSE("GPL");
...@@ -735,8 +735,6 @@ parse_options(char *options, befs_mount_options * opts) ...@@ -735,8 +735,6 @@ parse_options(char *options, befs_mount_options * opts)
static void static void
befs_put_super(struct super_block *sb) befs_put_super(struct super_block *sb)
{ {
lock_kernel();
kfree(BEFS_SB(sb)->mount_opts.iocharset); kfree(BEFS_SB(sb)->mount_opts.iocharset);
BEFS_SB(sb)->mount_opts.iocharset = NULL; BEFS_SB(sb)->mount_opts.iocharset = NULL;
...@@ -747,8 +745,6 @@ befs_put_super(struct super_block *sb) ...@@ -747,8 +745,6 @@ befs_put_super(struct super_block *sb)
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
unlock_kernel();
} }
/* Allocate private field of the superblock, fill it. /* Allocate private field of the superblock, fill it.
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
*/ */
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/smp_lock.h>
#include "efs.h" #include "efs.h"
static int efs_readdir(struct file *, void *, filldir_t); static int efs_readdir(struct file *, void *, filldir_t);
const struct file_operations efs_dir_operations = { const struct file_operations efs_dir_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir, .read = generic_read_dir,
.readdir = efs_readdir, .readdir = efs_readdir,
}; };
...@@ -33,8 +33,6 @@ static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) { ...@@ -33,8 +33,6 @@ static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
if (inode->i_size & (EFS_DIRBSIZE-1)) if (inode->i_size & (EFS_DIRBSIZE-1))
printk(KERN_WARNING "EFS: WARNING: readdir(): directory size not a multiple of EFS_DIRBSIZE\n"); 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 */ /* work out where this entry can be found */
block = filp->f_pos >> EFS_DIRBSIZE_BITS; block = filp->f_pos >> EFS_DIRBSIZE_BITS;
...@@ -107,7 +105,6 @@ static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) { ...@@ -107,7 +105,6 @@ static int efs_readdir(struct file *filp, void *dirent, filldir_t filldir) {
filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot; filp->f_pos = (block << EFS_DIRBSIZE_BITS) | slot;
out: out:
unlock_kernel();
return 0; return 0;
} }
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/smp_lock.h>
#include <linux/exportfs.h> #include <linux/exportfs.h>
#include "efs.h" #include "efs.h"
...@@ -63,16 +62,12 @@ struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, struct namei ...@@ -63,16 +62,12 @@ struct dentry *efs_lookup(struct inode *dir, struct dentry *dentry, struct namei
efs_ino_t inodenum; efs_ino_t inodenum;
struct inode * inode = NULL; struct inode * inode = NULL;
lock_kernel();
inodenum = efs_find_entry(dir, dentry->d_name.name, dentry->d_name.len); inodenum = efs_find_entry(dir, dentry->d_name.name, dentry->d_name.len);
if (inodenum) { if (inodenum) {
inode = efs_iget(dir->i_sb, inodenum); inode = efs_iget(dir->i_sb, inodenum);
if (IS_ERR(inode)) { if (IS_ERR(inode))
unlock_kernel();
return ERR_CAST(inode); return ERR_CAST(inode);
} }
}
unlock_kernel();
return d_splice_alias(inode, dentry); return d_splice_alias(inode, dentry);
} }
...@@ -115,11 +110,9 @@ struct dentry *efs_get_parent(struct dentry *child) ...@@ -115,11 +110,9 @@ struct dentry *efs_get_parent(struct dentry *child)
struct dentry *parent = ERR_PTR(-ENOENT); struct dentry *parent = ERR_PTR(-ENOENT);
efs_ino_t ino; efs_ino_t ino;
lock_kernel();
ino = efs_find_entry(child->d_inode, "..", 2); ino = efs_find_entry(child->d_inode, "..", 2);
if (ino) if (ino)
parent = d_obtain_alias(efs_iget(child->d_inode->i_sb, ino)); parent = d_obtain_alias(efs_iget(child->d_inode->i_sb, ino));
unlock_kernel();
return parent; return parent;
} }
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/smp_lock.h>
#include "efs.h" #include "efs.h"
static int efs_symlink_readpage(struct file *file, struct page *page) static int efs_symlink_readpage(struct file *file, struct page *page)
...@@ -22,9 +21,8 @@ static int efs_symlink_readpage(struct file *file, struct page *page) ...@@ -22,9 +21,8 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
err = -ENAMETOOLONG; err = -ENAMETOOLONG;
if (size > 2 * EFS_BLOCKSIZE) if (size > 2 * EFS_BLOCKSIZE)
goto fail_notlocked; goto fail;
lock_kernel();
/* read first 512 bytes of link target */ /* read first 512 bytes of link target */
err = -EIO; err = -EIO;
bh = sb_bread(inode->i_sb, efs_bmap(inode, 0)); bh = sb_bread(inode->i_sb, efs_bmap(inode, 0));
...@@ -40,14 +38,11 @@ static int efs_symlink_readpage(struct file *file, struct page *page) ...@@ -40,14 +38,11 @@ static int efs_symlink_readpage(struct file *file, struct page *page)
brelse(bh); brelse(bh);
} }
link[size] = '\0'; link[size] = '\0';
unlock_kernel();
SetPageUptodate(page); SetPageUptodate(page);
kunmap(page); kunmap(page);
unlock_page(page); unlock_page(page);
return 0; return 0;
fail: fail:
unlock_kernel();
fail_notlocked:
SetPageError(page); SetPageError(page);
kunmap(page); kunmap(page);
unlock_page(page); unlock_page(page);
......
...@@ -129,12 +129,15 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size) ...@@ -129,12 +129,15 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size)
static inline struct posix_acl * static inline struct posix_acl *
ext3_iget_acl(struct inode *inode, struct posix_acl **i_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);
if (acl) {
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (*i_acl != EXT3_ACL_NOT_CACHED) acl = *i_acl;
acl = posix_acl_dup(*i_acl); if (acl != EXT3_ACL_NOT_CACHED)
acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
}
return acl; return acl;
} }
......
...@@ -129,12 +129,15 @@ ext4_acl_to_disk(const struct posix_acl *acl, size_t *size) ...@@ -129,12 +129,15 @@ ext4_acl_to_disk(const struct posix_acl *acl, size_t *size)
static inline struct posix_acl * static inline struct posix_acl *
ext4_iget_acl(struct inode *inode, struct posix_acl **i_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);
if (acl) {
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (*i_acl != EXT4_ACL_NOT_CACHED) acl = *i_acl;
acl = posix_acl_dup(*i_acl); if (acl != EXT4_ACL_NOT_CACHED)
acl = posix_acl_dup(acl);
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
}
return acl; return acl;
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/random.h> #include <linux/random.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/exportfs.h> #include <linux/exportfs.h>
#include <linux/smp_lock.h>
MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>"); MODULE_AUTHOR("Miklos Szeredi <miklos@szeredi.hu>");
MODULE_DESCRIPTION("Filesystem in Userspace"); MODULE_DESCRIPTION("Filesystem in Userspace");
...@@ -260,9 +259,7 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid, ...@@ -260,9 +259,7 @@ struct inode *fuse_iget(struct super_block *sb, u64 nodeid,
static void fuse_umount_begin(struct super_block *sb) static void fuse_umount_begin(struct super_block *sb)
{ {
lock_kernel();
fuse_abort_conn(get_fuse_conn_super(sb)); fuse_abort_conn(get_fuse_conn_super(sb));
unlock_kernel();
} }
static void fuse_send_destroy(struct fuse_conn *fc) static void fuse_send_destroy(struct fuse_conn *fc)
......
...@@ -70,9 +70,7 @@ static int ioctl_fibmap(struct file *filp, int __user *p) ...@@ -70,9 +70,7 @@ static int ioctl_fibmap(struct file *filp, int __user *p)
res = get_user(block, p); res = get_user(block, p);
if (res) if (res)
return res; return res;
lock_kernel();
res = mapping->a_ops->bmap(mapping, block); res = mapping->a_ops->bmap(mapping, block);
unlock_kernel();
return put_user(res, p); return put_user(res, p);
} }
......
...@@ -12,13 +12,14 @@ ...@@ -12,13 +12,14 @@
/* bitmap.c contains the code that handles the inode and block bitmaps */ /* bitmap.c contains the code that handles the inode and block bitmaps */
#include "minix.h" #include "minix.h"
#include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/sched.h> #include <linux/sched.h>
static const int nibblemap[] = { 4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0 }; static const int nibblemap[] = { 4,3,3,2,3,2,2,1,3,2,2,1,2,1,1,0 };
static DEFINE_SPINLOCK(bitmap_lock);
static unsigned long count_free(struct buffer_head *map[], unsigned numblocks, __u32 numbits) static unsigned long count_free(struct buffer_head *map[], unsigned numblocks, __u32 numbits)
{ {
unsigned i, j, sum = 0; unsigned i, j, sum = 0;
...@@ -69,11 +70,11 @@ void minix_free_block(struct inode *inode, unsigned long block) ...@@ -69,11 +70,11 @@ void minix_free_block(struct inode *inode, unsigned long block)
return; return;
} }
bh = sbi->s_zmap[zone]; bh = sbi->s_zmap[zone];
lock_kernel(); spin_lock(&bitmap_lock);
if (!minix_test_and_clear_bit(bit, bh->b_data)) if (!minix_test_and_clear_bit(bit, bh->b_data))
printk("minix_free_block (%s:%lu): bit already cleared\n", printk("minix_free_block (%s:%lu): bit already cleared\n",
sb->s_id, block); sb->s_id, block);
unlock_kernel(); spin_unlock(&bitmap_lock);
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
return; return;
} }
...@@ -88,18 +89,18 @@ int minix_new_block(struct inode * inode) ...@@ -88,18 +89,18 @@ int minix_new_block(struct inode * inode)
struct buffer_head *bh = sbi->s_zmap[i]; struct buffer_head *bh = sbi->s_zmap[i];
int j; int j;
lock_kernel(); spin_lock(&bitmap_lock);
j = minix_find_first_zero_bit(bh->b_data, bits_per_zone); j = minix_find_first_zero_bit(bh->b_data, bits_per_zone);
if (j < bits_per_zone) { if (j < bits_per_zone) {
minix_set_bit(j, bh->b_data); minix_set_bit(j, bh->b_data);
unlock_kernel(); spin_unlock(&bitmap_lock);
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
j += i * bits_per_zone + sbi->s_firstdatazone-1; j += i * bits_per_zone + sbi->s_firstdatazone-1;
if (j < sbi->s_firstdatazone || j >= sbi->s_nzones) if (j < sbi->s_firstdatazone || j >= sbi->s_nzones)
break; break;
return j; return j;
} }
unlock_kernel(); spin_unlock(&bitmap_lock);
} }
return 0; return 0;
} }
...@@ -211,10 +212,10 @@ void minix_free_inode(struct inode * inode) ...@@ -211,10 +212,10 @@ void minix_free_inode(struct inode * inode)
minix_clear_inode(inode); /* clear on-disk copy */ minix_clear_inode(inode); /* clear on-disk copy */
bh = sbi->s_imap[ino]; bh = sbi->s_imap[ino];
lock_kernel(); spin_lock(&bitmap_lock);
if (!minix_test_and_clear_bit(bit, bh->b_data)) if (!minix_test_and_clear_bit(bit, bh->b_data))
printk("minix_free_inode: bit %lu already cleared\n", bit); printk("minix_free_inode: bit %lu already cleared\n", bit);
unlock_kernel(); spin_unlock(&bitmap_lock);
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
out: out:
clear_inode(inode); /* clear in-memory copy */ clear_inode(inode); /* clear in-memory copy */
...@@ -237,7 +238,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error) ...@@ -237,7 +238,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error)
j = bits_per_zone; j = bits_per_zone;
bh = NULL; bh = NULL;
*error = -ENOSPC; *error = -ENOSPC;
lock_kernel(); spin_lock(&bitmap_lock);
for (i = 0; i < sbi->s_imap_blocks; i++) { for (i = 0; i < sbi->s_imap_blocks; i++) {
bh = sbi->s_imap[i]; bh = sbi->s_imap[i];
j = minix_find_first_zero_bit(bh->b_data, bits_per_zone); j = minix_find_first_zero_bit(bh->b_data, bits_per_zone);
...@@ -245,17 +246,17 @@ struct inode * minix_new_inode(const struct inode * dir, int * error) ...@@ -245,17 +246,17 @@ struct inode * minix_new_inode(const struct inode * dir, int * error)
break; break;
} }
if (!bh || j >= bits_per_zone) { if (!bh || j >= bits_per_zone) {
unlock_kernel(); spin_unlock(&bitmap_lock);
iput(inode); iput(inode);
return NULL; return NULL;
} }
if (minix_test_and_set_bit(j, bh->b_data)) { /* shouldn't happen */ if (minix_test_and_set_bit(j, bh->b_data)) { /* shouldn't happen */
unlock_kernel(); spin_unlock(&bitmap_lock);
printk("minix_new_inode: bit already set\n"); printk("minix_new_inode: bit already set\n");
iput(inode); iput(inode);
return NULL; return NULL;
} }
unlock_kernel(); spin_unlock(&bitmap_lock);
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
j += i * bits_per_zone; j += i * bits_per_zone;
if (!j || j > sbi->s_ninodes) { if (!j || j > sbi->s_ninodes) {
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "minix.h" #include "minix.h"
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/smp_lock.h>
#include <linux/swap.h> #include <linux/swap.h>
typedef struct minix_dir_entry minix_dirent; typedef struct minix_dir_entry minix_dirent;
...@@ -20,6 +19,7 @@ typedef struct minix3_dir_entry minix3_dirent; ...@@ -20,6 +19,7 @@ typedef struct minix3_dir_entry minix3_dirent;
static int minix_readdir(struct file *, void *, filldir_t); static int minix_readdir(struct file *, void *, filldir_t);
const struct file_operations minix_dir_operations = { const struct file_operations minix_dir_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir, .read = generic_read_dir,
.readdir = minix_readdir, .readdir = minix_readdir,
.fsync = simple_fsync, .fsync = simple_fsync,
...@@ -102,8 +102,6 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir) ...@@ -102,8 +102,6 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir)
char *name; char *name;
__u32 inumber; __u32 inumber;
lock_kernel();
pos = (pos + chunk_size-1) & ~(chunk_size-1); pos = (pos + chunk_size-1) & ~(chunk_size-1);
if (pos >= inode->i_size) if (pos >= inode->i_size)
goto done; goto done;
...@@ -146,7 +144,6 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir) ...@@ -146,7 +144,6 @@ static int minix_readdir(struct file * filp, void * dirent, filldir_t filldir)
done: done:
filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset; filp->f_pos = (n << PAGE_CACHE_SHIFT) | offset;
unlock_kernel();
return 0; return 0;
} }
......
...@@ -35,8 +35,6 @@ static void minix_put_super(struct super_block *sb) ...@@ -35,8 +35,6 @@ static void minix_put_super(struct super_block *sb)
int i; int i;
struct minix_sb_info *sbi = minix_sb(sb); struct minix_sb_info *sbi = minix_sb(sb);
lock_kernel();
if (!(sb->s_flags & MS_RDONLY)) { if (!(sb->s_flags & MS_RDONLY)) {
if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */ if (sbi->s_version != MINIX_V3) /* s_state is now out from V3 sb */
sbi->s_ms->s_state = sbi->s_mount_state; sbi->s_ms->s_state = sbi->s_mount_state;
...@@ -50,8 +48,6 @@ static void minix_put_super(struct super_block *sb) ...@@ -50,8 +48,6 @@ static void minix_put_super(struct super_block *sb)
kfree(sbi->s_imap); kfree(sbi->s_imap);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
kfree(sbi); kfree(sbi);
unlock_kernel();
} }
static struct kmem_cache * minix_inode_cachep; static struct kmem_cache * minix_inode_cachep;
......
...@@ -545,25 +545,19 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) ...@@ -545,25 +545,19 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) { if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) {
if (force) if (force)
mark_files_ro(sb); mark_files_ro(sb);
else if (!fs_may_remount_ro(sb)) { else if (!fs_may_remount_ro(sb))
unlock_kernel();
return -EBUSY; return -EBUSY;
}
retval = vfs_dq_off(sb, 1); retval = vfs_dq_off(sb, 1);
if (retval < 0 && retval != -ENOSYS) { if (retval < 0 && retval != -ENOSYS)
unlock_kernel();
return -EBUSY; return -EBUSY;
} }
}
remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY); remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY);
if (sb->s_op->remount_fs) { if (sb->s_op->remount_fs) {
retval = sb->s_op->remount_fs(sb, &flags, data); retval = sb->s_op->remount_fs(sb, &flags, data);
if (retval) { if (retval)
unlock_kernel();
return retval; return retval;
} }
}
sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
if (remount_rw) if (remount_rw)
vfs_dq_quota_on_remount(sb); vfs_dq_quota_on_remount(sb);
......
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/smp_lock.h>
#include <linux/swap.h> #include <linux/swap.h>
#include "sysv.h" #include "sysv.h"
static int sysv_readdir(struct file *, void *, filldir_t); static int sysv_readdir(struct file *, void *, filldir_t);
const struct file_operations sysv_dir_operations = { const struct file_operations sysv_dir_operations = {
.llseek = generic_file_llseek,
.read = generic_read_dir, .read = generic_read_dir,
.readdir = sysv_readdir, .readdir = sysv_readdir,
.fsync = simple_fsync, .fsync = simple_fsync,
...@@ -74,8 +74,6 @@ static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir) ...@@ -74,8 +74,6 @@ static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir)
unsigned long n = pos >> PAGE_CACHE_SHIFT; unsigned long n = pos >> PAGE_CACHE_SHIFT;
unsigned long npages = dir_pages(inode); unsigned long npages = dir_pages(inode);
lock_kernel();
pos = (pos + SYSV_DIRSIZE-1) & ~(SYSV_DIRSIZE-1); pos = (pos + SYSV_DIRSIZE-1) & ~(SYSV_DIRSIZE-1);
if (pos >= inode->i_size) if (pos >= inode->i_size)
goto done; goto done;
...@@ -113,7 +111,6 @@ static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir) ...@@ -113,7 +111,6 @@ static int sysv_readdir(struct file * filp, void * dirent, filldir_t filldir)
done: done:
filp->f_pos = ((loff_t)n << PAGE_CACHE_SHIFT) | offset; filp->f_pos = ((loff_t)n << PAGE_CACHE_SHIFT) | offset;
unlock_kernel();
return 0; return 0;
} }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
* the superblock. * the superblock.
*/ */
#include <linux/smp_lock.h>
#include <linux/highuid.h> #include <linux/highuid.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -37,7 +36,6 @@ static int sysv_sync_fs(struct super_block *sb, int wait) ...@@ -37,7 +36,6 @@ static int sysv_sync_fs(struct super_block *sb, int wait)
unsigned long time = get_seconds(), old_time; unsigned long time = get_seconds(), old_time;
lock_super(sb); lock_super(sb);
lock_kernel();
/* /*
* If we are going to write out the super block, * If we are going to write out the super block,
...@@ -52,7 +50,6 @@ static int sysv_sync_fs(struct super_block *sb, int wait) ...@@ -52,7 +50,6 @@ static int sysv_sync_fs(struct super_block *sb, int wait)
mark_buffer_dirty(sbi->s_bh2); mark_buffer_dirty(sbi->s_bh2);
} }
unlock_kernel();
unlock_super(sb); unlock_super(sb);
return 0; return 0;
...@@ -82,8 +79,6 @@ static void sysv_put_super(struct super_block *sb) ...@@ -82,8 +79,6 @@ static void sysv_put_super(struct super_block *sb)
{ {
struct sysv_sb_info *sbi = SYSV_SB(sb); struct sysv_sb_info *sbi = SYSV_SB(sb);
lock_kernel();
if (sb->s_dirt) if (sb->s_dirt)
sysv_write_super(sb); sysv_write_super(sb);
...@@ -99,8 +94,6 @@ static void sysv_put_super(struct super_block *sb) ...@@ -99,8 +94,6 @@ static void sysv_put_super(struct super_block *sb)
brelse(sbi->s_bh2); brelse(sbi->s_bh2);
kfree(sbi); kfree(sbi);
unlock_kernel();
} }
static int sysv_statfs(struct dentry *dentry, struct kstatfs *buf) static int sysv_statfs(struct dentry *dentry, struct kstatfs *buf)
...@@ -275,7 +268,6 @@ int sysv_write_inode(struct inode *inode, int wait) ...@@ -275,7 +268,6 @@ int sysv_write_inode(struct inode *inode, int wait)
return -EIO; return -EIO;
} }
lock_kernel();
raw_inode->i_mode = cpu_to_fs16(sbi, inode->i_mode); raw_inode->i_mode = cpu_to_fs16(sbi, inode->i_mode);
raw_inode->i_uid = cpu_to_fs16(sbi, fs_high2lowuid(inode->i_uid)); raw_inode->i_uid = cpu_to_fs16(sbi, fs_high2lowuid(inode->i_uid));
raw_inode->i_gid = cpu_to_fs16(sbi, fs_high2lowgid(inode->i_gid)); raw_inode->i_gid = cpu_to_fs16(sbi, fs_high2lowgid(inode->i_gid));
...@@ -291,7 +283,6 @@ int sysv_write_inode(struct inode *inode, int wait) ...@@ -291,7 +283,6 @@ int sysv_write_inode(struct inode *inode, int wait)
for (block = 0; block < 10+1+1+1; block++) for (block = 0; block < 10+1+1+1; block++)
write3byte(sbi, (u8 *)&si->i_data[block], write3byte(sbi, (u8 *)&si->i_data[block],
&raw_inode->i_data[3*block]); &raw_inode->i_data[3*block]);
unlock_kernel();
mark_buffer_dirty(bh); mark_buffer_dirty(bh);
if (wait) { if (wait) {
sync_dirty_buffer(bh); sync_dirty_buffer(bh);
...@@ -315,9 +306,7 @@ static void sysv_delete_inode(struct inode *inode) ...@@ -315,9 +306,7 @@ static void sysv_delete_inode(struct inode *inode)
truncate_inode_pages(&inode->i_data, 0); truncate_inode_pages(&inode->i_data, 0);
inode->i_size = 0; inode->i_size = 0;
sysv_truncate(inode); sysv_truncate(inode);
lock_kernel();
sysv_free_inode(inode); sysv_free_inode(inode);
unlock_kernel();
} }
static struct kmem_cache *sysv_inode_cachep; static struct kmem_cache *sysv_inode_cachep;
......
...@@ -41,8 +41,6 @@ struct adfs_discrecord { ...@@ -41,8 +41,6 @@ struct adfs_discrecord {
#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3) #define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/adfs_fs_i.h>
#include <linux/adfs_fs_sb.h>
/* /*
* Calculate the boot block checksum on an ADFS drive. Note that this will * Calculate the boot block checksum on an ADFS drive. Note that this will
* appear to be correct if the sector contains all zeros, so also check that * appear to be correct if the sector contains all zeros, so also check that
...@@ -60,17 +58,6 @@ static inline int adfs_checkbblk(unsigned char *ptr) ...@@ -60,17 +58,6 @@ static inline int adfs_checkbblk(unsigned char *ptr)
return (result & 0xff) != ptr[511]; return (result & 0xff) != ptr[511];
} }
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);
}
#endif #endif
#endif #endif
/*
* linux/include/linux/adfs_fs_i.h
*
* Copyright (C) 1997 Russell King
*/
#ifndef _ADFS_FS_I
#define _ADFS_FS_I
/*
* 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;
};
#endif
/*
* linux/include/linux/adfs_fs_sb.h
*
* Copyright (C) 1997-1999 Russell King
*/
#ifndef _ADFS_FS_SB
#define _ADFS_FS_SB
/*
* 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 */
};
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment