aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/libxfs/xfs_attr_remote.c3
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c18
-rw-r--r--fs/xfs/libxfs/xfs_bmap.h3
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c5
-rw-r--r--fs/xfs/xfs_bmap_util.c5
-rw-r--r--fs/xfs/xfs_dquot.c3
-rw-r--r--fs/xfs/xfs_iomap.c10
-rw-r--r--fs/xfs/xfs_reflink.c6
-rw-r--r--fs/xfs/xfs_rtalloc.c4
-rw-r--r--fs/xfs/xfs_symlink.c3
10 files changed, 22 insertions, 38 deletions
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 205098aeb4bc..2db9ef186e05 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -484,8 +484,7 @@ xfs_attr_rmtval_set(
484 &args->trans->t_firstblock); 484 &args->trans->t_firstblock);
485 nmap = 1; 485 nmap = 1;
486 error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno, 486 error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno,
487 blkcnt, XFS_BMAPI_ATTRFORK, 487 blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map,
488 &args->trans->t_firstblock, args->total, &map,
489 &nmap); 488 &nmap);
490 if (error) 489 if (error)
491 goto out_defer_cancel; 490 goto out_defer_cancel;
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index e37e1319d733..ca30e972288a 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -4212,12 +4212,6 @@ xfs_bmapi_convert_unwritten(
4212 * extent state if necessary. Details behaviour is controlled by the flags 4212 * extent state if necessary. Details behaviour is controlled by the flags
4213 * parameter. Only allocates blocks from a single allocation group, to avoid 4213 * parameter. Only allocates blocks from a single allocation group, to avoid
4214 * locking problems. 4214 * locking problems.
4215 *
4216 * The returned value in "firstblock" from the first call in a transaction
4217 * must be remembered and presented to subsequent calls in "firstblock".
4218 * An upper bound for the number of blocks to be allocated is supplied to
4219 * the first call in "total"; if no allocation group has that many free
4220 * blocks then the call will fail (return NULLFSBLOCK in "firstblock").
4221 */ 4215 */
4222int 4216int
4223xfs_bmapi_write( 4217xfs_bmapi_write(
@@ -4226,8 +4220,6 @@ xfs_bmapi_write(
4226 xfs_fileoff_t bno, /* starting file offs. mapped */ 4220 xfs_fileoff_t bno, /* starting file offs. mapped */
4227 xfs_filblks_t len, /* length to map in file */ 4221 xfs_filblks_t len, /* length to map in file */
4228 int flags, /* XFS_BMAPI_... */ 4222 int flags, /* XFS_BMAPI_... */
4229 xfs_fsblock_t *firstblock, /* first allocated block
4230 controls a.g. for allocs */
4231 xfs_extlen_t total, /* total blocks needed */ 4223 xfs_extlen_t total, /* total blocks needed */
4232 struct xfs_bmbt_irec *mval, /* output: map values */ 4224 struct xfs_bmbt_irec *mval, /* output: map values */
4233 int *nmap) /* i/o: mval size/count */ 4225 int *nmap) /* i/o: mval size/count */
@@ -4294,7 +4286,7 @@ xfs_bmapi_write(
4294 4286
4295 XFS_STATS_INC(mp, xs_blk_mapw); 4287 XFS_STATS_INC(mp, xs_blk_mapw);
4296 4288
4297 if (!tp || *firstblock == NULLFSBLOCK) { 4289 if (!tp || tp->t_firstblock == NULLFSBLOCK) {
4298 if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE) 4290 if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE)
4299 bma.minleft = be16_to_cpu(ifp->if_broot->bb_level) + 1; 4291 bma.minleft = be16_to_cpu(ifp->if_broot->bb_level) + 1;
4300 else 4292 else
@@ -4321,7 +4313,7 @@ xfs_bmapi_write(
4321 bma.ip = ip; 4313 bma.ip = ip;
4322 bma.total = total; 4314 bma.total = total;
4323 bma.datatype = 0; 4315 bma.datatype = 0;
4324 bma.firstblock = firstblock; 4316 bma.firstblock = &tp->t_firstblock;
4325 ASSERT(!tp || tp->t_dfops); 4317 ASSERT(!tp || tp->t_dfops);
4326 4318
4327 while (bno < end && n < *nmap) { 4319 while (bno < end && n < *nmap) {
@@ -4474,11 +4466,11 @@ error0:
4474 4466
4475 if (bma.cur) { 4467 if (bma.cur) {
4476 if (!error) { 4468 if (!error) {
4477 ASSERT(*firstblock == NULLFSBLOCK || 4469 ASSERT(tp->t_firstblock == NULLFSBLOCK ||
4478 XFS_FSB_TO_AGNO(mp, *firstblock) <= 4470 XFS_FSB_TO_AGNO(mp, tp->t_firstblock) <=
4479 XFS_FSB_TO_AGNO(mp, 4471 XFS_FSB_TO_AGNO(mp,
4480 bma.cur->bc_private.b.firstblock)); 4472 bma.cur->bc_private.b.firstblock));
4481 *firstblock = bma.cur->bc_private.b.firstblock; 4473 tp->t_firstblock = bma.cur->bc_private.b.firstblock;
4482 } 4474 }
4483 xfs_btree_del_cursor(bma.cur, 4475 xfs_btree_del_cursor(bma.cur,
4484 error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); 4476 error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR);
diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
index 83180c7cf3ee..88c2b5dc499e 100644
--- a/fs/xfs/libxfs/xfs_bmap.h
+++ b/fs/xfs/libxfs/xfs_bmap.h
@@ -201,8 +201,7 @@ int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno,
201 int *nmap, int flags); 201 int *nmap, int flags);
202int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip, 202int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
203 xfs_fileoff_t bno, xfs_filblks_t len, int flags, 203 xfs_fileoff_t bno, xfs_filblks_t len, int flags,
204 xfs_fsblock_t *firstblock, xfs_extlen_t total, 204 xfs_extlen_t total, struct xfs_bmbt_irec *mval, int *nmap);
205 struct xfs_bmbt_irec *mval, int *nmap);
206int __xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip, 205int __xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
207 xfs_fileoff_t bno, xfs_filblks_t *rlen, int flags, 206 xfs_fileoff_t bno, xfs_filblks_t *rlen, int flags,
208 xfs_extnum_t nexts, xfs_fsblock_t *firstblock); 207 xfs_extnum_t nexts, xfs_fsblock_t *firstblock);
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index 2f2be86c10dc..fe4a192696ae 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -2061,7 +2061,7 @@ xfs_da_grow_inode_int(
2061 nmap = 1; 2061 nmap = 1;
2062 error = xfs_bmapi_write(tp, dp, *bno, count, 2062 error = xfs_bmapi_write(tp, dp, *bno, count,
2063 xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG, 2063 xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG,
2064 &tp->t_firstblock, args->total, &map, &nmap); 2064 args->total, &map, &nmap);
2065 if (error) 2065 if (error)
2066 return error; 2066 return error;
2067 2067
@@ -2083,8 +2083,7 @@ xfs_da_grow_inode_int(
2083 c = (int)(*bno + count - b); 2083 c = (int)(*bno + count - b);
2084 error = xfs_bmapi_write(tp, dp, b, c, 2084 error = xfs_bmapi_write(tp, dp, b, c,
2085 xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA, 2085 xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
2086 &tp->t_firstblock, args->total, 2086 args->total, &mapp[mapi], &nmap);
2087 &mapp[mapi], &nmap);
2088 if (error) 2087 if (error)
2089 goto out_free_map; 2088 goto out_free_map;
2090 if (nmap < 1) 2089 if (nmap < 1)
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index d98f6e3065db..4f4b1d3fb898 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -973,9 +973,8 @@ xfs_alloc_file_space(
973 973
974 xfs_defer_init(tp, &dfops, &tp->t_firstblock); 974 xfs_defer_init(tp, &dfops, &tp->t_firstblock);
975 error = xfs_bmapi_write(tp, ip, startoffset_fsb, 975 error = xfs_bmapi_write(tp, ip, startoffset_fsb,
976 allocatesize_fsb, alloc_type, 976 allocatesize_fsb, alloc_type, resblks,
977 &tp->t_firstblock, resblks, imapp, 977 imapp, &nimaps);
978 &nimaps);
979 if (error) 978 if (error)
980 goto error0; 979 goto error0;
981 980
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index 2fc5e21373be..84359eeb20f4 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -311,8 +311,7 @@ xfs_dquot_disk_alloc(
311 xfs_trans_ijoin(tp, quotip, XFS_ILOCK_EXCL); 311 xfs_trans_ijoin(tp, quotip, XFS_ILOCK_EXCL);
312 error = xfs_bmapi_write(tp, quotip, dqp->q_fileoffset, 312 error = xfs_bmapi_write(tp, quotip, dqp->q_fileoffset,
313 XFS_DQUOT_CLUSTER_SIZE_FSB, XFS_BMAPI_METADATA, 313 XFS_DQUOT_CLUSTER_SIZE_FSB, XFS_BMAPI_METADATA,
314 &tp->t_firstblock, XFS_QM_DQALLOC_SPACE_RES(mp), 314 XFS_QM_DQALLOC_SPACE_RES(mp), &map, &nmaps);
315 &map, &nmaps);
316 if (error) 315 if (error)
317 goto error0; 316 goto error0;
318 ASSERT(map.br_blockcount == XFS_DQUOT_CLUSTER_SIZE_FSB); 317 ASSERT(map.br_blockcount == XFS_DQUOT_CLUSTER_SIZE_FSB);
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index a2b302ba40a8..0ae822538a63 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -256,8 +256,7 @@ xfs_iomap_write_direct(
256 xfs_defer_init(tp, &dfops, &tp->t_firstblock); 256 xfs_defer_init(tp, &dfops, &tp->t_firstblock);
257 nimaps = 1; 257 nimaps = 1;
258 error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb, 258 error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
259 bmapi_flags, &tp->t_firstblock, resblks, imap, 259 bmapi_flags, resblks, imap, &nimaps);
260 &nimaps);
261 if (error) 260 if (error)
262 goto out_bmap_cancel; 261 goto out_bmap_cancel;
263 262
@@ -768,8 +767,7 @@ xfs_iomap_write_allocate(
768 * pointer that the caller gave to us. 767 * pointer that the caller gave to us.
769 */ 768 */
770 error = xfs_bmapi_write(tp, ip, map_start_fsb, 769 error = xfs_bmapi_write(tp, ip, map_start_fsb,
771 count_fsb, flags, 770 count_fsb, flags, nres, imap,
772 &tp->t_firstblock, nres, imap,
773 &nimaps); 771 &nimaps);
774 if (error) 772 if (error)
775 goto trans_cancel; 773 goto trans_cancel;
@@ -877,8 +875,8 @@ xfs_iomap_write_unwritten(
877 xfs_defer_init(tp, &dfops, &tp->t_firstblock); 875 xfs_defer_init(tp, &dfops, &tp->t_firstblock);
878 nimaps = 1; 876 nimaps = 1;
879 error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb, 877 error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
880 XFS_BMAPI_CONVERT, &tp->t_firstblock, 878 XFS_BMAPI_CONVERT, resblks, &imap,
881 resblks, &imap, &nimaps); 879 &nimaps);
882 if (error) 880 if (error)
883 goto error_on_bmapi_transaction; 881 goto error_on_bmapi_transaction;
884 882
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 83c02f6b1d02..7010f3453c29 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -324,7 +324,7 @@ xfs_reflink_convert_cow_extent(
324 if (imap->br_blockcount == 0) 324 if (imap->br_blockcount == 0)
325 return 0; 325 return 0;
326 return xfs_bmapi_write(NULL, ip, imap->br_startoff, imap->br_blockcount, 326 return xfs_bmapi_write(NULL, ip, imap->br_startoff, imap->br_blockcount,
327 XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT, NULL, 0, imap, 327 XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT, 0, imap,
328 &nimaps); 328 &nimaps);
329} 329}
330 330
@@ -347,7 +347,7 @@ xfs_reflink_convert_cow(
347 xfs_ilock(ip, XFS_ILOCK_EXCL); 347 xfs_ilock(ip, XFS_ILOCK_EXCL);
348 error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb, 348 error = xfs_bmapi_write(NULL, ip, offset_fsb, count_fsb,
349 XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT | 349 XFS_BMAPI_COWFORK | XFS_BMAPI_CONVERT |
350 XFS_BMAPI_CONVERT_ONLY, NULL, 0, &imap, &nimaps); 350 XFS_BMAPI_CONVERT_ONLY, 0, &imap, &nimaps);
351 xfs_iunlock(ip, XFS_ILOCK_EXCL); 351 xfs_iunlock(ip, XFS_ILOCK_EXCL);
352 return error; 352 return error;
353} 353}
@@ -430,7 +430,7 @@ retry:
430 /* Allocate the entire reservation as unwritten blocks. */ 430 /* Allocate the entire reservation as unwritten blocks. */
431 error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount, 431 error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount,
432 XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC, 432 XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC,
433 &tp->t_firstblock, resblks, imap, &nimaps); 433 resblks, imap, &nimaps);
434 if (error) 434 if (error)
435 goto out_bmap_cancel; 435 goto out_bmap_cancel;
436 436
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 1c894ea2abca..edd949376a51 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -792,8 +792,8 @@ xfs_growfs_rt_alloc(
792 */ 792 */
793 nmap = 1; 793 nmap = 1;
794 error = xfs_bmapi_write(tp, ip, oblocks, nblocks - oblocks, 794 error = xfs_bmapi_write(tp, ip, oblocks, nblocks - oblocks,
795 XFS_BMAPI_METADATA, &tp->t_firstblock, 795 XFS_BMAPI_METADATA, resblks, &map,
796 resblks, &map, &nmap); 796 &nmap);
797 if (!error && nmap < 1) 797 if (!error && nmap < 1)
798 error = -ENOSPC; 798 error = -ENOSPC;
799 if (error) 799 if (error)
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index 18d9b4d301e5..94301b63525f 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -288,8 +288,7 @@ xfs_symlink(
288 nmaps = XFS_SYMLINK_MAPS; 288 nmaps = XFS_SYMLINK_MAPS;
289 289
290 error = xfs_bmapi_write(tp, ip, first_fsb, fs_blocks, 290 error = xfs_bmapi_write(tp, ip, first_fsb, fs_blocks,
291 XFS_BMAPI_METADATA, &tp->t_firstblock, 291 XFS_BMAPI_METADATA, resblks, mval, &nmaps);
292 resblks, mval, &nmaps);
293 if (error) 292 if (error)
294 goto out_bmap_cancel; 293 goto out_bmap_cancel;
295 294