aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_aops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_aops.c')
-rw-r--r--fs/xfs/xfs_aops.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 7575cfc3ad15..4a28fa91e3b1 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -200,7 +200,7 @@ xfs_setfilesize_trans_alloc(
200 * Update on-disk file size now that data has been written to disk. 200 * Update on-disk file size now that data has been written to disk.
201 */ 201 */
202STATIC int 202STATIC int
203xfs_setfilesize( 203__xfs_setfilesize(
204 struct xfs_inode *ip, 204 struct xfs_inode *ip,
205 struct xfs_trans *tp, 205 struct xfs_trans *tp,
206 xfs_off_t offset, 206 xfs_off_t offset,
@@ -225,6 +225,23 @@ xfs_setfilesize(
225 return xfs_trans_commit(tp); 225 return xfs_trans_commit(tp);
226} 226}
227 227
228int
229xfs_setfilesize(
230 struct xfs_inode *ip,
231 xfs_off_t offset,
232 size_t size)
233{
234 struct xfs_mount *mp = ip->i_mount;
235 struct xfs_trans *tp;
236 int error;
237
238 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp);
239 if (error)
240 return error;
241
242 return __xfs_setfilesize(ip, tp, offset, size);
243}
244
228STATIC int 245STATIC int
229xfs_setfilesize_ioend( 246xfs_setfilesize_ioend(
230 struct xfs_ioend *ioend, 247 struct xfs_ioend *ioend,
@@ -247,7 +264,7 @@ xfs_setfilesize_ioend(
247 return error; 264 return error;
248 } 265 }
249 266
250 return xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size); 267 return __xfs_setfilesize(ip, tp, ioend->io_offset, ioend->io_size);
251} 268}
252 269
253/* 270/*
@@ -1336,13 +1353,12 @@ xfs_end_io_direct_write(
1336{ 1353{
1337 struct inode *inode = file_inode(iocb->ki_filp); 1354 struct inode *inode = file_inode(iocb->ki_filp);
1338 struct xfs_inode *ip = XFS_I(inode); 1355 struct xfs_inode *ip = XFS_I(inode);
1339 struct xfs_mount *mp = ip->i_mount;
1340 uintptr_t flags = (uintptr_t)private; 1356 uintptr_t flags = (uintptr_t)private;
1341 int error = 0; 1357 int error = 0;
1342 1358
1343 trace_xfs_end_io_direct_write(ip, offset, size); 1359 trace_xfs_end_io_direct_write(ip, offset, size);
1344 1360
1345 if (XFS_FORCED_SHUTDOWN(mp)) 1361 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
1346 return -EIO; 1362 return -EIO;
1347 1363
1348 if (size <= 0) 1364 if (size <= 0)
@@ -1380,14 +1396,9 @@ xfs_end_io_direct_write(
1380 1396
1381 error = xfs_iomap_write_unwritten(ip, offset, size); 1397 error = xfs_iomap_write_unwritten(ip, offset, size);
1382 } else if (flags & XFS_DIO_FLAG_APPEND) { 1398 } else if (flags & XFS_DIO_FLAG_APPEND) {
1383 struct xfs_trans *tp;
1384
1385 trace_xfs_end_io_direct_write_append(ip, offset, size); 1399 trace_xfs_end_io_direct_write_append(ip, offset, size);
1386 1400
1387 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, 1401 error = xfs_setfilesize(ip, offset, size);
1388 &tp);
1389 if (!error)
1390 error = xfs_setfilesize(ip, tp, offset, size);
1391 } 1402 }
1392 1403
1393 return error; 1404 return error;