aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_super.c
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2014-07-14 17:37:18 -0400
committerDave Chinner <david@fromorbit.com>2014-07-14 17:37:18 -0400
commit7f8a058f6dc52219117bc2469b1fb816f7fa1a4b (patch)
tree43ce8eed4d26beb6f2acff2279c43eae7f79f83a /fs/xfs/xfs_super.c
parent03e01349c654fbdea80d3d9b4ab599244eb55bb7 (diff)
parent2451337dd043901b5270b7586942abe564443e3d (diff)
Merge branch 'xfs-libxfs-restructure' into for-next
Diffstat (limited to 'fs/xfs/xfs_super.c')
-rw-r--r--fs/xfs/xfs_super.c88
1 files changed, 44 insertions, 44 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 8f0333b3f7a0..f2e5f8a503d2 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -185,7 +185,7 @@ xfs_parseargs(
185 */ 185 */
186 mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL); 186 mp->m_fsname = kstrndup(sb->s_id, MAXNAMELEN, GFP_KERNEL);
187 if (!mp->m_fsname) 187 if (!mp->m_fsname)
188 return ENOMEM; 188 return -ENOMEM;
189 mp->m_fsname_len = strlen(mp->m_fsname) + 1; 189 mp->m_fsname_len = strlen(mp->m_fsname) + 1;
190 190
191 /* 191 /*
@@ -227,57 +227,57 @@ xfs_parseargs(
227 if (!value || !*value) { 227 if (!value || !*value) {
228 xfs_warn(mp, "%s option requires an argument", 228 xfs_warn(mp, "%s option requires an argument",
229 this_char); 229 this_char);
230 return EINVAL; 230 return -EINVAL;
231 } 231 }
232 if (kstrtoint(value, 10, &mp->m_logbufs)) 232 if (kstrtoint(value, 10, &mp->m_logbufs))
233 return EINVAL; 233 return -EINVAL;
234 } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) { 234 } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
235 if (!value || !*value) { 235 if (!value || !*value) {
236 xfs_warn(mp, "%s option requires an argument", 236 xfs_warn(mp, "%s option requires an argument",
237 this_char); 237 this_char);
238 return EINVAL; 238 return -EINVAL;
239 } 239 }
240 if (suffix_kstrtoint(value, 10, &mp->m_logbsize)) 240 if (suffix_kstrtoint(value, 10, &mp->m_logbsize))
241 return EINVAL; 241 return -EINVAL;
242 } else if (!strcmp(this_char, MNTOPT_LOGDEV)) { 242 } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
243 if (!value || !*value) { 243 if (!value || !*value) {
244 xfs_warn(mp, "%s option requires an argument", 244 xfs_warn(mp, "%s option requires an argument",
245 this_char); 245 this_char);
246 return EINVAL; 246 return -EINVAL;
247 } 247 }
248 mp->m_logname = kstrndup(value, MAXNAMELEN, GFP_KERNEL); 248 mp->m_logname = kstrndup(value, MAXNAMELEN, GFP_KERNEL);
249 if (!mp->m_logname) 249 if (!mp->m_logname)
250 return ENOMEM; 250 return -ENOMEM;
251 } else if (!strcmp(this_char, MNTOPT_MTPT)) { 251 } else if (!strcmp(this_char, MNTOPT_MTPT)) {
252 xfs_warn(mp, "%s option not allowed on this system", 252 xfs_warn(mp, "%s option not allowed on this system",
253 this_char); 253 this_char);
254 return EINVAL; 254 return -EINVAL;
255 } else if (!strcmp(this_char, MNTOPT_RTDEV)) { 255 } else if (!strcmp(this_char, MNTOPT_RTDEV)) {
256 if (!value || !*value) { 256 if (!value || !*value) {
257 xfs_warn(mp, "%s option requires an argument", 257 xfs_warn(mp, "%s option requires an argument",
258 this_char); 258 this_char);
259 return EINVAL; 259 return -EINVAL;
260 } 260 }
261 mp->m_rtname = kstrndup(value, MAXNAMELEN, GFP_KERNEL); 261 mp->m_rtname = kstrndup(value, MAXNAMELEN, GFP_KERNEL);
262 if (!mp->m_rtname) 262 if (!mp->m_rtname)
263 return ENOMEM; 263 return -ENOMEM;
264 } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) { 264 } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) {
265 if (!value || !*value) { 265 if (!value || !*value) {
266 xfs_warn(mp, "%s option requires an argument", 266 xfs_warn(mp, "%s option requires an argument",
267 this_char); 267 this_char);
268 return EINVAL; 268 return -EINVAL;
269 } 269 }
270 if (kstrtoint(value, 10, &iosize)) 270 if (kstrtoint(value, 10, &iosize))
271 return EINVAL; 271 return -EINVAL;
272 iosizelog = ffs(iosize) - 1; 272 iosizelog = ffs(iosize) - 1;
273 } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) { 273 } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
274 if (!value || !*value) { 274 if (!value || !*value) {
275 xfs_warn(mp, "%s option requires an argument", 275 xfs_warn(mp, "%s option requires an argument",
276 this_char); 276 this_char);
277 return EINVAL; 277 return -EINVAL;
278 } 278 }
279 if (suffix_kstrtoint(value, 10, &iosize)) 279 if (suffix_kstrtoint(value, 10, &iosize))
280 return EINVAL; 280 return -EINVAL;
281 iosizelog = ffs(iosize) - 1; 281 iosizelog = ffs(iosize) - 1;
282 } else if (!strcmp(this_char, MNTOPT_GRPID) || 282 } else if (!strcmp(this_char, MNTOPT_GRPID) ||
283 !strcmp(this_char, MNTOPT_BSDGROUPS)) { 283 !strcmp(this_char, MNTOPT_BSDGROUPS)) {
@@ -297,18 +297,18 @@ xfs_parseargs(
297 if (!value || !*value) { 297 if (!value || !*value) {
298 xfs_warn(mp, "%s option requires an argument", 298 xfs_warn(mp, "%s option requires an argument",
299 this_char); 299 this_char);
300 return EINVAL; 300 return -EINVAL;
301 } 301 }
302 if (kstrtoint(value, 10, &dsunit)) 302 if (kstrtoint(value, 10, &dsunit))
303 return EINVAL; 303 return -EINVAL;
304 } else if (!strcmp(this_char, MNTOPT_SWIDTH)) { 304 } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
305 if (!value || !*value) { 305 if (!value || !*value) {
306 xfs_warn(mp, "%s option requires an argument", 306 xfs_warn(mp, "%s option requires an argument",
307 this_char); 307 this_char);
308 return EINVAL; 308 return -EINVAL;
309 } 309 }
310 if (kstrtoint(value, 10, &dswidth)) 310 if (kstrtoint(value, 10, &dswidth))
311 return EINVAL; 311 return -EINVAL;
312 } else if (!strcmp(this_char, MNTOPT_32BITINODE)) { 312 } else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
313 mp->m_flags |= XFS_MOUNT_SMALL_INUMS; 313 mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
314 } else if (!strcmp(this_char, MNTOPT_64BITINODE)) { 314 } else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
@@ -316,7 +316,7 @@ xfs_parseargs(
316#if !XFS_BIG_INUMS 316#if !XFS_BIG_INUMS
317 xfs_warn(mp, "%s option not allowed on this system", 317 xfs_warn(mp, "%s option not allowed on this system",
318 this_char); 318 this_char);
319 return EINVAL; 319 return -EINVAL;
320#endif 320#endif
321 } else if (!strcmp(this_char, MNTOPT_NOUUID)) { 321 } else if (!strcmp(this_char, MNTOPT_NOUUID)) {
322 mp->m_flags |= XFS_MOUNT_NOUUID; 322 mp->m_flags |= XFS_MOUNT_NOUUID;
@@ -390,7 +390,7 @@ xfs_parseargs(
390 "irixsgid is now a sysctl(2) variable, option is deprecated."); 390 "irixsgid is now a sysctl(2) variable, option is deprecated.");
391 } else { 391 } else {
392 xfs_warn(mp, "unknown mount option [%s].", this_char); 392 xfs_warn(mp, "unknown mount option [%s].", this_char);
393 return EINVAL; 393 return -EINVAL;
394 } 394 }
395 } 395 }
396 396
@@ -400,32 +400,32 @@ xfs_parseargs(
400 if ((mp->m_flags & XFS_MOUNT_NORECOVERY) && 400 if ((mp->m_flags & XFS_MOUNT_NORECOVERY) &&
401 !(mp->m_flags & XFS_MOUNT_RDONLY)) { 401 !(mp->m_flags & XFS_MOUNT_RDONLY)) {
402 xfs_warn(mp, "no-recovery mounts must be read-only."); 402 xfs_warn(mp, "no-recovery mounts must be read-only.");
403 return EINVAL; 403 return -EINVAL;
404 } 404 }
405 405
406 if ((mp->m_flags & XFS_MOUNT_NOALIGN) && (dsunit || dswidth)) { 406 if ((mp->m_flags & XFS_MOUNT_NOALIGN) && (dsunit || dswidth)) {
407 xfs_warn(mp, 407 xfs_warn(mp,
408 "sunit and swidth options incompatible with the noalign option"); 408 "sunit and swidth options incompatible with the noalign option");
409 return EINVAL; 409 return -EINVAL;
410 } 410 }
411 411
412#ifndef CONFIG_XFS_QUOTA 412#ifndef CONFIG_XFS_QUOTA
413 if (XFS_IS_QUOTA_RUNNING(mp)) { 413 if (XFS_IS_QUOTA_RUNNING(mp)) {
414 xfs_warn(mp, "quota support not available in this kernel."); 414 xfs_warn(mp, "quota support not available in this kernel.");
415 return EINVAL; 415 return -EINVAL;
416 } 416 }
417#endif 417#endif
418 418
419 if ((dsunit && !dswidth) || (!dsunit && dswidth)) { 419 if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
420 xfs_warn(mp, "sunit and swidth must be specified together"); 420 xfs_warn(mp, "sunit and swidth must be specified together");
421 return EINVAL; 421 return -EINVAL;
422 } 422 }
423 423
424 if (dsunit && (dswidth % dsunit != 0)) { 424 if (dsunit && (dswidth % dsunit != 0)) {
425 xfs_warn(mp, 425 xfs_warn(mp,
426 "stripe width (%d) must be a multiple of the stripe unit (%d)", 426 "stripe width (%d) must be a multiple of the stripe unit (%d)",
427 dswidth, dsunit); 427 dswidth, dsunit);
428 return EINVAL; 428 return -EINVAL;
429 } 429 }
430 430
431done: 431done:
@@ -446,7 +446,7 @@ done:
446 mp->m_logbufs > XLOG_MAX_ICLOGS)) { 446 mp->m_logbufs > XLOG_MAX_ICLOGS)) {
447 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]", 447 xfs_warn(mp, "invalid logbufs value: %d [not %d-%d]",
448 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS); 448 mp->m_logbufs, XLOG_MIN_ICLOGS, XLOG_MAX_ICLOGS);
449 return XFS_ERROR(EINVAL); 449 return -EINVAL;
450 } 450 }
451 if (mp->m_logbsize != -1 && 451 if (mp->m_logbsize != -1 &&
452 mp->m_logbsize != 0 && 452 mp->m_logbsize != 0 &&
@@ -456,7 +456,7 @@ done:
456 xfs_warn(mp, 456 xfs_warn(mp,
457 "invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]", 457 "invalid logbufsize: %d [not 16k,32k,64k,128k or 256k]",
458 mp->m_logbsize); 458 mp->m_logbsize);
459 return XFS_ERROR(EINVAL); 459 return -EINVAL;
460 } 460 }
461 461
462 if (iosizelog) { 462 if (iosizelog) {
@@ -465,7 +465,7 @@ done:
465 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]", 465 xfs_warn(mp, "invalid log iosize: %d [not %d-%d]",
466 iosizelog, XFS_MIN_IO_LOG, 466 iosizelog, XFS_MIN_IO_LOG,
467 XFS_MAX_IO_LOG); 467 XFS_MAX_IO_LOG);
468 return XFS_ERROR(EINVAL); 468 return -EINVAL;
469 } 469 }
470 470
471 mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE; 471 mp->m_flags |= XFS_MOUNT_DFLT_IOSIZE;
@@ -686,7 +686,7 @@ xfs_blkdev_get(
686 xfs_warn(mp, "Invalid device [%s], error=%d\n", name, error); 686 xfs_warn(mp, "Invalid device [%s], error=%d\n", name, error);
687 } 687 }
688 688
689 return -error; 689 return error;
690} 690}
691 691
692STATIC void 692STATIC void
@@ -756,7 +756,7 @@ xfs_open_devices(
756 if (rtdev == ddev || rtdev == logdev) { 756 if (rtdev == ddev || rtdev == logdev) {
757 xfs_warn(mp, 757 xfs_warn(mp,
758 "Cannot mount filesystem with identical rtdev and ddev/logdev."); 758 "Cannot mount filesystem with identical rtdev and ddev/logdev.");
759 error = EINVAL; 759 error = -EINVAL;
760 goto out_close_rtdev; 760 goto out_close_rtdev;
761 } 761 }
762 } 762 }
@@ -764,7 +764,7 @@ xfs_open_devices(
764 /* 764 /*
765 * Setup xfs_mount buffer target pointers 765 * Setup xfs_mount buffer target pointers
766 */ 766 */
767 error = ENOMEM; 767 error = -ENOMEM;
768 mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev); 768 mp->m_ddev_targp = xfs_alloc_buftarg(mp, ddev);
769 if (!mp->m_ddev_targp) 769 if (!mp->m_ddev_targp)
770 goto out_close_rtdev; 770 goto out_close_rtdev;
@@ -1295,7 +1295,7 @@ xfs_fs_freeze(
1295 1295
1296 xfs_save_resvblks(mp); 1296 xfs_save_resvblks(mp);
1297 xfs_quiesce_attr(mp); 1297 xfs_quiesce_attr(mp);
1298 return -xfs_fs_log_dummy(mp); 1298 return xfs_fs_log_dummy(mp);
1299} 1299}
1300 1300
1301STATIC int 1301STATIC int
@@ -1314,7 +1314,7 @@ xfs_fs_show_options(
1314 struct seq_file *m, 1314 struct seq_file *m,
1315 struct dentry *root) 1315 struct dentry *root)
1316{ 1316{
1317 return -xfs_showargs(XFS_M(root->d_sb), m); 1317 return xfs_showargs(XFS_M(root->d_sb), m);
1318} 1318}
1319 1319
1320/* 1320/*
@@ -1336,14 +1336,14 @@ xfs_finish_flags(
1336 mp->m_logbsize < mp->m_sb.sb_logsunit) { 1336 mp->m_logbsize < mp->m_sb.sb_logsunit) {
1337 xfs_warn(mp, 1337 xfs_warn(mp,
1338 "logbuf size must be greater than or equal to log stripe size"); 1338 "logbuf size must be greater than or equal to log stripe size");
1339 return XFS_ERROR(EINVAL); 1339 return -EINVAL;
1340 } 1340 }
1341 } else { 1341 } else {
1342 /* Fail a mount if the logbuf is larger than 32K */ 1342 /* Fail a mount if the logbuf is larger than 32K */
1343 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) { 1343 if (mp->m_logbsize > XLOG_BIG_RECORD_BSIZE) {
1344 xfs_warn(mp, 1344 xfs_warn(mp,
1345 "logbuf size for version 1 logs must be 16K or 32K"); 1345 "logbuf size for version 1 logs must be 16K or 32K");
1346 return XFS_ERROR(EINVAL); 1346 return -EINVAL;
1347 } 1347 }
1348 } 1348 }
1349 1349
@@ -1355,7 +1355,7 @@ xfs_finish_flags(
1355 xfs_warn(mp, 1355 xfs_warn(mp,
1356"Cannot mount a V5 filesystem as %s. %s is always enabled for V5 filesystems.", 1356"Cannot mount a V5 filesystem as %s. %s is always enabled for V5 filesystems.",
1357 MNTOPT_NOATTR2, MNTOPT_ATTR2); 1357 MNTOPT_NOATTR2, MNTOPT_ATTR2);
1358 return XFS_ERROR(EINVAL); 1358 return -EINVAL;
1359 } 1359 }
1360 1360
1361 /* 1361 /*
@@ -1372,7 +1372,7 @@ xfs_finish_flags(
1372 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !ronly) { 1372 if ((mp->m_sb.sb_flags & XFS_SBF_READONLY) && !ronly) {
1373 xfs_warn(mp, 1373 xfs_warn(mp,
1374 "cannot mount a read-only filesystem as read-write"); 1374 "cannot mount a read-only filesystem as read-write");
1375 return XFS_ERROR(EROFS); 1375 return -EROFS;
1376 } 1376 }
1377 1377
1378 if ((mp->m_qflags & (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE)) && 1378 if ((mp->m_qflags & (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE)) &&
@@ -1380,7 +1380,7 @@ xfs_finish_flags(
1380 !xfs_sb_version_has_pquotino(&mp->m_sb)) { 1380 !xfs_sb_version_has_pquotino(&mp->m_sb)) {
1381 xfs_warn(mp, 1381 xfs_warn(mp,
1382 "Super block does not support project and group quota together"); 1382 "Super block does not support project and group quota together");
1383 return XFS_ERROR(EINVAL); 1383 return -EINVAL;
1384 } 1384 }
1385 1385
1386 return 0; 1386 return 0;
@@ -1394,7 +1394,7 @@ xfs_fs_fill_super(
1394{ 1394{
1395 struct inode *root; 1395 struct inode *root;
1396 struct xfs_mount *mp = NULL; 1396 struct xfs_mount *mp = NULL;
1397 int flags = 0, error = ENOMEM; 1397 int flags = 0, error = -ENOMEM;
1398 1398
1399 mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL); 1399 mp = kzalloc(sizeof(struct xfs_mount), GFP_KERNEL);
1400 if (!mp) 1400 if (!mp)
@@ -1428,11 +1428,11 @@ xfs_fs_fill_super(
1428 if (error) 1428 if (error)
1429 goto out_free_fsname; 1429 goto out_free_fsname;
1430 1430
1431 error = -xfs_init_mount_workqueues(mp); 1431 error = xfs_init_mount_workqueues(mp);
1432 if (error) 1432 if (error)
1433 goto out_close_devices; 1433 goto out_close_devices;
1434 1434
1435 error = -xfs_icsb_init_counters(mp); 1435 error = xfs_icsb_init_counters(mp);
1436 if (error) 1436 if (error)
1437 goto out_destroy_workqueues; 1437 goto out_destroy_workqueues;
1438 1438
@@ -1474,12 +1474,12 @@ xfs_fs_fill_super(
1474 1474
1475 root = igrab(VFS_I(mp->m_rootip)); 1475 root = igrab(VFS_I(mp->m_rootip));
1476 if (!root) { 1476 if (!root) {
1477 error = ENOENT; 1477 error = -ENOENT;
1478 goto out_unmount; 1478 goto out_unmount;
1479 } 1479 }
1480 sb->s_root = d_make_root(root); 1480 sb->s_root = d_make_root(root);
1481 if (!sb->s_root) { 1481 if (!sb->s_root) {
1482 error = ENOMEM; 1482 error = -ENOMEM;
1483 goto out_unmount; 1483 goto out_unmount;
1484 } 1484 }
1485 1485
@@ -1499,7 +1499,7 @@ out_destroy_workqueues:
1499 xfs_free_fsname(mp); 1499 xfs_free_fsname(mp);
1500 kfree(mp); 1500 kfree(mp);
1501 out: 1501 out:
1502 return -error; 1502 return error;
1503 1503
1504 out_unmount: 1504 out_unmount:
1505 xfs_filestream_unmount(mp); 1505 xfs_filestream_unmount(mp);