diff options
| -rw-r--r-- | fs/jfs/acl.c | 16 | ||||
| -rw-r--r-- | fs/jfs/jfs_dmap.c | 9 | ||||
| -rw-r--r-- | fs/jfs/jfs_inode.c | 16 | ||||
| -rw-r--r-- | fs/jfs/jfs_logmgr.c | 2 | ||||
| -rw-r--r-- | fs/jfs/super.c | 77 |
5 files changed, 66 insertions, 54 deletions
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c index 5a8ea16eedbc..0c8ca830b113 100644 --- a/fs/jfs/acl.c +++ b/fs/jfs/acl.c | |||
| @@ -83,13 +83,15 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type, | |||
| 83 | switch (type) { | 83 | switch (type) { |
| 84 | case ACL_TYPE_ACCESS: | 84 | case ACL_TYPE_ACCESS: |
| 85 | ea_name = POSIX_ACL_XATTR_ACCESS; | 85 | ea_name = POSIX_ACL_XATTR_ACCESS; |
| 86 | rc = posix_acl_equiv_mode(acl, &inode->i_mode); | 86 | if (acl) { |
| 87 | if (rc < 0) | 87 | rc = posix_acl_equiv_mode(acl, &inode->i_mode); |
| 88 | return rc; | 88 | if (rc < 0) |
| 89 | inode->i_ctime = CURRENT_TIME; | 89 | return rc; |
| 90 | mark_inode_dirty(inode); | 90 | inode->i_ctime = CURRENT_TIME; |
| 91 | if (rc == 0) | 91 | mark_inode_dirty(inode); |
| 92 | acl = NULL; | 92 | if (rc == 0) |
| 93 | acl = NULL; | ||
| 94 | } | ||
| 93 | break; | 95 | break; |
| 94 | case ACL_TYPE_DEFAULT: | 96 | case ACL_TYPE_DEFAULT: |
| 95 | ea_name = POSIX_ACL_XATTR_DEFAULT; | 97 | ea_name = POSIX_ACL_XATTR_DEFAULT; |
diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c index 370d7b6c5942..2d514c7affc2 100644 --- a/fs/jfs/jfs_dmap.c +++ b/fs/jfs/jfs_dmap.c | |||
| @@ -1208,7 +1208,7 @@ static int dbAllocNext(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
| 1208 | * by this leaf. | 1208 | * by this leaf. |
| 1209 | */ | 1209 | */ |
| 1210 | l2size = | 1210 | l2size = |
| 1211 | min((int)leaf[word], NLSTOL2BSZ(nwords)); | 1211 | min_t(int, leaf[word], NLSTOL2BSZ(nwords)); |
| 1212 | 1212 | ||
| 1213 | /* determine how many words were handled. | 1213 | /* determine how many words were handled. |
| 1214 | */ | 1214 | */ |
| @@ -1902,7 +1902,7 @@ dbAllocCtl(struct bmap * bmp, s64 nblocks, int l2nb, s64 blkno, s64 * results) | |||
| 1902 | 1902 | ||
| 1903 | /* determine how many blocks to allocate from this dmap. | 1903 | /* determine how many blocks to allocate from this dmap. |
| 1904 | */ | 1904 | */ |
| 1905 | nb = min(n, (s64)BPERDMAP); | 1905 | nb = min_t(s64, n, BPERDMAP); |
| 1906 | 1906 | ||
| 1907 | /* allocate the blocks from the dmap. | 1907 | /* allocate the blocks from the dmap. |
| 1908 | */ | 1908 | */ |
| @@ -2260,7 +2260,8 @@ static void dbAllocBits(struct bmap * bmp, struct dmap * dp, s64 blkno, | |||
| 2260 | * of bits being allocated and the l2 number | 2260 | * of bits being allocated and the l2 number |
| 2261 | * of bits currently described by this leaf. | 2261 | * of bits currently described by this leaf. |
| 2262 | */ | 2262 | */ |
| 2263 | size = min((int)leaf[word], NLSTOL2BSZ(nwords)); | 2263 | size = min_t(int, leaf[word], |
| 2264 | NLSTOL2BSZ(nwords)); | ||
| 2264 | 2265 | ||
| 2265 | /* update the leaf to reflect the allocation. | 2266 | /* update the leaf to reflect the allocation. |
| 2266 | * in addition to setting the leaf value to | 2267 | * in addition to setting the leaf value to |
| @@ -3563,7 +3564,7 @@ int dbExtendFS(struct inode *ipbmap, s64 blkno, s64 nblocks) | |||
| 3563 | if (mp == NULL) | 3564 | if (mp == NULL) |
| 3564 | goto errout; | 3565 | goto errout; |
| 3565 | 3566 | ||
| 3566 | n = min(nblocks, (s64)BPERDMAP); | 3567 | n = min_t(s64, nblocks, BPERDMAP); |
| 3567 | } | 3568 | } |
| 3568 | 3569 | ||
| 3569 | dp = (struct dmap *) mp->data; | 3570 | dp = (struct dmap *) mp->data; |
diff --git a/fs/jfs/jfs_inode.c b/fs/jfs/jfs_inode.c index 7f464c513ba0..6b0f816201a2 100644 --- a/fs/jfs/jfs_inode.c +++ b/fs/jfs/jfs_inode.c | |||
| @@ -29,20 +29,20 @@ | |||
| 29 | void jfs_set_inode_flags(struct inode *inode) | 29 | void jfs_set_inode_flags(struct inode *inode) |
| 30 | { | 30 | { |
| 31 | unsigned int flags = JFS_IP(inode)->mode2; | 31 | unsigned int flags = JFS_IP(inode)->mode2; |
| 32 | 32 | unsigned int new_fl = 0; | |
| 33 | inode->i_flags &= ~(S_IMMUTABLE | S_APPEND | | ||
| 34 | S_NOATIME | S_DIRSYNC | S_SYNC); | ||
| 35 | 33 | ||
| 36 | if (flags & JFS_IMMUTABLE_FL) | 34 | if (flags & JFS_IMMUTABLE_FL) |
| 37 | inode->i_flags |= S_IMMUTABLE; | 35 | new_fl |= S_IMMUTABLE; |
| 38 | if (flags & JFS_APPEND_FL) | 36 | if (flags & JFS_APPEND_FL) |
| 39 | inode->i_flags |= S_APPEND; | 37 | new_fl |= S_APPEND; |
| 40 | if (flags & JFS_NOATIME_FL) | 38 | if (flags & JFS_NOATIME_FL) |
| 41 | inode->i_flags |= S_NOATIME; | 39 | new_fl |= S_NOATIME; |
| 42 | if (flags & JFS_DIRSYNC_FL) | 40 | if (flags & JFS_DIRSYNC_FL) |
| 43 | inode->i_flags |= S_DIRSYNC; | 41 | new_fl |= S_DIRSYNC; |
| 44 | if (flags & JFS_SYNC_FL) | 42 | if (flags & JFS_SYNC_FL) |
| 45 | inode->i_flags |= S_SYNC; | 43 | new_fl |= S_SYNC; |
| 44 | inode_set_flags(inode, new_fl, S_IMMUTABLE | S_APPEND | S_NOATIME | | ||
| 45 | S_DIRSYNC | S_SYNC); | ||
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | void jfs_get_inode_flags(struct jfs_inode_info *jfs_ip) | 48 | void jfs_get_inode_flags(struct jfs_inode_info *jfs_ip) |
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 8d811e02b4b9..0acddf60af55 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
| @@ -167,7 +167,7 @@ do { \ | |||
| 167 | * Global list of active external journals | 167 | * Global list of active external journals |
| 168 | */ | 168 | */ |
| 169 | static LIST_HEAD(jfs_external_logs); | 169 | static LIST_HEAD(jfs_external_logs); |
| 170 | static struct jfs_log *dummy_log = NULL; | 170 | static struct jfs_log *dummy_log; |
| 171 | static DEFINE_MUTEX(jfs_log_mutex); | 171 | static DEFINE_MUTEX(jfs_log_mutex); |
| 172 | 172 | ||
| 173 | /* | 173 | /* |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 97f7fda51890..adf8cb045b9e 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
| @@ -50,14 +50,14 @@ MODULE_DESCRIPTION("The Journaled Filesystem (JFS)"); | |||
| 50 | MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM"); | 50 | MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM"); |
| 51 | MODULE_LICENSE("GPL"); | 51 | MODULE_LICENSE("GPL"); |
| 52 | 52 | ||
| 53 | static struct kmem_cache * jfs_inode_cachep; | 53 | static struct kmem_cache *jfs_inode_cachep; |
| 54 | 54 | ||
| 55 | static const struct super_operations jfs_super_operations; | 55 | static const struct super_operations jfs_super_operations; |
| 56 | static const struct export_operations jfs_export_operations; | 56 | static const struct export_operations jfs_export_operations; |
| 57 | static struct file_system_type jfs_fs_type; | 57 | static struct file_system_type jfs_fs_type; |
| 58 | 58 | ||
| 59 | #define MAX_COMMIT_THREADS 64 | 59 | #define MAX_COMMIT_THREADS 64 |
| 60 | static int commit_threads = 0; | 60 | static int commit_threads; |
| 61 | module_param(commit_threads, int, 0); | 61 | module_param(commit_threads, int, 0); |
| 62 | MODULE_PARM_DESC(commit_threads, "Number of commit threads"); | 62 | MODULE_PARM_DESC(commit_threads, "Number of commit threads"); |
| 63 | 63 | ||
| @@ -84,8 +84,7 @@ static void jfs_handle_error(struct super_block *sb) | |||
| 84 | panic("JFS (device %s): panic forced after error\n", | 84 | panic("JFS (device %s): panic forced after error\n", |
| 85 | sb->s_id); | 85 | sb->s_id); |
| 86 | else if (sbi->flag & JFS_ERR_REMOUNT_RO) { | 86 | else if (sbi->flag & JFS_ERR_REMOUNT_RO) { |
| 87 | jfs_err("ERROR: (device %s): remounting filesystem " | 87 | jfs_err("ERROR: (device %s): remounting filesystem as read-only\n", |
| 88 | "as read-only\n", | ||
| 89 | sb->s_id); | 88 | sb->s_id); |
| 90 | sb->s_flags |= MS_RDONLY; | 89 | sb->s_flags |= MS_RDONLY; |
| 91 | } | 90 | } |
| @@ -273,7 +272,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
| 273 | case Opt_resize: | 272 | case Opt_resize: |
| 274 | { | 273 | { |
| 275 | char *resize = args[0].from; | 274 | char *resize = args[0].from; |
| 276 | *newLVSize = simple_strtoull(resize, &resize, 0); | 275 | int rc = kstrtoll(resize, 0, newLVSize); |
| 276 | |||
| 277 | if (rc) | ||
| 278 | goto cleanup; | ||
| 277 | break; | 279 | break; |
| 278 | } | 280 | } |
| 279 | case Opt_resize_nosize: | 281 | case Opt_resize_nosize: |
| @@ -327,7 +329,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
| 327 | case Opt_uid: | 329 | case Opt_uid: |
| 328 | { | 330 | { |
| 329 | char *uid = args[0].from; | 331 | char *uid = args[0].from; |
| 330 | uid_t val = simple_strtoul(uid, &uid, 0); | 332 | uid_t val; |
| 333 | int rc = kstrtouint(uid, 0, &val); | ||
| 334 | |||
| 335 | if (rc) | ||
| 336 | goto cleanup; | ||
| 331 | sbi->uid = make_kuid(current_user_ns(), val); | 337 | sbi->uid = make_kuid(current_user_ns(), val); |
| 332 | if (!uid_valid(sbi->uid)) | 338 | if (!uid_valid(sbi->uid)) |
| 333 | goto cleanup; | 339 | goto cleanup; |
| @@ -337,7 +343,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
| 337 | case Opt_gid: | 343 | case Opt_gid: |
| 338 | { | 344 | { |
| 339 | char *gid = args[0].from; | 345 | char *gid = args[0].from; |
| 340 | gid_t val = simple_strtoul(gid, &gid, 0); | 346 | gid_t val; |
| 347 | int rc = kstrtouint(gid, 0, &val); | ||
| 348 | |||
| 349 | if (rc) | ||
| 350 | goto cleanup; | ||
| 341 | sbi->gid = make_kgid(current_user_ns(), val); | 351 | sbi->gid = make_kgid(current_user_ns(), val); |
| 342 | if (!gid_valid(sbi->gid)) | 352 | if (!gid_valid(sbi->gid)) |
| 343 | goto cleanup; | 353 | goto cleanup; |
| @@ -347,7 +357,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
| 347 | case Opt_umask: | 357 | case Opt_umask: |
| 348 | { | 358 | { |
| 349 | char *umask = args[0].from; | 359 | char *umask = args[0].from; |
| 350 | sbi->umask = simple_strtoul(umask, &umask, 8); | 360 | int rc = kstrtouint(umask, 8, &sbi->umask); |
| 361 | |||
| 362 | if (rc) | ||
| 363 | goto cleanup; | ||
| 351 | if (sbi->umask & ~0777) { | 364 | if (sbi->umask & ~0777) { |
| 352 | pr_err("JFS: Invalid value of umask\n"); | 365 | pr_err("JFS: Invalid value of umask\n"); |
| 353 | goto cleanup; | 366 | goto cleanup; |
| @@ -363,12 +376,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
| 363 | * -> user has more control over the online trimming | 376 | * -> user has more control over the online trimming |
| 364 | */ | 377 | */ |
| 365 | sbi->minblks_trim = 64; | 378 | sbi->minblks_trim = 64; |
| 366 | if (blk_queue_discard(q)) { | 379 | if (blk_queue_discard(q)) |
| 367 | *flag |= JFS_DISCARD; | 380 | *flag |= JFS_DISCARD; |
| 368 | } else { | 381 | else |
| 369 | pr_err("JFS: discard option " \ | 382 | pr_err("JFS: discard option not supported on device\n"); |
| 370 | "not supported on device\n"); | ||
| 371 | } | ||
| 372 | break; | 383 | break; |
| 373 | } | 384 | } |
| 374 | 385 | ||
| @@ -380,20 +391,21 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize, | |||
| 380 | { | 391 | { |
| 381 | struct request_queue *q = bdev_get_queue(sb->s_bdev); | 392 | struct request_queue *q = bdev_get_queue(sb->s_bdev); |
| 382 | char *minblks_trim = args[0].from; | 393 | char *minblks_trim = args[0].from; |
| 394 | int rc; | ||
| 383 | if (blk_queue_discard(q)) { | 395 | if (blk_queue_discard(q)) { |
| 384 | *flag |= JFS_DISCARD; | 396 | *flag |= JFS_DISCARD; |
| 385 | sbi->minblks_trim = simple_strtoull( | 397 | rc = kstrtouint(minblks_trim, 0, |
| 386 | minblks_trim, &minblks_trim, 0); | 398 | &sbi->minblks_trim); |
| 387 | } else { | 399 | if (rc) |
| 388 | pr_err("JFS: discard option " \ | 400 | goto cleanup; |
| 389 | "not supported on device\n"); | 401 | } else |
| 390 | } | 402 | pr_err("JFS: discard option not supported on device\n"); |
| 391 | break; | 403 | break; |
| 392 | } | 404 | } |
| 393 | 405 | ||
| 394 | default: | 406 | default: |
| 395 | printk("jfs: Unrecognized mount option \"%s\" " | 407 | printk("jfs: Unrecognized mount option \"%s\" or missing value\n", |
| 396 | " or missing value\n", p); | 408 | p); |
| 397 | goto cleanup; | 409 | goto cleanup; |
| 398 | } | 410 | } |
| 399 | } | 411 | } |
| @@ -419,14 +431,12 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | |||
| 419 | int ret; | 431 | int ret; |
| 420 | 432 | ||
| 421 | sync_filesystem(sb); | 433 | sync_filesystem(sb); |
| 422 | if (!parse_options(data, sb, &newLVSize, &flag)) { | 434 | if (!parse_options(data, sb, &newLVSize, &flag)) |
| 423 | return -EINVAL; | 435 | return -EINVAL; |
| 424 | } | ||
| 425 | 436 | ||
| 426 | if (newLVSize) { | 437 | if (newLVSize) { |
| 427 | if (sb->s_flags & MS_RDONLY) { | 438 | if (sb->s_flags & MS_RDONLY) { |
| 428 | pr_err("JFS: resize requires volume" \ | 439 | pr_err("JFS: resize requires volume to be mounted read-write\n"); |
| 429 | " to be mounted read-write\n"); | ||
| 430 | return -EROFS; | 440 | return -EROFS; |
| 431 | } | 441 | } |
| 432 | rc = jfs_extendfs(sb, newLVSize, 0); | 442 | rc = jfs_extendfs(sb, newLVSize, 0); |
| @@ -452,9 +462,8 @@ static int jfs_remount(struct super_block *sb, int *flags, char *data) | |||
| 452 | } | 462 | } |
| 453 | if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { | 463 | if ((!(sb->s_flags & MS_RDONLY)) && (*flags & MS_RDONLY)) { |
| 454 | rc = dquot_suspend(sb, -1); | 464 | rc = dquot_suspend(sb, -1); |
| 455 | if (rc < 0) { | 465 | if (rc < 0) |
| 456 | return rc; | 466 | return rc; |
| 457 | } | ||
| 458 | rc = jfs_umount_rw(sb); | 467 | rc = jfs_umount_rw(sb); |
| 459 | JFS_SBI(sb)->flag = flag; | 468 | JFS_SBI(sb)->flag = flag; |
| 460 | return rc; | 469 | return rc; |
| @@ -487,7 +496,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 487 | if (!new_valid_dev(sb->s_bdev->bd_dev)) | 496 | if (!new_valid_dev(sb->s_bdev->bd_dev)) |
| 488 | return -EOVERFLOW; | 497 | return -EOVERFLOW; |
| 489 | 498 | ||
| 490 | sbi = kzalloc(sizeof (struct jfs_sb_info), GFP_KERNEL); | 499 | sbi = kzalloc(sizeof(struct jfs_sb_info), GFP_KERNEL); |
| 491 | if (!sbi) | 500 | if (!sbi) |
| 492 | return -ENOMEM; | 501 | return -ENOMEM; |
| 493 | 502 | ||
| @@ -548,9 +557,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 548 | 557 | ||
| 549 | rc = jfs_mount(sb); | 558 | rc = jfs_mount(sb); |
| 550 | if (rc) { | 559 | if (rc) { |
| 551 | if (!silent) { | 560 | if (!silent) |
| 552 | jfs_err("jfs_mount failed w/return code = %d", rc); | 561 | jfs_err("jfs_mount failed w/return code = %d", rc); |
| 553 | } | ||
| 554 | goto out_mount_failed; | 562 | goto out_mount_failed; |
| 555 | } | 563 | } |
| 556 | if (sb->s_flags & MS_RDONLY) | 564 | if (sb->s_flags & MS_RDONLY) |
| @@ -587,7 +595,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 587 | * Page cache is indexed by long. | 595 | * Page cache is indexed by long. |
| 588 | * I would use MAX_LFS_FILESIZE, but it's only half as big | 596 | * I would use MAX_LFS_FILESIZE, but it's only half as big |
| 589 | */ | 597 | */ |
| 590 | sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, (u64)sb->s_maxbytes); | 598 | sb->s_maxbytes = min(((u64) PAGE_CACHE_SIZE << 32) - 1, |
| 599 | (u64)sb->s_maxbytes); | ||
| 591 | #endif | 600 | #endif |
| 592 | sb->s_time_gran = 1; | 601 | sb->s_time_gran = 1; |
| 593 | return 0; | 602 | return 0; |
| @@ -597,9 +606,8 @@ out_no_root: | |||
| 597 | 606 | ||
| 598 | out_no_rw: | 607 | out_no_rw: |
| 599 | rc = jfs_umount(sb); | 608 | rc = jfs_umount(sb); |
| 600 | if (rc) { | 609 | if (rc) |
| 601 | jfs_err("jfs_umount failed with return code %d", rc); | 610 | jfs_err("jfs_umount failed with return code %d", rc); |
| 602 | } | ||
| 603 | out_mount_failed: | 611 | out_mount_failed: |
| 604 | filemap_write_and_wait(sbi->direct_inode->i_mapping); | 612 | filemap_write_and_wait(sbi->direct_inode->i_mapping); |
| 605 | truncate_inode_pages(sbi->direct_inode->i_mapping, 0); | 613 | truncate_inode_pages(sbi->direct_inode->i_mapping, 0); |
| @@ -924,7 +932,8 @@ static int __init init_jfs_fs(void) | |||
| 924 | commit_threads = MAX_COMMIT_THREADS; | 932 | commit_threads = MAX_COMMIT_THREADS; |
| 925 | 933 | ||
| 926 | for (i = 0; i < commit_threads; i++) { | 934 | for (i = 0; i < commit_threads; i++) { |
| 927 | jfsCommitThread[i] = kthread_run(jfs_lazycommit, NULL, "jfsCommit"); | 935 | jfsCommitThread[i] = kthread_run(jfs_lazycommit, NULL, |
| 936 | "jfsCommit"); | ||
| 928 | if (IS_ERR(jfsCommitThread[i])) { | 937 | if (IS_ERR(jfsCommitThread[i])) { |
| 929 | rc = PTR_ERR(jfsCommitThread[i]); | 938 | rc = PTR_ERR(jfsCommitThread[i]); |
| 930 | jfs_err("init_jfs_fs: fork failed w/rc = %d", rc); | 939 | jfs_err("init_jfs_fs: fork failed w/rc = %d", rc); |
