aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_iomap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_iomap.c')
-rw-r--r--fs/xfs/xfs_iomap.c69
1 files changed, 21 insertions, 48 deletions
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index d0f5be63cddb..45a77a3a6c07 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -1,40 +1,25 @@
1/* 1/*
2 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34
35#include "xfs_fs.h" 19#include "xfs_fs.h"
36#include "xfs_inum.h" 20#include "xfs_bit.h"
37#include "xfs_log.h" 21#include "xfs_log.h"
22#include "xfs_inum.h"
38#include "xfs_trans.h" 23#include "xfs_trans.h"
39#include "xfs_sb.h" 24#include "xfs_sb.h"
40#include "xfs_ag.h" 25#include "xfs_ag.h"
@@ -44,16 +29,16 @@
44#include "xfs_dmapi.h" 29#include "xfs_dmapi.h"
45#include "xfs_quota.h" 30#include "xfs_quota.h"
46#include "xfs_mount.h" 31#include "xfs_mount.h"
47#include "xfs_alloc_btree.h"
48#include "xfs_bmap_btree.h" 32#include "xfs_bmap_btree.h"
33#include "xfs_alloc_btree.h"
49#include "xfs_ialloc_btree.h" 34#include "xfs_ialloc_btree.h"
50#include "xfs_btree.h"
51#include "xfs_ialloc.h"
52#include "xfs_attr_sf.h"
53#include "xfs_dir_sf.h" 35#include "xfs_dir_sf.h"
54#include "xfs_dir2_sf.h" 36#include "xfs_dir2_sf.h"
37#include "xfs_attr_sf.h"
55#include "xfs_dinode.h" 38#include "xfs_dinode.h"
56#include "xfs_inode.h" 39#include "xfs_inode.h"
40#include "xfs_ialloc.h"
41#include "xfs_btree.h"
57#include "xfs_bmap.h" 42#include "xfs_bmap.h"
58#include "xfs_bit.h" 43#include "xfs_bit.h"
59#include "xfs_rtalloc.h" 44#include "xfs_rtalloc.h"
@@ -379,17 +364,15 @@ xfs_iomap_write_direct(
379 xfs_fileoff_t offset_fsb; 364 xfs_fileoff_t offset_fsb;
380 xfs_fileoff_t last_fsb; 365 xfs_fileoff_t last_fsb;
381 xfs_filblks_t count_fsb; 366 xfs_filblks_t count_fsb;
382 xfs_fsize_t isize;
383 xfs_fsblock_t firstfsb; 367 xfs_fsblock_t firstfsb;
384 int nimaps, maps; 368 int nimaps;
385 int error; 369 int error;
386 int bmapi_flag; 370 int bmapi_flag;
387 int quota_flag; 371 int quota_flag;
388 int rt; 372 int rt;
389 xfs_trans_t *tp; 373 xfs_trans_t *tp;
390 xfs_bmbt_irec_t imap[XFS_WRITE_IMAPS], *imapp; 374 xfs_bmbt_irec_t imap;
391 xfs_bmap_free_t free_list; 375 xfs_bmap_free_t free_list;
392 int aeof;
393 xfs_filblks_t qblocks, resblks; 376 xfs_filblks_t qblocks, resblks;
394 int committed; 377 int committed;
395 int resrtextents; 378 int resrtextents;
@@ -402,15 +385,6 @@ xfs_iomap_write_direct(
402 if (error) 385 if (error)
403 return XFS_ERROR(error); 386 return XFS_ERROR(error);
404 387
405 maps = min(XFS_WRITE_IMAPS, *nmaps);
406 nimaps = maps;
407
408 isize = ip->i_d.di_size;
409 aeof = (offset + count) > isize;
410
411 if (io->io_new_size > isize)
412 isize = io->io_new_size;
413
414 offset_fsb = XFS_B_TO_FSBT(mp, offset); 388 offset_fsb = XFS_B_TO_FSBT(mp, offset);
415 last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count))); 389 last_fsb = XFS_B_TO_FSB(mp, ((xfs_ufsize_t)(offset + count)));
416 count_fsb = last_fsb - offset_fsb; 390 count_fsb = last_fsb - offset_fsb;
@@ -479,9 +453,8 @@ xfs_iomap_write_direct(
479 */ 453 */
480 XFS_BMAP_INIT(&free_list, &firstfsb); 454 XFS_BMAP_INIT(&free_list, &firstfsb);
481 nimaps = 1; 455 nimaps = 1;
482 imapp = &imap[0];
483 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, 456 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb,
484 bmapi_flag, &firstfsb, 0, imapp, &nimaps, &free_list); 457 bmapi_flag, &firstfsb, 0, &imap, &nimaps, &free_list);
485 if (error) 458 if (error)
486 goto error0; 459 goto error0;
487 460
@@ -503,7 +476,7 @@ xfs_iomap_write_direct(
503 goto error_out; 476 goto error_out;
504 } 477 }
505 478
506 *ret_imap = imap[0]; 479 *ret_imap = imap;
507 *nmaps = 1; 480 *nmaps = 1;
508 if ( !(io->io_flags & XFS_IOCORE_RT) && !ret_imap->br_startblock) { 481 if ( !(io->io_flags & XFS_IOCORE_RT) && !ret_imap->br_startblock) {
509 cmn_err(CE_PANIC,"Access to block zero: fs <%s> inode: %lld " 482 cmn_err(CE_PANIC,"Access to block zero: fs <%s> inode: %lld "