diff options
Diffstat (limited to 'fs/xfs/xfs_fsops.c')
-rw-r--r-- | fs/xfs/xfs_fsops.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index b599e6be9ec1..432e82347ed6 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include "xfs_trans_space.h" | 44 | #include "xfs_trans_space.h" |
45 | #include "xfs_rtalloc.h" | 45 | #include "xfs_rtalloc.h" |
46 | #include "xfs_rw.h" | 46 | #include "xfs_rw.h" |
47 | #include "xfs_filestream.h" | ||
47 | 48 | ||
48 | /* | 49 | /* |
49 | * File system operations | 50 | * File system operations |
@@ -94,6 +95,8 @@ xfs_fs_geometry( | |||
94 | XFS_FSOP_GEOM_FLAGS_DIRV2 : 0) | | 95 | XFS_FSOP_GEOM_FLAGS_DIRV2 : 0) | |
95 | (XFS_SB_VERSION_HASSECTOR(&mp->m_sb) ? | 96 | (XFS_SB_VERSION_HASSECTOR(&mp->m_sb) ? |
96 | XFS_FSOP_GEOM_FLAGS_SECTOR : 0) | | 97 | XFS_FSOP_GEOM_FLAGS_SECTOR : 0) | |
98 | (xfs_sb_version_haslazysbcount(&mp->m_sb) ? | ||
99 | XFS_FSOP_GEOM_FLAGS_LAZYSB : 0) | | ||
97 | (XFS_SB_VERSION_HASATTR2(&mp->m_sb) ? | 100 | (XFS_SB_VERSION_HASATTR2(&mp->m_sb) ? |
98 | XFS_FSOP_GEOM_FLAGS_ATTR2 : 0); | 101 | XFS_FSOP_GEOM_FLAGS_ATTR2 : 0); |
99 | geo->logsectsize = XFS_SB_VERSION_HASSECTOR(&mp->m_sb) ? | 102 | geo->logsectsize = XFS_SB_VERSION_HASSECTOR(&mp->m_sb) ? |
@@ -140,6 +143,8 @@ xfs_growfs_data_private( | |||
140 | pct = in->imaxpct; | 143 | pct = in->imaxpct; |
141 | if (nb < mp->m_sb.sb_dblocks || pct < 0 || pct > 100) | 144 | if (nb < mp->m_sb.sb_dblocks || pct < 0 || pct > 100) |
142 | return XFS_ERROR(EINVAL); | 145 | return XFS_ERROR(EINVAL); |
146 | if ((error = xfs_sb_validate_fsb_count(&mp->m_sb, nb))) | ||
147 | return error; | ||
143 | dpct = pct - mp->m_sb.sb_imax_pct; | 148 | dpct = pct - mp->m_sb.sb_imax_pct; |
144 | error = xfs_read_buf(mp, mp->m_ddev_targp, | 149 | error = xfs_read_buf(mp, mp->m_ddev_targp, |
145 | XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1), | 150 | XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1), |
@@ -161,6 +166,7 @@ xfs_growfs_data_private( | |||
161 | new = nb - mp->m_sb.sb_dblocks; | 166 | new = nb - mp->m_sb.sb_dblocks; |
162 | oagcount = mp->m_sb.sb_agcount; | 167 | oagcount = mp->m_sb.sb_agcount; |
163 | if (nagcount > oagcount) { | 168 | if (nagcount > oagcount) { |
169 | xfs_filestream_flush(mp); | ||
164 | down_write(&mp->m_peraglock); | 170 | down_write(&mp->m_peraglock); |
165 | mp->m_perag = kmem_realloc(mp->m_perag, | 171 | mp->m_perag = kmem_realloc(mp->m_perag, |
166 | sizeof(xfs_perag_t) * nagcount, | 172 | sizeof(xfs_perag_t) * nagcount, |
@@ -173,6 +179,7 @@ xfs_growfs_data_private( | |||
173 | up_write(&mp->m_peraglock); | 179 | up_write(&mp->m_peraglock); |
174 | } | 180 | } |
175 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS); | 181 | tp = xfs_trans_alloc(mp, XFS_TRANS_GROWFS); |
182 | tp->t_flags |= XFS_TRANS_RESERVE; | ||
176 | if ((error = xfs_trans_reserve(tp, XFS_GROWFS_SPACE_RES(mp), | 183 | if ((error = xfs_trans_reserve(tp, XFS_GROWFS_SPACE_RES(mp), |
177 | XFS_GROWDATA_LOG_RES(mp), 0, 0, 0))) { | 184 | XFS_GROWDATA_LOG_RES(mp), 0, 0, 0))) { |
178 | xfs_trans_cancel(tp, 0); | 185 | xfs_trans_cancel(tp, 0); |
@@ -328,6 +335,7 @@ xfs_growfs_data_private( | |||
328 | be32_add(&agf->agf_length, new); | 335 | be32_add(&agf->agf_length, new); |
329 | ASSERT(be32_to_cpu(agf->agf_length) == | 336 | ASSERT(be32_to_cpu(agf->agf_length) == |
330 | be32_to_cpu(agi->agi_length)); | 337 | be32_to_cpu(agi->agi_length)); |
338 | xfs_alloc_log_agf(tp, bp, XFS_AGF_LENGTH); | ||
331 | /* | 339 | /* |
332 | * Free the new space. | 340 | * Free the new space. |
333 | */ | 341 | */ |
@@ -494,8 +502,9 @@ xfs_reserve_blocks( | |||
494 | unsigned long s; | 502 | unsigned long s; |
495 | 503 | ||
496 | /* If inval is null, report current values and return */ | 504 | /* If inval is null, report current values and return */ |
497 | |||
498 | if (inval == (__uint64_t *)NULL) { | 505 | if (inval == (__uint64_t *)NULL) { |
506 | if (!outval) | ||
507 | return EINVAL; | ||
499 | outval->resblks = mp->m_resblks; | 508 | outval->resblks = mp->m_resblks; |
500 | outval->resblks_avail = mp->m_resblks_avail; | 509 | outval->resblks_avail = mp->m_resblks_avail; |
501 | return 0; | 510 | return 0; |
@@ -558,8 +567,10 @@ retry: | |||
558 | } | 567 | } |
559 | } | 568 | } |
560 | out: | 569 | out: |
561 | outval->resblks = mp->m_resblks; | 570 | if (outval) { |
562 | outval->resblks_avail = mp->m_resblks_avail; | 571 | outval->resblks = mp->m_resblks; |
572 | outval->resblks_avail = mp->m_resblks_avail; | ||
573 | } | ||
563 | XFS_SB_UNLOCK(mp, s); | 574 | XFS_SB_UNLOCK(mp, s); |
564 | 575 | ||
565 | if (fdblks_delta) { | 576 | if (fdblks_delta) { |