Commit b5f5914c authored by Al Viro's avatar Al Viro

Merge branch 'ufs' into for-next

parents 15cf3b7a 4e317ce7
...@@ -5,5 +5,5 @@ ...@@ -5,5 +5,5 @@
obj-$(CONFIG_UFS_FS) += ufs.o obj-$(CONFIG_UFS_FS) += ufs.o
ufs-objs := balloc.o cylinder.o dir.o file.o ialloc.o inode.o \ ufs-objs := balloc.o cylinder.o dir.o file.o ialloc.o inode.o \
namei.o super.o symlink.o truncate.o util.o namei.o super.o symlink.o util.o
ccflags-$(CONFIG_UFS_DEBUG) += -DDEBUG ccflags-$(CONFIG_UFS_DEBUG) += -DDEBUG
...@@ -417,7 +417,9 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, ...@@ -417,7 +417,9 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
if (oldcount == 0) { if (oldcount == 0) {
result = ufs_alloc_fragments (inode, cgno, goal, count, err); result = ufs_alloc_fragments (inode, cgno, goal, count, err);
if (result) { if (result) {
write_seqlock(&UFS_I(inode)->meta_lock);
ufs_cpu_to_data_ptr(sb, p, result); ufs_cpu_to_data_ptr(sb, p, result);
write_sequnlock(&UFS_I(inode)->meta_lock);
*err = 0; *err = 0;
UFS_I(inode)->i_lastfrag = UFS_I(inode)->i_lastfrag =
max(UFS_I(inode)->i_lastfrag, fragment + count); max(UFS_I(inode)->i_lastfrag, fragment + count);
...@@ -473,7 +475,9 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment, ...@@ -473,7 +475,9 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
ufs_change_blocknr(inode, fragment - oldcount, oldcount, ufs_change_blocknr(inode, fragment - oldcount, oldcount,
uspi->s_sbbase + tmp, uspi->s_sbbase + tmp,
uspi->s_sbbase + result, locked_page); uspi->s_sbbase + result, locked_page);
write_seqlock(&UFS_I(inode)->meta_lock);
ufs_cpu_to_data_ptr(sb, p, result); ufs_cpu_to_data_ptr(sb, p, result);
write_sequnlock(&UFS_I(inode)->meta_lock);
*err = 0; *err = 0;
UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag, UFS_I(inode)->i_lastfrag = max(UFS_I(inode)->i_lastfrag,
fragment + count); fragment + count);
......
This diff is collapsed.
...@@ -94,22 +94,6 @@ ...@@ -94,22 +94,6 @@
#include "swab.h" #include "swab.h"
#include "util.h" #include "util.h"
void lock_ufs(struct super_block *sb)
{
struct ufs_sb_info *sbi = UFS_SB(sb);
mutex_lock(&sbi->mutex);
sbi->mutex_owner = current;
}
void unlock_ufs(struct super_block *sb)
{
struct ufs_sb_info *sbi = UFS_SB(sb);
sbi->mutex_owner = NULL;
mutex_unlock(&sbi->mutex);
}
static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation) static struct inode *ufs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation)
{ {
struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
...@@ -694,7 +678,6 @@ static int ufs_sync_fs(struct super_block *sb, int wait) ...@@ -694,7 +678,6 @@ static int ufs_sync_fs(struct super_block *sb, int wait)
struct ufs_super_block_third * usb3; struct ufs_super_block_third * usb3;
unsigned flags; unsigned flags;
lock_ufs(sb);
mutex_lock(&UFS_SB(sb)->s_lock); mutex_lock(&UFS_SB(sb)->s_lock);
UFSD("ENTER\n"); UFSD("ENTER\n");
...@@ -714,7 +697,6 @@ static int ufs_sync_fs(struct super_block *sb, int wait) ...@@ -714,7 +697,6 @@ static int ufs_sync_fs(struct super_block *sb, int wait)
UFSD("EXIT\n"); UFSD("EXIT\n");
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
unlock_ufs(sb);
return 0; return 0;
} }
...@@ -758,7 +740,6 @@ static void ufs_put_super(struct super_block *sb) ...@@ -758,7 +740,6 @@ static void ufs_put_super(struct super_block *sb)
ubh_brelse_uspi (sbi->s_uspi); ubh_brelse_uspi (sbi->s_uspi);
kfree (sbi->s_uspi); kfree (sbi->s_uspi);
mutex_destroy(&sbi->mutex);
kfree (sbi); kfree (sbi);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
UFSD("EXIT\n"); UFSD("EXIT\n");
...@@ -801,7 +782,6 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -801,7 +782,6 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY)); UFSD("flag %u\n", (int)(sb->s_flags & MS_RDONLY));
mutex_init(&sbi->mutex);
mutex_init(&sbi->s_lock); mutex_init(&sbi->s_lock);
spin_lock_init(&sbi->work_lock); spin_lock_init(&sbi->work_lock);
INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs);
...@@ -1257,7 +1237,6 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1257,7 +1237,6 @@ static int ufs_fill_super(struct super_block *sb, void *data, int silent)
return 0; return 0;
failed: failed:
mutex_destroy(&sbi->mutex);
if (ubh) if (ubh)
ubh_brelse_uspi (uspi); ubh_brelse_uspi (uspi);
kfree (uspi); kfree (uspi);
...@@ -1280,7 +1259,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) ...@@ -1280,7 +1259,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
unsigned flags; unsigned flags;
sync_filesystem(sb); sync_filesystem(sb);
lock_ufs(sb);
mutex_lock(&UFS_SB(sb)->s_lock); mutex_lock(&UFS_SB(sb)->s_lock);
uspi = UFS_SB(sb)->s_uspi; uspi = UFS_SB(sb)->s_uspi;
flags = UFS_SB(sb)->s_flags; flags = UFS_SB(sb)->s_flags;
...@@ -1296,7 +1274,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) ...@@ -1296,7 +1274,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
ufs_set_opt (new_mount_opt, ONERROR_LOCK); ufs_set_opt (new_mount_opt, ONERROR_LOCK);
if (!ufs_parse_options (data, &new_mount_opt)) { if (!ufs_parse_options (data, &new_mount_opt)) {
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
unlock_ufs(sb);
return -EINVAL; return -EINVAL;
} }
if (!(new_mount_opt & UFS_MOUNT_UFSTYPE)) { if (!(new_mount_opt & UFS_MOUNT_UFSTYPE)) {
...@@ -1304,14 +1281,12 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) ...@@ -1304,14 +1281,12 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
} else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) {
pr_err("ufstype can't be changed during remount\n"); pr_err("ufstype can't be changed during remount\n");
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
unlock_ufs(sb);
return -EINVAL; return -EINVAL;
} }
if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
UFS_SB(sb)->s_mount_opt = new_mount_opt; UFS_SB(sb)->s_mount_opt = new_mount_opt;
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
unlock_ufs(sb);
return 0; return 0;
} }
...@@ -1335,7 +1310,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) ...@@ -1335,7 +1310,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
#ifndef CONFIG_UFS_FS_WRITE #ifndef CONFIG_UFS_FS_WRITE
pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n"); pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n");
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
unlock_ufs(sb);
return -EINVAL; return -EINVAL;
#else #else
if (ufstype != UFS_MOUNT_UFSTYPE_SUN && if (ufstype != UFS_MOUNT_UFSTYPE_SUN &&
...@@ -1345,13 +1319,11 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) ...@@ -1345,13 +1319,11 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
ufstype != UFS_MOUNT_UFSTYPE_UFS2) { ufstype != UFS_MOUNT_UFSTYPE_UFS2) {
pr_err("this ufstype is read-only supported\n"); pr_err("this ufstype is read-only supported\n");
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
unlock_ufs(sb);
return -EINVAL; return -EINVAL;
} }
if (!ufs_read_cylinder_structures(sb)) { if (!ufs_read_cylinder_structures(sb)) {
pr_err("failed during remounting\n"); pr_err("failed during remounting\n");
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
unlock_ufs(sb);
return -EPERM; return -EPERM;
} }
sb->s_flags &= ~MS_RDONLY; sb->s_flags &= ~MS_RDONLY;
...@@ -1359,7 +1331,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data) ...@@ -1359,7 +1331,6 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
} }
UFS_SB(sb)->s_mount_opt = new_mount_opt; UFS_SB(sb)->s_mount_opt = new_mount_opt;
mutex_unlock(&UFS_SB(sb)->s_lock); mutex_unlock(&UFS_SB(sb)->s_lock);
unlock_ufs(sb);
return 0; return 0;
} }
...@@ -1391,8 +1362,7 @@ static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -1391,8 +1362,7 @@ static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf)
struct ufs_super_block_third *usb3; struct ufs_super_block_third *usb3;
u64 id = huge_encode_dev(sb->s_bdev->bd_dev); u64 id = huge_encode_dev(sb->s_bdev->bd_dev);
lock_ufs(sb); mutex_lock(&UFS_SB(sb)->s_lock);
usb3 = ubh_get_usb_third(uspi); usb3 = ubh_get_usb_third(uspi);
if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) { if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) {
...@@ -1413,7 +1383,7 @@ static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -1413,7 +1383,7 @@ static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf)
buf->f_fsid.val[0] = (u32)id; buf->f_fsid.val[0] = (u32)id;
buf->f_fsid.val[1] = (u32)(id >> 32); buf->f_fsid.val[1] = (u32)(id >> 32);
unlock_ufs(sb); mutex_unlock(&UFS_SB(sb)->s_lock);
return 0; return 0;
} }
...@@ -1429,6 +1399,8 @@ static struct inode *ufs_alloc_inode(struct super_block *sb) ...@@ -1429,6 +1399,8 @@ static struct inode *ufs_alloc_inode(struct super_block *sb)
return NULL; return NULL;
ei->vfs_inode.i_version = 1; ei->vfs_inode.i_version = 1;
seqlock_init(&ei->meta_lock);
mutex_init(&ei->truncate_mutex);
return &ei->vfs_inode; return &ei->vfs_inode;
} }
......
This diff is collapsed.
...@@ -24,8 +24,6 @@ struct ufs_sb_info { ...@@ -24,8 +24,6 @@ struct ufs_sb_info {
unsigned s_cgno[UFS_MAX_GROUP_LOADED]; unsigned s_cgno[UFS_MAX_GROUP_LOADED];
unsigned short s_cg_loaded; unsigned short s_cg_loaded;
unsigned s_mount_opt; unsigned s_mount_opt;
struct mutex mutex;
struct task_struct *mutex_owner;
struct super_block *sb; struct super_block *sb;
int work_queued; /* non-zero if the delayed work is queued */ int work_queued; /* non-zero if the delayed work is queued */
struct delayed_work sync_work; /* FS sync delayed work */ struct delayed_work sync_work; /* FS sync delayed work */
...@@ -46,6 +44,8 @@ struct ufs_inode_info { ...@@ -46,6 +44,8 @@ struct ufs_inode_info {
__u32 i_oeftflag; __u32 i_oeftflag;
__u16 i_osync; __u16 i_osync;
__u64 i_lastfrag; __u64 i_lastfrag;
seqlock_t meta_lock;
struct mutex truncate_mutex;
__u32 i_dir_start_lookup; __u32 i_dir_start_lookup;
struct inode vfs_inode; struct inode vfs_inode;
}; };
...@@ -122,7 +122,7 @@ extern struct inode *ufs_iget(struct super_block *, unsigned long); ...@@ -122,7 +122,7 @@ extern struct inode *ufs_iget(struct super_block *, unsigned long);
extern int ufs_write_inode (struct inode *, struct writeback_control *); extern int ufs_write_inode (struct inode *, struct writeback_control *);
extern int ufs_sync_inode (struct inode *); extern int ufs_sync_inode (struct inode *);
extern void ufs_evict_inode (struct inode *); extern void ufs_evict_inode (struct inode *);
extern int ufs_getfrag_block (struct inode *inode, sector_t fragment, struct buffer_head *bh_result, int create); extern int ufs_setattr(struct dentry *dentry, struct iattr *attr);
/* namei.c */ /* namei.c */
extern const struct file_operations ufs_dir_operations; extern const struct file_operations ufs_dir_operations;
...@@ -140,10 +140,6 @@ void ufs_mark_sb_dirty(struct super_block *sb); ...@@ -140,10 +140,6 @@ void ufs_mark_sb_dirty(struct super_block *sb);
extern const struct inode_operations ufs_fast_symlink_inode_operations; extern const struct inode_operations ufs_fast_symlink_inode_operations;
extern const struct inode_operations ufs_symlink_inode_operations; extern const struct inode_operations ufs_symlink_inode_operations;
/* truncate.c */
extern int ufs_truncate (struct inode *, loff_t);
extern int ufs_setattr(struct dentry *dentry, struct iattr *attr);
static inline struct ufs_sb_info *UFS_SB(struct super_block *sb) static inline struct ufs_sb_info *UFS_SB(struct super_block *sb)
{ {
return sb->s_fs_info; return sb->s_fs_info;
...@@ -170,7 +166,4 @@ static inline u32 ufs_dtogd(struct ufs_sb_private_info * uspi, u64 b) ...@@ -170,7 +166,4 @@ static inline u32 ufs_dtogd(struct ufs_sb_private_info * uspi, u64 b)
return do_div(b, uspi->s_fpg); return do_div(b, uspi->s_fpg);
} }
extern void lock_ufs(struct super_block *sb);
extern void unlock_ufs(struct super_block *sb);
#endif /* _UFS_UFS_H */ #endif /* _UFS_UFS_H */
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