Commit daf342af authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'jfs-3.16' of git://github.com/kleikamp/linux-shaggy into next

Pull jfs changes from Dave Kleikamp.

* tag 'jfs-3.16' of git://github.com/kleikamp/linux-shaggy:
  fs/jfs/super.c: convert simple_str to kstr
  fs/jfs/jfs_dmap.c: replace min/casting by min_t
  fs/jfs/super.c: remove 0 assignment to static + code clean-up
  fs/jfs/jfs_logmgr.c: remove NULL assignment on static
  JFS: Check for NULL before calling posix_acl_equiv_mode()
  fs/jfs/jfs_inode.c: atomically set inode->i_flags
parents ba1bdefe bb5e50aa
...@@ -83,13 +83,15 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type, ...@@ -83,13 +83,15 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type,
switch (type) { switch (type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
ea_name = POSIX_ACL_XATTR_ACCESS; ea_name = POSIX_ACL_XATTR_ACCESS;
rc = posix_acl_equiv_mode(acl, &inode->i_mode); if (acl) {
if (rc < 0) rc = posix_acl_equiv_mode(acl, &inode->i_mode);
return rc; if (rc < 0)
inode->i_ctime = CURRENT_TIME; return rc;
mark_inode_dirty(inode); inode->i_ctime = CURRENT_TIME;
if (rc == 0) mark_inode_dirty(inode);
acl = NULL; if (rc == 0)
acl = NULL;
}
break; break;
case ACL_TYPE_DEFAULT: case ACL_TYPE_DEFAULT:
ea_name = POSIX_ACL_XATTR_DEFAULT; ea_name = POSIX_ACL_XATTR_DEFAULT;
......
...@@ -1208,7 +1208,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno, ...@@ -1208,7 +1208,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno,
* by this leaf. * by this leaf.
*/ */
l2size = l2size =
min((int)leaf[word], NLSTOL2BSZ(nwords)); min_t(int, leaf[word], NLSTOL2BSZ(nwords));
/* determine how many words were handled. /* determine how many words were handled.
*/ */
...@@ -1902,7 +1902,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results) ...@@ -1902,7 +1902,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results)
/* determine how many blocks to allocate from this dmap. /* determine how many blocks to allocate from this dmap.
*/ */
nb = min(n, (s64)BPERDMAP); nb = min_t(s64, n, BPERDMAP);
/* allocate the blocks from the dmap. /* allocate the blocks from the dmap.
*/ */
...@@ -2260,7 +2260,8 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, ...@@ -2260,7 +2260,8 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno,
* of bits being allocated and the l2 number * of bits being allocated and the l2 number
* of bits currently described by this leaf. * of bits currently described by this leaf.
*/ */
size = min((int)leaf[word], NLSTOL2BSZ(nwords)); size = min_t(int, leaf[word],
NLSTOL2BSZ(nwords));
/* update the leaf to reflect the allocation. /* update the leaf to reflect the allocation.
* in addition to setting the leaf value to * in addition to setting the leaf value to
...@@ -3563,7 +3564,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) ...@@ -3563,7 +3564,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks)
if (mp == NULL) if (mp == NULL)
goto errout; goto errout;
n = min(nblocks, (s64)BPERDMAP); n = min_t(s64, nblocks, BPERDMAP);
} }
dp = (struct dmap *) mp->data; dp = (struct dmap *) mp->data;
......
...@@ -29,20 +29,20 @@ ...@@ -29,20 +29,20 @@
void jfs_set_inode_flags(struct inode *inode) void jfs_set_inode_flags(struct inode *inode)
{ {
unsigned int flags = JFS_IP(inode)->mode2; unsigned int flags = JFS_IP(inode)->mode2;
unsigned int new_fl = 0;
inode->i_flags &= ~(S_IMMUTABLE | S_APPEND |
S_NOATIME | S_DIRSYNC | S_SYNC);
if (flags & JFS_IMMUTABLE_FL) if (flags & JFS_IMMUTABLE_FL)
inode->i_flags |= S_IMMUTABLE; new_fl |= S_IMMUTABLE;
if (flags & JFS_APPEND_FL) if (flags & JFS_APPEND_FL)
inode->i_flags |= S_APPEND; new_fl |= S_APPEND;
if (flags & JFS_NOATIME_FL) if (flags & JFS_NOATIME_FL)
inode->i_flags |= S_NOATIME; new_fl |= S_NOATIME;
if (flags & JFS_DIRSYNC_FL) if (flags & JFS_DIRSYNC_FL)
inode->i_flags |= S_DIRSYNC; new_fl |= S_DIRSYNC;
if (flags & JFS_SYNC_FL) if (flags & JFS_SYNC_FL)
inode->i_flags |= S_SYNC; new_fl |= S_SYNC;
inode_set_flags(inode, new_fl, S_IMMUTABLE | S_APPEND | S_NOATIME |
S_DIRSYNC | S_SYNC);
} }
void jfs_get_inode_flags(struct jfs_inode_info *jfs_ip) void jfs_get_inode_flags(struct jfs_inode_info *jfs_ip)
......
...@@ -167,7 +167,7 @@ do { \ ...@@ -167,7 +167,7 @@ do { \
* Global list of active external journals * Global list of active external journals
*/ */
static LIST_HEAD(jfs_external_logs); static LIST_HEAD(jfs_external_logs);
static struct jfs_log *dummy_log = NULL; static struct jfs_log *dummy_log;
static DEFINE_MUTEX(jfs_log_mutex); static DEFINE_MUTEX(jfs_log_mutex);
/* /*
......
...@@ -50,14 +50,14 @@ MODULE_DESCRIPTION("The Journaled Filesystem (JFS)"); ...@@ -50,14 +50,14 @@ MODULE_DESCRIPTION("The Journaled Filesystem (JFS)");
MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM"); MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static struct kmem_cache * jfs_inode_cachep; static struct kmem_cache *jfs_inode_cachep;
static const struct super_operations jfs_super_operations; static const struct super_operations jfs_super_operations;
static const struct export_operations jfs_export_operations; static const struct export_operations jfs_export_operations;
static struct file_system_type jfs_fs_type; static struct file_system_type jfs_fs_type;
#define MAX_COMMIT_THREADS 64 #define MAX_COMMIT_THREADS 64
static int commit_threads = 0; static int commit_threads;
module_param(commit_threads, int, 0); module_param(commit_threads, int, 0);
MODULE_PARM_DESC(commit_threads, "Number of commit threads"); MODULE_PARM_DESC(commit_threads, "Number of commit threads");
...@@ -84,8 +84,7 @@ static void jfs_handle_error(struct super_block *sb) ...@@ -84,8 +84,7 @@ static void jfs_handle_error(struct super_block *sb)
panic("JFS (device %s): panic forced after error\n", panic("JFS (device %s): panic forced after error\n",
sb->s_id); sb->s_id);
else if (sbi->flag & JFS_ERR_REMOUNT_RO) { else if (sbi->flag & JFS_ERR_REMOUNT_RO) {
jfs_err("ERROR: (device %s): remounting filesystem " jfs_err("ERROR: (device %s): remounting filesystem as read-only\n",
"as read-only\n",
sb->s_id); sb->s_id);
sb->s_flags |= MS_RDONLY; sb->s_flags |= MS_RDONLY;
} }
...@@ -273,7 +272,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, ...@@ -273,7 +272,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
case Opt_resize: case Opt_resize:
{ {
char *resize = args[0].from; char *resize = args[0].from;
*newLVSize = simple_strtoull(resize, &resize, 0); int rc = kstrtoll(resize, 0, newLVSize);
if (rc)
goto cleanup;
break; break;
} }
case Opt_resize_nosize: case Opt_resize_nosize:
...@@ -327,7 +329,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, ...@@ -327,7 +329,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
case Opt_uid: case Opt_uid:
{ {
char *uid = args[0].from; char *uid = args[0].from;
uid_t val = simple_strtoul(uid, &uid, 0); uid_t val;
int rc = kstrtouint(uid, 0, &val);
if (rc)
goto cleanup;
sbi->uid = make_kuid(current_user_ns(), val); sbi->uid = make_kuid(current_user_ns(), val);
if (!uid_valid(sbi->uid)) if (!uid_valid(sbi->uid))
goto cleanup; goto cleanup;
...@@ -337,7 +343,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, ...@@ -337,7 +343,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
case Opt_gid: case Opt_gid:
{ {
char *gid = args[0].from; char *gid = args[0].from;
gid_t val = simple_strtoul(gid, &gid, 0); gid_t val;
int rc = kstrtouint(gid, 0, &val);
if (rc)
goto cleanup;
sbi->gid = make_kgid(current_user_ns(), val); sbi->gid = make_kgid(current_user_ns(), val);
if (!gid_valid(sbi->gid)) if (!gid_valid(sbi->gid))
goto cleanup; goto cleanup;
...@@ -347,7 +357,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, ...@@ -347,7 +357,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
case Opt_umask: case Opt_umask:
{ {
char *umask = args[0].from; char *umask = args[0].from;
sbi->umask = simple_strtoul(umask, &umask, 8); int rc = kstrtouint(umask, 8, &sbi->umask);
if (rc)
goto cleanup;
if (sbi->umask & ~0777) { if (sbi->umask & ~0777) {
pr_err("JFS: Invalid value of umask\n"); pr_err("JFS: Invalid value of umask\n");
goto cleanup; goto cleanup;
...@@ -363,12 +376,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, ...@@ -363,12 +376,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
* -> user has more control over the online trimming * -> user has more control over the online trimming
*/ */
sbi->minblks_trim = 64; sbi->minblks_trim = 64;
if (blk_queue_discard(q)) { if (blk_queue_discard(q))
*flag |= JFS_DISCARD; *flag |= JFS_DISCARD;
} else { else
pr_err("JFS: discard option " \ pr_err("JFS: discard option not supported on device\n");
"not supported on device\n");
}
break; break;
} }
...@@ -380,20 +391,21 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, ...@@ -380,20 +391,21 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
{ {
struct request_queue *q = bdev_get_queue(sb->s_bdev); struct request_queue *q = bdev_get_queue(sb->s_bdev);
char *minblks_trim = args[0].from; char *minblks_trim = args[0].from;
int rc;
if (blk_queue_discard(q)) { if (blk_queue_discard(q)) {
*flag |= JFS_DISCARD; *flag |= JFS_DISCARD;
sbi->minblks_trim = simple_strtoull( rc = kstrtouint(minblks_trim, 0,
minblks_trim, &minblks_trim, 0); &sbi->minblks_trim);
} else { if (rc)
pr_err("JFS: discard option " \ goto cleanup;
"not supported on device\n"); } else
} pr_err("JFS: discard option not supported on device\n");
break; break;
} }
default: default:
printk("jfs: Unrecognized mount option \"%s\" " printk("jfs: Unrecognized mount option \"%s\" or missing value\n",
" or missing value\n", p); p);
goto cleanup; goto cleanup;
} }
} }
...@@ -419,14 +431,12 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -419,14 +431,12 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)
int ret; int ret;
sync_filesystem(sb); sync_filesystem(sb);
if (!parse_options(data, sb, &newLVSize, &flag)) { if (!parse_options(data, sb, &newLVSize, &flag))
return -EINVAL; return -EINVAL;
}
if (newLVSize) { if (newLVSize) {
if (sb->s_flags & MS_RDONLY) { if (sb->s_flags & MS_RDONLY) {
pr_err("JFS: resize requires volume" \ pr_err("JFS: resize requires volume to be mounted read-write\n");
" to be mounted read-write\n");
return -EROFS; return -EROFS;
} }
rc = jfs_extendfs(sb, newLVSize, 0); rc = jfs_extendfs(sb, newLVSize, 0);
...@@ -452,9 +462,8 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) ...@@ -452,9 +462,8 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data)
} }
if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) {
rc = dquot_suspend(sb, -1); rc = dquot_suspend(sb, -1);
if (rc < 0) { if (rc < 0)
return rc; return rc;
}
rc = jfs_umount_rw(sb); rc = jfs_umount_rw(sb);
JFS_SBI(sb)->flag = flag; JFS_SBI(sb)->flag = flag;
return rc; return rc;
...@@ -487,7 +496,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -487,7 +496,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
if (!new_valid_dev(sb->s_bdev->bd_dev)) if (!new_valid_dev(sb->s_bdev->bd_dev))
return -EOVERFLOW; return -EOVERFLOW;
sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); sbi = kzalloc(sizeof(struct jfs_sb_info), GFP_KERNEL);
if (!sbi) if (!sbi)
return -ENOMEM; return -ENOMEM;
...@@ -548,9 +557,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -548,9 +557,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
rc = jfs_mount(sb); rc = jfs_mount(sb);
if (rc) { if (rc) {
if (!silent) { if (!silent)
jfs_err("jfs_mount failed w/return code = %d", rc); jfs_err("jfs_mount failed w/return code = %d", rc);
}
goto out_mount_failed; goto out_mount_failed;
} }
if (sb->s_flags & MS_RDONLY) if (sb->s_flags & MS_RDONLY)
...@@ -587,7 +595,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -587,7 +595,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
* Page cache is indexed by long. * Page cache is indexed by long.
* I would use MAX_LFS_FILESIZE, but it's only half as big * I would use MAX_LFS_FILESIZE, but it's only half as big
*/ */
sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes); sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1,
(u64)sb->s_maxbytes);
#endif #endif
sb->s_time_gran = 1; sb->s_time_gran = 1;
return 0; return 0;
...@@ -597,9 +606,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -597,9 +606,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
out_no_rw: out_no_rw:
rc = jfs_umount(sb); rc = jfs_umount(sb);
if (rc) { if (rc)
jfs_err("jfs_umount failed with return code %d", rc); jfs_err("jfs_umount failed with return code %d", rc);
}
out_mount_failed: out_mount_failed:
filemap_write_and_wait(sbi->direct_inode->i_mapping); filemap_write_and_wait(sbi->direct_inode->i_mapping);
truncate_inode_pages(sbi->direct_inode->i_mapping, 0); truncate_inode_pages(sbi->direct_inode->i_mapping, 0);
...@@ -924,7 +932,8 @@ static int __init init_jfs_fs(void) ...@@ -924,7 +932,8 @@ static int __init init_jfs_fs(void)
commit_threads = MAX_COMMIT_THREADS; commit_threads = MAX_COMMIT_THREADS;
for (i = 0; i < commit_threads; i++) { for (i = 0; i < commit_threads; i++) {
jfsCommitThread[i] = kthread_run(jfs_lazycommit, NULL, "jfsCommit"); jfsCommitThread[i] = kthread_run(jfs_lazycommit, NULL,
"jfsCommit");
if (IS_ERR(jfsCommitThread[i])) { if (IS_ERR(jfsCommitThread[i])) {
rc = PTR_ERR(jfsCommitThread[i]); rc = PTR_ERR(jfsCommitThread[i]);
jfs_err("init_jfs_fs: fork failed w/rc = %d", rc); jfs_err("init_jfs_fs: fork failed w/rc = %d", rc);
......
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