aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index f1dd70e201cf..6feecd279470 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -329,17 +329,15 @@ xfs_map_blocks(
329} 329}
330 330
331STATIC int 331STATIC int
332xfs_iomap_valid( 332xfs_imap_valid(
333 struct inode *inode, 333 struct inode *inode,
334 struct xfs_bmbt_irec *imap, 334 struct xfs_bmbt_irec *imap,
335 loff_t offset) 335 xfs_off_t offset)
336{ 336{
337 struct xfs_mount *mp = XFS_I(inode)->i_mount; 337 offset >>= inode->i_blkbits;
338 xfs_off_t iomap_offset = XFS_FSB_TO_B(mp, imap->br_startoff);
339 xfs_off_t iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount);
340 338
341 return offset >= iomap_offset && 339 return offset >= imap->br_startoff &&
342 offset < iomap_offset + iomap_bsize; 340 offset < imap->br_startoff + imap->br_blockcount;
343} 341}
344 342
345/* 343/*
@@ -825,7 +823,7 @@ xfs_convert_page(
825 else 823 else
826 type = IO_DELAY; 824 type = IO_DELAY;
827 825
828 if (!xfs_iomap_valid(inode, imap, offset)) { 826 if (!xfs_imap_valid(inode, imap, offset)) {
829 done = 1; 827 done = 1;
830 continue; 828 continue;
831 } 829 }
@@ -1069,7 +1067,7 @@ xfs_page_state_convert(
1069 __uint64_t end_offset; 1067 __uint64_t end_offset;
1070 pgoff_t end_index, last_index, tlast; 1068 pgoff_t end_index, last_index, tlast;
1071 ssize_t size, len; 1069 ssize_t size, len;
1072 int flags, err, iomap_valid = 0, uptodate = 1; 1070 int flags, err, imap_valid = 0, uptodate = 1;
1073 int page_dirty, count = 0; 1071 int page_dirty, count = 0;
1074 int trylock = 0; 1072 int trylock = 0;
1075 int all_bh = unmapped; 1073 int all_bh = unmapped;
@@ -1130,12 +1128,12 @@ xfs_page_state_convert(
1130 * the iomap is actually still valid, but the ioend 1128 * the iomap is actually still valid, but the ioend
1131 * isn't. shouldn't happen too often. 1129 * isn't. shouldn't happen too often.
1132 */ 1130 */
1133 iomap_valid = 0; 1131 imap_valid = 0;
1134 continue; 1132 continue;
1135 } 1133 }
1136 1134
1137 if (iomap_valid) 1135 if (imap_valid)
1138 iomap_valid = xfs_iomap_valid(inode, &imap, offset); 1136 imap_valid = xfs_imap_valid(inode, &imap, offset);
1139 1137
1140 /* 1138 /*
1141 * First case, map an unwritten extent and prepare for 1139 * First case, map an unwritten extent and prepare for
@@ -1156,7 +1154,7 @@ xfs_page_state_convert(
1156 * Make sure we don't use a read-only iomap 1154 * Make sure we don't use a read-only iomap
1157 */ 1155 */
1158 if (flags == BMAPI_READ) 1156 if (flags == BMAPI_READ)
1159 iomap_valid = 0; 1157 imap_valid = 0;
1160 1158
1161 if (buffer_unwritten(bh)) { 1159 if (buffer_unwritten(bh)) {
1162 type = IO_UNWRITTEN; 1160 type = IO_UNWRITTEN;
@@ -1169,7 +1167,7 @@ xfs_page_state_convert(
1169 flags = BMAPI_WRITE | BMAPI_MMAP; 1167 flags = BMAPI_WRITE | BMAPI_MMAP;
1170 } 1168 }
1171 1169
1172 if (!iomap_valid) { 1170 if (!imap_valid) {
1173 /* 1171 /*
1174 * if we didn't have a valid mapping then we 1172 * if we didn't have a valid mapping then we
1175 * need to ensure that we put the new mapping 1173 * need to ensure that we put the new mapping
@@ -1190,9 +1188,10 @@ xfs_page_state_convert(
1190 &imap, flags); 1188 &imap, flags);
1191 if (err) 1189 if (err)
1192 goto error; 1190 goto error;
1193 iomap_valid = xfs_iomap_valid(inode, &imap, offset); 1191 imap_valid = xfs_imap_valid(inode, &imap,
1192 offset);
1194 } 1193 }
1195 if (iomap_valid) { 1194 if (imap_valid) {
1196 xfs_map_at_offset(inode, bh, &imap, offset); 1195 xfs_map_at_offset(inode, bh, &imap, offset);
1197 if (startio) { 1196 if (startio) {
1198 xfs_add_to_ioend(inode, bh, offset, 1197 xfs_add_to_ioend(inode, bh, offset,
@@ -1212,7 +1211,7 @@ xfs_page_state_convert(
1212 * That means it must already have extents allocated 1211 * That means it must already have extents allocated
1213 * underneath it. Map the extent by reading it. 1212 * underneath it. Map the extent by reading it.
1214 */ 1213 */
1215 if (!iomap_valid || flags != BMAPI_READ) { 1214 if (!imap_valid || flags != BMAPI_READ) {
1216 flags = BMAPI_READ; 1215 flags = BMAPI_READ;
1217 size = xfs_probe_cluster(inode, page, bh, 1216 size = xfs_probe_cluster(inode, page, bh,
1218 head, 1); 1217 head, 1);
@@ -1220,7 +1219,8 @@ xfs_page_state_convert(
1220 &imap, flags); 1219 &imap, flags);
1221 if (err) 1220 if (err)
1222 goto error; 1221 goto error;
1223 iomap_valid = xfs_iomap_valid(inode, &imap, offset); 1222 imap_valid = xfs_imap_valid(inode, &imap,
1223 offset);
1224 } 1224 }
1225 1225
1226 /* 1226 /*
@@ -1234,18 +1234,18 @@ xfs_page_state_convert(
1234 type = IO_NEW; 1234 type = IO_NEW;
1235 if (trylock_buffer(bh)) { 1235 if (trylock_buffer(bh)) {
1236 ASSERT(buffer_mapped(bh)); 1236 ASSERT(buffer_mapped(bh));
1237 if (iomap_valid) 1237 if (imap_valid)
1238 all_bh = 1; 1238 all_bh = 1;
1239 xfs_add_to_ioend(inode, bh, offset, type, 1239 xfs_add_to_ioend(inode, bh, offset, type,
1240 &ioend, !iomap_valid); 1240 &ioend, !imap_valid);
1241 page_dirty--; 1241 page_dirty--;
1242 count++; 1242 count++;
1243 } else { 1243 } else {
1244 iomap_valid = 0; 1244 imap_valid = 0;
1245 } 1245 }
1246 } else if ((buffer_uptodate(bh) || PageUptodate(page)) && 1246 } else if ((buffer_uptodate(bh) || PageUptodate(page)) &&
1247 (unmapped || startio)) { 1247 (unmapped || startio)) {
1248 iomap_valid = 0; 1248 imap_valid = 0;
1249 } 1249 }
1250 1250
1251 if (!iohead) 1251 if (!iohead)
@@ -1259,7 +1259,7 @@ xfs_page_state_convert(
1259 if (startio) 1259 if (startio)
1260 xfs_start_page_writeback(page, 1, count); 1260 xfs_start_page_writeback(page, 1, count);
1261 1261
1262 if (ioend && iomap_valid) { 1262 if (ioend && imap_valid) {
1263 struct xfs_mount *m = XFS_I(inode)->i_mount; 1263 struct xfs_mount *m = XFS_I(inode)->i_mount;
1264 xfs_off_t iomap_offset = XFS_FSB_TO_B(m, imap.br_startoff); 1264 xfs_off_t iomap_offset = XFS_FSB_TO_B(m, imap.br_startoff);
1265 xfs_off_t iomap_bsize = XFS_FSB_TO_B(m, imap.br_blockcount); 1265 xfs_off_t iomap_bsize = XFS_FSB_TO_B(m, imap.br_blockcount);