diff options
author | Dave Chinner <dchinner@redhat.com> | 2014-06-25 00:58:08 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-06-25 00:58:08 -0400 |
commit | 2451337dd043901b5270b7586942abe564443e3d (patch) | |
tree | 5f2a59b2c829dbb942c18315ffc0edfed0d3790a /fs/xfs/xfs_mount.c | |
parent | 30f712c9dd69348aa51351d5cb6d366bf4fae31d (diff) |
xfs: global error sign conversion
Convert all the errors the core XFs code to negative error signs
like the rest of the kernel and remove all the sign conversion we
do in the interface layers.
Errors for conversion (and comparison) found via searches like:
$ git grep " E" fs/xfs
$ git grep "return E" fs/xfs
$ git grep " E[A-Z].*;$" fs/xfs
Negation points found via searches like:
$ git grep "= -[a-z,A-Z]" fs/xfs
$ git grep "return -[a-z,A-D,F-Z]" fs/xfs
$ git grep " -[a-z].*;" fs/xfs
[ with some bits I missed from Brian Foster ]
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index b50ec92f9620..d5c44a6bdb5b 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -76,7 +76,7 @@ xfs_uuid_mount( | |||
76 | 76 | ||
77 | if (uuid_is_nil(uuid)) { | 77 | if (uuid_is_nil(uuid)) { |
78 | xfs_warn(mp, "Filesystem has nil UUID - can't mount"); | 78 | xfs_warn(mp, "Filesystem has nil UUID - can't mount"); |
79 | return EINVAL; | 79 | return -EINVAL; |
80 | } | 80 | } |
81 | 81 | ||
82 | mutex_lock(&xfs_uuid_table_mutex); | 82 | mutex_lock(&xfs_uuid_table_mutex); |
@@ -104,7 +104,7 @@ xfs_uuid_mount( | |||
104 | out_duplicate: | 104 | out_duplicate: |
105 | mutex_unlock(&xfs_uuid_table_mutex); | 105 | mutex_unlock(&xfs_uuid_table_mutex); |
106 | xfs_warn(mp, "Filesystem has duplicate UUID %pU - can't mount", uuid); | 106 | xfs_warn(mp, "Filesystem has duplicate UUID %pU - can't mount", uuid); |
107 | return EINVAL; | 107 | return -EINVAL; |
108 | } | 108 | } |
109 | 109 | ||
110 | STATIC void | 110 | STATIC void |
@@ -175,10 +175,10 @@ xfs_sb_validate_fsb_count( | |||
175 | 175 | ||
176 | #if XFS_BIG_BLKNOS /* Limited by ULONG_MAX of page cache index */ | 176 | #if XFS_BIG_BLKNOS /* Limited by ULONG_MAX of page cache index */ |
177 | if (nblocks >> (PAGE_CACHE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) | 177 | if (nblocks >> (PAGE_CACHE_SHIFT - sbp->sb_blocklog) > ULONG_MAX) |
178 | return EFBIG; | 178 | return -EFBIG; |
179 | #else /* Limited by UINT_MAX of sectors */ | 179 | #else /* Limited by UINT_MAX of sectors */ |
180 | if (nblocks << (sbp->sb_blocklog - BBSHIFT) > UINT_MAX) | 180 | if (nblocks << (sbp->sb_blocklog - BBSHIFT) > UINT_MAX) |
181 | return EFBIG; | 181 | return -EFBIG; |
182 | #endif | 182 | #endif |
183 | return 0; | 183 | return 0; |
184 | } | 184 | } |
@@ -308,15 +308,15 @@ reread: | |||
308 | if (!bp) { | 308 | if (!bp) { |
309 | if (loud) | 309 | if (loud) |
310 | xfs_warn(mp, "SB buffer read failed"); | 310 | xfs_warn(mp, "SB buffer read failed"); |
311 | return EIO; | 311 | return -EIO; |
312 | } | 312 | } |
313 | if (bp->b_error) { | 313 | if (bp->b_error) { |
314 | error = bp->b_error; | 314 | error = bp->b_error; |
315 | if (loud) | 315 | if (loud) |
316 | xfs_warn(mp, "SB validate failed with error %d.", error); | 316 | xfs_warn(mp, "SB validate failed with error %d.", error); |
317 | /* bad CRC means corrupted metadata */ | 317 | /* bad CRC means corrupted metadata */ |
318 | if (error == EFSBADCRC) | 318 | if (error == -EFSBADCRC) |
319 | error = EFSCORRUPTED; | 319 | error = -EFSCORRUPTED; |
320 | goto release_buf; | 320 | goto release_buf; |
321 | } | 321 | } |
322 | 322 | ||
@@ -333,7 +333,7 @@ reread: | |||
333 | if (sbp->sb_magicnum != XFS_SB_MAGIC) { | 333 | if (sbp->sb_magicnum != XFS_SB_MAGIC) { |
334 | if (loud) | 334 | if (loud) |
335 | xfs_warn(mp, "Invalid superblock magic number"); | 335 | xfs_warn(mp, "Invalid superblock magic number"); |
336 | error = EINVAL; | 336 | error = -EINVAL; |
337 | goto release_buf; | 337 | goto release_buf; |
338 | } | 338 | } |
339 | 339 | ||
@@ -344,7 +344,7 @@ reread: | |||
344 | if (loud) | 344 | if (loud) |
345 | xfs_warn(mp, "device supports %u byte sectors (not %u)", | 345 | xfs_warn(mp, "device supports %u byte sectors (not %u)", |
346 | sector_size, sbp->sb_sectsize); | 346 | sector_size, sbp->sb_sectsize); |
347 | error = ENOSYS; | 347 | error = -ENOSYS; |
348 | goto release_buf; | 348 | goto release_buf; |
349 | } | 349 | } |
350 | 350 | ||
@@ -392,7 +392,7 @@ xfs_update_alignment(xfs_mount_t *mp) | |||
392 | xfs_warn(mp, | 392 | xfs_warn(mp, |
393 | "alignment check failed: sunit/swidth vs. blocksize(%d)", | 393 | "alignment check failed: sunit/swidth vs. blocksize(%d)", |
394 | sbp->sb_blocksize); | 394 | sbp->sb_blocksize); |
395 | return EINVAL; | 395 | return -EINVAL; |
396 | } else { | 396 | } else { |
397 | /* | 397 | /* |
398 | * Convert the stripe unit and width to FSBs. | 398 | * Convert the stripe unit and width to FSBs. |
@@ -402,14 +402,14 @@ xfs_update_alignment(xfs_mount_t *mp) | |||
402 | xfs_warn(mp, | 402 | xfs_warn(mp, |
403 | "alignment check failed: sunit/swidth vs. agsize(%d)", | 403 | "alignment check failed: sunit/swidth vs. agsize(%d)", |
404 | sbp->sb_agblocks); | 404 | sbp->sb_agblocks); |
405 | return EINVAL; | 405 | return -EINVAL; |
406 | } else if (mp->m_dalign) { | 406 | } else if (mp->m_dalign) { |
407 | mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth); | 407 | mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth); |
408 | } else { | 408 | } else { |
409 | xfs_warn(mp, | 409 | xfs_warn(mp, |
410 | "alignment check failed: sunit(%d) less than bsize(%d)", | 410 | "alignment check failed: sunit(%d) less than bsize(%d)", |
411 | mp->m_dalign, sbp->sb_blocksize); | 411 | mp->m_dalign, sbp->sb_blocksize); |
412 | return EINVAL; | 412 | return -EINVAL; |
413 | } | 413 | } |
414 | } | 414 | } |
415 | 415 | ||
@@ -429,7 +429,7 @@ xfs_update_alignment(xfs_mount_t *mp) | |||
429 | } else { | 429 | } else { |
430 | xfs_warn(mp, | 430 | xfs_warn(mp, |
431 | "cannot change alignment: superblock does not support data alignment"); | 431 | "cannot change alignment: superblock does not support data alignment"); |
432 | return EINVAL; | 432 | return -EINVAL; |
433 | } | 433 | } |
434 | } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && | 434 | } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && |
435 | xfs_sb_version_hasdalign(&mp->m_sb)) { | 435 | xfs_sb_version_hasdalign(&mp->m_sb)) { |
@@ -556,14 +556,14 @@ xfs_check_sizes(xfs_mount_t *mp) | |||
556 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); | 556 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); |
557 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { | 557 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { |
558 | xfs_warn(mp, "filesystem size mismatch detected"); | 558 | xfs_warn(mp, "filesystem size mismatch detected"); |
559 | return EFBIG; | 559 | return -EFBIG; |
560 | } | 560 | } |
561 | bp = xfs_buf_read_uncached(mp->m_ddev_targp, | 561 | bp = xfs_buf_read_uncached(mp->m_ddev_targp, |
562 | d - XFS_FSS_TO_BB(mp, 1), | 562 | d - XFS_FSS_TO_BB(mp, 1), |
563 | XFS_FSS_TO_BB(mp, 1), 0, NULL); | 563 | XFS_FSS_TO_BB(mp, 1), 0, NULL); |
564 | if (!bp) { | 564 | if (!bp) { |
565 | xfs_warn(mp, "last sector read failed"); | 565 | xfs_warn(mp, "last sector read failed"); |
566 | return EIO; | 566 | return -EIO; |
567 | } | 567 | } |
568 | xfs_buf_relse(bp); | 568 | xfs_buf_relse(bp); |
569 | 569 | ||
@@ -571,14 +571,14 @@ xfs_check_sizes(xfs_mount_t *mp) | |||
571 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); | 571 | d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); |
572 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { | 572 | if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) { |
573 | xfs_warn(mp, "log size mismatch detected"); | 573 | xfs_warn(mp, "log size mismatch detected"); |
574 | return EFBIG; | 574 | return -EFBIG; |
575 | } | 575 | } |
576 | bp = xfs_buf_read_uncached(mp->m_logdev_targp, | 576 | bp = xfs_buf_read_uncached(mp->m_logdev_targp, |
577 | d - XFS_FSB_TO_BB(mp, 1), | 577 | d - XFS_FSB_TO_BB(mp, 1), |
578 | XFS_FSB_TO_BB(mp, 1), 0, NULL); | 578 | XFS_FSB_TO_BB(mp, 1), 0, NULL); |
579 | if (!bp) { | 579 | if (!bp) { |
580 | xfs_warn(mp, "log device read failed"); | 580 | xfs_warn(mp, "log device read failed"); |
581 | return EIO; | 581 | return -EIO; |
582 | } | 582 | } |
583 | xfs_buf_relse(bp); | 583 | xfs_buf_relse(bp); |
584 | } | 584 | } |
@@ -816,7 +816,7 @@ xfs_mountfs( | |||
816 | if (!sbp->sb_logblocks) { | 816 | if (!sbp->sb_logblocks) { |
817 | xfs_warn(mp, "no log defined"); | 817 | xfs_warn(mp, "no log defined"); |
818 | XFS_ERROR_REPORT("xfs_mountfs", XFS_ERRLEVEL_LOW, mp); | 818 | XFS_ERROR_REPORT("xfs_mountfs", XFS_ERRLEVEL_LOW, mp); |
819 | error = EFSCORRUPTED; | 819 | error = -EFSCORRUPTED; |
820 | goto out_free_perag; | 820 | goto out_free_perag; |
821 | } | 821 | } |
822 | 822 | ||
@@ -876,7 +876,7 @@ xfs_mountfs( | |||
876 | xfs_iunlock(rip, XFS_ILOCK_EXCL); | 876 | xfs_iunlock(rip, XFS_ILOCK_EXCL); |
877 | XFS_ERROR_REPORT("xfs_mountfs_int(2)", XFS_ERRLEVEL_LOW, | 877 | XFS_ERROR_REPORT("xfs_mountfs_int(2)", XFS_ERRLEVEL_LOW, |
878 | mp); | 878 | mp); |
879 | error = EFSCORRUPTED; | 879 | error = -EFSCORRUPTED; |
880 | goto out_rele_rip; | 880 | goto out_rele_rip; |
881 | } | 881 | } |
882 | mp->m_rootip = rip; /* save it */ | 882 | mp->m_rootip = rip; /* save it */ |
@@ -1152,7 +1152,7 @@ xfs_mod_incore_sb_unlocked( | |||
1152 | lcounter += delta; | 1152 | lcounter += delta; |
1153 | if (lcounter < 0) { | 1153 | if (lcounter < 0) { |
1154 | ASSERT(0); | 1154 | ASSERT(0); |
1155 | return EINVAL; | 1155 | return -EINVAL; |
1156 | } | 1156 | } |
1157 | mp->m_sb.sb_icount = lcounter; | 1157 | mp->m_sb.sb_icount = lcounter; |
1158 | return 0; | 1158 | return 0; |
@@ -1161,7 +1161,7 @@ xfs_mod_incore_sb_unlocked( | |||
1161 | lcounter += delta; | 1161 | lcounter += delta; |
1162 | if (lcounter < 0) { | 1162 | if (lcounter < 0) { |
1163 | ASSERT(0); | 1163 | ASSERT(0); |
1164 | return EINVAL; | 1164 | return -EINVAL; |
1165 | } | 1165 | } |
1166 | mp->m_sb.sb_ifree = lcounter; | 1166 | mp->m_sb.sb_ifree = lcounter; |
1167 | return 0; | 1167 | return 0; |
@@ -1191,7 +1191,7 @@ xfs_mod_incore_sb_unlocked( | |||
1191 | * blocks if were allowed to. | 1191 | * blocks if were allowed to. |
1192 | */ | 1192 | */ |
1193 | if (!rsvd) | 1193 | if (!rsvd) |
1194 | return ENOSPC; | 1194 | return -ENOSPC; |
1195 | 1195 | ||
1196 | lcounter = (long long)mp->m_resblks_avail + delta; | 1196 | lcounter = (long long)mp->m_resblks_avail + delta; |
1197 | if (lcounter >= 0) { | 1197 | if (lcounter >= 0) { |
@@ -1202,7 +1202,7 @@ xfs_mod_incore_sb_unlocked( | |||
1202 | "Filesystem \"%s\": reserve blocks depleted! " | 1202 | "Filesystem \"%s\": reserve blocks depleted! " |
1203 | "Consider increasing reserve pool size.", | 1203 | "Consider increasing reserve pool size.", |
1204 | mp->m_fsname); | 1204 | mp->m_fsname); |
1205 | return ENOSPC; | 1205 | return -ENOSPC; |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | mp->m_sb.sb_fdblocks = lcounter + XFS_ALLOC_SET_ASIDE(mp); | 1208 | mp->m_sb.sb_fdblocks = lcounter + XFS_ALLOC_SET_ASIDE(mp); |
@@ -1211,7 +1211,7 @@ xfs_mod_incore_sb_unlocked( | |||
1211 | lcounter = (long long)mp->m_sb.sb_frextents; | 1211 | lcounter = (long long)mp->m_sb.sb_frextents; |
1212 | lcounter += delta; | 1212 | lcounter += delta; |
1213 | if (lcounter < 0) { | 1213 | if (lcounter < 0) { |
1214 | return ENOSPC; | 1214 | return -ENOSPC; |
1215 | } | 1215 | } |
1216 | mp->m_sb.sb_frextents = lcounter; | 1216 | mp->m_sb.sb_frextents = lcounter; |
1217 | return 0; | 1217 | return 0; |
@@ -1220,7 +1220,7 @@ xfs_mod_incore_sb_unlocked( | |||
1220 | lcounter += delta; | 1220 | lcounter += delta; |
1221 | if (lcounter < 0) { | 1221 | if (lcounter < 0) { |
1222 | ASSERT(0); | 1222 | ASSERT(0); |
1223 | return EINVAL; | 1223 | return -EINVAL; |
1224 | } | 1224 | } |
1225 | mp->m_sb.sb_dblocks = lcounter; | 1225 | mp->m_sb.sb_dblocks = lcounter; |
1226 | return 0; | 1226 | return 0; |
@@ -1229,7 +1229,7 @@ xfs_mod_incore_sb_unlocked( | |||
1229 | scounter += delta; | 1229 | scounter += delta; |
1230 | if (scounter < 0) { | 1230 | if (scounter < 0) { |
1231 | ASSERT(0); | 1231 | ASSERT(0); |
1232 | return EINVAL; | 1232 | return -EINVAL; |
1233 | } | 1233 | } |
1234 | mp->m_sb.sb_agcount = scounter; | 1234 | mp->m_sb.sb_agcount = scounter; |
1235 | return 0; | 1235 | return 0; |
@@ -1238,7 +1238,7 @@ xfs_mod_incore_sb_unlocked( | |||
1238 | scounter += delta; | 1238 | scounter += delta; |
1239 | if (scounter < 0) { | 1239 | if (scounter < 0) { |
1240 | ASSERT(0); | 1240 | ASSERT(0); |
1241 | return EINVAL; | 1241 | return -EINVAL; |
1242 | } | 1242 | } |
1243 | mp->m_sb.sb_imax_pct = scounter; | 1243 | mp->m_sb.sb_imax_pct = scounter; |
1244 | return 0; | 1244 | return 0; |
@@ -1247,7 +1247,7 @@ xfs_mod_incore_sb_unlocked( | |||
1247 | scounter += delta; | 1247 | scounter += delta; |
1248 | if (scounter < 0) { | 1248 | if (scounter < 0) { |
1249 | ASSERT(0); | 1249 | ASSERT(0); |
1250 | return EINVAL; | 1250 | return -EINVAL; |
1251 | } | 1251 | } |
1252 | mp->m_sb.sb_rextsize = scounter; | 1252 | mp->m_sb.sb_rextsize = scounter; |
1253 | return 0; | 1253 | return 0; |
@@ -1256,7 +1256,7 @@ xfs_mod_incore_sb_unlocked( | |||
1256 | scounter += delta; | 1256 | scounter += delta; |
1257 | if (scounter < 0) { | 1257 | if (scounter < 0) { |
1258 | ASSERT(0); | 1258 | ASSERT(0); |
1259 | return EINVAL; | 1259 | return -EINVAL; |
1260 | } | 1260 | } |
1261 | mp->m_sb.sb_rbmblocks = scounter; | 1261 | mp->m_sb.sb_rbmblocks = scounter; |
1262 | return 0; | 1262 | return 0; |
@@ -1265,7 +1265,7 @@ xfs_mod_incore_sb_unlocked( | |||
1265 | lcounter += delta; | 1265 | lcounter += delta; |
1266 | if (lcounter < 0) { | 1266 | if (lcounter < 0) { |
1267 | ASSERT(0); | 1267 | ASSERT(0); |
1268 | return EINVAL; | 1268 | return -EINVAL; |
1269 | } | 1269 | } |
1270 | mp->m_sb.sb_rblocks = lcounter; | 1270 | mp->m_sb.sb_rblocks = lcounter; |
1271 | return 0; | 1271 | return 0; |
@@ -1274,7 +1274,7 @@ xfs_mod_incore_sb_unlocked( | |||
1274 | lcounter += delta; | 1274 | lcounter += delta; |
1275 | if (lcounter < 0) { | 1275 | if (lcounter < 0) { |
1276 | ASSERT(0); | 1276 | ASSERT(0); |
1277 | return EINVAL; | 1277 | return -EINVAL; |
1278 | } | 1278 | } |
1279 | mp->m_sb.sb_rextents = lcounter; | 1279 | mp->m_sb.sb_rextents = lcounter; |
1280 | return 0; | 1280 | return 0; |
@@ -1283,13 +1283,13 @@ xfs_mod_incore_sb_unlocked( | |||
1283 | scounter += delta; | 1283 | scounter += delta; |
1284 | if (scounter < 0) { | 1284 | if (scounter < 0) { |
1285 | ASSERT(0); | 1285 | ASSERT(0); |
1286 | return EINVAL; | 1286 | return -EINVAL; |
1287 | } | 1287 | } |
1288 | mp->m_sb.sb_rextslog = scounter; | 1288 | mp->m_sb.sb_rextslog = scounter; |
1289 | return 0; | 1289 | return 0; |
1290 | default: | 1290 | default: |
1291 | ASSERT(0); | 1291 | ASSERT(0); |
1292 | return EINVAL; | 1292 | return -EINVAL; |
1293 | } | 1293 | } |
1294 | } | 1294 | } |
1295 | 1295 | ||
@@ -1452,7 +1452,7 @@ xfs_dev_is_read_only( | |||
1452 | (mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) { | 1452 | (mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) { |
1453 | xfs_notice(mp, "%s required on read-only device.", message); | 1453 | xfs_notice(mp, "%s required on read-only device.", message); |
1454 | xfs_notice(mp, "write access unavailable, cannot proceed."); | 1454 | xfs_notice(mp, "write access unavailable, cannot proceed."); |
1455 | return EROFS; | 1455 | return -EROFS; |
1456 | } | 1456 | } |
1457 | return 0; | 1457 | return 0; |
1458 | } | 1458 | } |
@@ -1995,7 +1995,7 @@ slow_path: | |||
1995 | * (e.g. lots of space just got freed). After that | 1995 | * (e.g. lots of space just got freed). After that |
1996 | * we are done. | 1996 | * we are done. |
1997 | */ | 1997 | */ |
1998 | if (ret != ENOSPC) | 1998 | if (ret != -ENOSPC) |
1999 | xfs_icsb_balance_counter(mp, field, 0); | 1999 | xfs_icsb_balance_counter(mp, field, 0); |
2000 | xfs_icsb_unlock(mp); | 2000 | xfs_icsb_unlock(mp); |
2001 | return ret; | 2001 | return ret; |