Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

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