54 memset(geo, 0,
sizeof(*geo));
58 geo->
agblocks = mp->m_sb.sb_agblocks;
59 geo->
agcount = mp->m_sb.sb_agcount;
61 geo->
sectsize = mp->m_sb.sb_sectsize;
63 geo->
imaxpct = mp->m_sb.sb_imax_pct;
67 geo->
logstart = mp->m_sb.sb_logstart;
68 ASSERT(
sizeof(geo->
uuid)==
sizeof(mp->m_sb.sb_uuid));
69 memcpy(geo->
uuid, &mp->m_sb.sb_uuid,
sizeof(mp->m_sb.sb_uuid));
70 if (new_version >= 2) {
71 geo->
sunit = mp->m_sb.sb_unit;
72 geo->
swidth = mp->m_sb.sb_width;
74 if (new_version >= 3) {
77 (xfs_sb_version_hasattr(&mp->m_sb) ?
79 (xfs_sb_version_hasnlink(&mp->m_sb) ?
81 (xfs_sb_version_hasquota(&mp->m_sb) ?
83 (xfs_sb_version_hasalign(&mp->m_sb) ?
85 (xfs_sb_version_hasdalign(&mp->m_sb) ?
87 (xfs_sb_version_hasshared(&mp->m_sb) ?
89 (xfs_sb_version_hasextflgbit(&mp->m_sb) ?
91 (xfs_sb_version_hasdirv2(&mp->m_sb) ?
93 (xfs_sb_version_hassector(&mp->m_sb) ?
95 (xfs_sb_version_hasasciici(&mp->m_sb) ?
97 (xfs_sb_version_haslazysbcount(&mp->m_sb) ?
99 (xfs_sb_version_hasattr2(&mp->m_sb) ?
101 geo->
logsectsize = xfs_sb_version_hassector(&mp->m_sb) ?
102 mp->m_sb.sb_logsectsize :
BBSIZE;
106 if (new_version >= 4) {
108 (xfs_sb_version_haslogv2(&mp->m_sb) ?
110 geo->
logsunit = mp->m_sb.sb_logsunit;
116 xfs_growfs_data_private(
142 if (nb < mp->m_sb.sb_dblocks || pct < 0 || pct > 100)
146 dpct = pct - mp->m_sb.sb_imax_pct;
155 nb_mod =
do_div(
new, mp->m_sb.sb_agblocks);
156 nagcount =
new + (nb_mod != 0);
160 if (nb < mp->m_sb.sb_dblocks)
163 new = nb - mp->m_sb.sb_dblocks;
164 oagcount = mp->m_sb.sb_agcount;
167 if (nagcount > oagcount) {
187 for (agno = nagcount - 1; agno >= oagcount; agno--,
new -= agsize) {
191 bp = xfs_buf_get(mp->m_ddev_targp,
199 memset(agf, 0, mp->m_sb.sb_sectsize);
203 if (agno == nagcount - 1)
208 agsize = mp->m_sb.sb_agblocks;
228 bp = xfs_buf_get(mp->m_ddev_targp,
236 memset(agi, 0, mp->m_sb.sb_sectsize);
257 bp = xfs_buf_get(mp->m_ddev_targp,
259 BTOBB(mp->m_sb.sb_blocksize), 0);
265 memset(block, 0, mp->m_sb.sb_blocksize);
283 bp = xfs_buf_get(mp->m_ddev_targp,
285 BTOBB(mp->m_sb.sb_blocksize), 0);
291 memset(block, 0, mp->m_sb.sb_blocksize);
310 bp = xfs_buf_get(mp->m_ddev_targp,
312 BTOBB(mp->m_sb.sb_blocksize), 0);
318 memset(block, 0, mp->m_sb.sb_blocksize);
329 xfs_trans_agblocks_delta(tp, nfree);
344 ASSERT(nagcount == oagcount ||
376 if (nagcount > oagcount)
378 if (nb > mp->m_sb.sb_dblocks)
380 nb - mp->m_sb.sb_dblocks);
391 mp->m_maxagi = nagimax;
392 if (mp->m_sb.sb_imax_pct) {
393 __uint64_t icount = mp->m_sb.sb_dblocks * mp->m_sb.sb_imax_pct;
395 mp->m_maxicount = icount << mp->m_sb.sb_inopblog;
401 for (agno = 1; agno < nagcount; agno++) {
408 if (agno < oagcount) {
409 error = xfs_trans_read_buf(mp,
NULL, mp->m_ddev_targp,
413 bp = xfs_trans_get_buf(
NULL, mp->m_ddev_targp,
424 "error %d reading secondary superblock for ag %d",
438 "write error %d updating secondary superblock for ag %d",
451 xfs_growfs_log_private(
460 if (nb == mp->m_sb.sb_logblocks &&
461 in->
isint == (mp->m_sb.sb_logstart != 0))
490 error = xfs_growfs_data_private(mp, in);
506 error = xfs_growfs_log_private(mp, in);
520 xfs_icsb_sync_counters(mp, XFS_ICSB_LAZY_COUNT);
521 spin_lock(&mp->m_sb_lock);
523 cnt->
freertx = mp->m_sb.sb_frextents;
524 cnt->
freeino = mp->m_sb.sb_ifree;
526 spin_unlock(&mp->m_sb_lock);
551 __int64_t lcounter,
delta, fdblks_delta;
555 if (inval == (__uint64_t *)
NULL) {
558 outval->
resblks = mp->m_resblks;
581 spin_lock(&mp->m_sb_lock);
582 xfs_icsb_sync_counters_locked(mp, 0);
589 if (mp->m_resblks > request) {
590 lcounter = mp->m_resblks_avail -
request;
592 fdblks_delta = lcounter;
593 mp->m_resblks_avail -= lcounter;
603 delta = request - mp->m_resblks;
604 lcounter = free -
delta;
607 mp->m_resblks +=
free;
608 mp->m_resblks_avail +=
free;
609 fdblks_delta = -
free;
611 fdblks_delta = -
delta;
613 mp->m_resblks_avail +=
delta;
618 outval->
resblks = mp->m_resblks;
621 spin_unlock(&mp->m_sb_lock);
674 xfs_trans_set_sync(tp);
687 if (sb && !IS_ERR(sb)) {
688 xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
695 xfs_force_shutdown(mp, SHUTDOWN_FORCE_UMOUNT);
698 xfs_force_shutdown(mp,
699 SHUTDOWN_FORCE_UMOUNT | SHUTDOWN_LOG_IO_ERROR);
723 logerror = flags & SHUTDOWN_LOG_IO_ERROR;
725 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
727 "%s(0x%x) called from line %d of file %s. Return address = 0x%p",
733 if (XFS_FORCED_SHUTDOWN(mp) && !logerror)
745 if (flags & SHUTDOWN_CORRUPT_INCORE) {
747 "Corruption of in-memory data detected. Shutting down filesystem");
750 }
else if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
753 "Log I/O Error Detected. Shutting down filesystem");
754 }
else if (flags & SHUTDOWN_DEVICE_REQ) {
756 "All device paths lost. Shutting down filesystem");
757 }
else if (!(flags & SHUTDOWN_REMOTE_REQ)) {
759 "I/O Error Detected. Shutting down filesystem");
762 if (!(flags & SHUTDOWN_FORCE_UMOUNT)) {
764 "Please umount the filesystem and rectify the problem(s)");