aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_aops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_aops.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c80
1 files changed, 36 insertions, 44 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index 7aa398724706..c6108971b4e6 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1,39 +1,26 @@
1/* 1/*
2 * Copyright (c) 2000-2005 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#include "xfs_inum.h" 19#include "xfs_bit.h"
35#include "xfs_log.h" 20#include "xfs_log.h"
21#include "xfs_inum.h"
36#include "xfs_sb.h" 22#include "xfs_sb.h"
23#include "xfs_ag.h"
37#include "xfs_dir.h" 24#include "xfs_dir.h"
38#include "xfs_dir2.h" 25#include "xfs_dir2.h"
39#include "xfs_trans.h" 26#include "xfs_trans.h"
@@ -42,13 +29,13 @@
42#include "xfs_bmap_btree.h" 29#include "xfs_bmap_btree.h"
43#include "xfs_alloc_btree.h" 30#include "xfs_alloc_btree.h"
44#include "xfs_ialloc_btree.h" 31#include "xfs_ialloc_btree.h"
45#include "xfs_alloc.h"
46#include "xfs_btree.h"
47#include "xfs_attr_sf.h"
48#include "xfs_dir_sf.h" 32#include "xfs_dir_sf.h"
49#include "xfs_dir2_sf.h" 33#include "xfs_dir2_sf.h"
34#include "xfs_attr_sf.h"
50#include "xfs_dinode.h" 35#include "xfs_dinode.h"
51#include "xfs_inode.h" 36#include "xfs_inode.h"
37#include "xfs_alloc.h"
38#include "xfs_btree.h"
52#include "xfs_error.h" 39#include "xfs_error.h"
53#include "xfs_rw.h" 40#include "xfs_rw.h"
54#include "xfs_iomap.h" 41#include "xfs_iomap.h"
@@ -761,8 +748,9 @@ xfs_page_state_convert(
761 if (page->index >= end_index) { 748 if (page->index >= end_index) {
762 if ((page->index >= end_index + 1) || 749 if ((page->index >= end_index + 1) ||
763 !(i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) { 750 !(i_size_read(inode) & (PAGE_CACHE_SIZE - 1))) {
764 err = -EIO; 751 if (startio)
765 goto error; 752 unlock_page(page);
753 return 0;
766 } 754 }
767 } 755 }
768 756
@@ -948,15 +936,18 @@ __linvfs_get_block(
948{ 936{
949 vnode_t *vp = LINVFS_GET_VP(inode); 937 vnode_t *vp = LINVFS_GET_VP(inode);
950 xfs_iomap_t iomap; 938 xfs_iomap_t iomap;
939 xfs_off_t offset;
940 ssize_t size;
951 int retpbbm = 1; 941 int retpbbm = 1;
952 int error; 942 int error;
953 ssize_t size;
954 loff_t offset = (loff_t)iblock << inode->i_blkbits;
955 943
956 if (blocks) 944 if (blocks) {
957 size = blocks << inode->i_blkbits; 945 offset = blocks << inode->i_blkbits; /* 64 bit goodness */
958 else 946 size = (ssize_t) min_t(xfs_off_t, offset, LONG_MAX);
947 } else {
959 size = 1 << inode->i_blkbits; 948 size = 1 << inode->i_blkbits;
949 }
950 offset = (xfs_off_t)iblock << inode->i_blkbits;
960 951
961 VOP_BMAP(vp, offset, size, 952 VOP_BMAP(vp, offset, size,
962 create ? flags : BMAPI_READ, &iomap, &retpbbm, error); 953 create ? flags : BMAPI_READ, &iomap, &retpbbm, error);
@@ -967,8 +958,8 @@ __linvfs_get_block(
967 return 0; 958 return 0;
968 959
969 if (iomap.iomap_bn != IOMAP_DADDR_NULL) { 960 if (iomap.iomap_bn != IOMAP_DADDR_NULL) {
970 xfs_daddr_t bn; 961 xfs_daddr_t bn;
971 loff_t delta; 962 xfs_off_t delta;
972 963
973 /* For unwritten extents do not report a disk address on 964 /* For unwritten extents do not report a disk address on
974 * the read case (treat as if we're reading into a hole). 965 * the read case (treat as if we're reading into a hole).
@@ -1000,9 +991,8 @@ __linvfs_get_block(
1000 */ 991 */
1001 if (create && 992 if (create &&
1002 ((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) || 993 ((!buffer_mapped(bh_result) && !buffer_uptodate(bh_result)) ||
1003 (offset >= i_size_read(inode)) || (iomap.iomap_flags & IOMAP_NEW))) { 994 (offset >= i_size_read(inode)) || (iomap.iomap_flags & IOMAP_NEW)))
1004 set_buffer_new(bh_result); 995 set_buffer_new(bh_result);
1005 }
1006 996
1007 if (iomap.iomap_flags & IOMAP_DELAY) { 997 if (iomap.iomap_flags & IOMAP_DELAY) {
1008 BUG_ON(direct); 998 BUG_ON(direct);
@@ -1014,9 +1004,11 @@ __linvfs_get_block(
1014 } 1004 }
1015 1005
1016 if (blocks) { 1006 if (blocks) {
1017 bh_result->b_size = (ssize_t)min( 1007 ASSERT(iomap.iomap_bsize - iomap.iomap_delta > 0);
1018 (loff_t)(iomap.iomap_bsize - iomap.iomap_delta), 1008 offset = min_t(xfs_off_t,
1019 (loff_t)(blocks << inode->i_blkbits)); 1009 iomap.iomap_bsize - iomap.iomap_delta,
1010 blocks << inode->i_blkbits);
1011 bh_result->b_size = (u32) min_t(xfs_off_t, UINT_MAX, offset);
1020 } 1012 }
1021 1013
1022 return 0; 1014 return 0;