View | Details | Raw Unified | Return to bug 300
Collapse All | Expand All

(-)/usr/tmp/TmpDir.24421-0/xfsidbg.c_1.250 (-2 / +2 lines)
 Lines 2610-2618    Link Here 
2610
	    (diag = kdb_getarea(iomap, addr)))
2610
	    (diag = kdb_getarea(iomap, addr)))
2611
2611
2612
	kdb_printf("iomap_t at 0x%lx\n", addr);
2612
	kdb_printf("iomap_t at 0x%lx\n", addr);
2613
	kdb_printf("  iomap_bn 0x%llx iomap_offset 0x%Lx iomap_delta 0x%lx iomap_bsize 0x%lx\n",
2613
	kdb_printf("  iomap_bn 0x%llx iomap_offset 0x%Lx iomap_delta 0x%lx iomap_bsize 0x%llx\n",
2614
		(long long) iomap.iomap_bn, iomap.iomap_offset,
2614
		(long long) iomap.iomap_bn, iomap.iomap_offset,
2615
		(unsigned long) iomap.iomap_delta, (unsigned long) iomap.iomap_bsize);
2615
		(unsigned long)iomap.iomap_delta, (long long)iomap.iomap_bsize);
2616
2616
2617
	kdb_printf("  iomap_flags %s\n", map_flags(iomap.iomap_flags, iomap_flag_vals));
2617
	kdb_printf("  iomap_flags %s\n", map_flags(iomap.iomap_flags, iomap_flag_vals));
2618
2618
(-)/usr/tmp/TmpDir.24431-0/xfs_iomap.h_1.1 (-14 / +13 lines)
 Lines 66-92    Link Here 
66
/*
66
/*
67
 * xfs_iomap_t:  File system I/O map
67
 * xfs_iomap_t:  File system I/O map
68
 *
68
 *
69
 * The iomap_bn, iomap_offset and iomap_length fields are expressed in disk blocks.
69
 * The iomap_bn field is expressed in 512-byte blocks, and is where the 
70
 * The iomap_length field specifies the size of the underlying backing store
70
 * mapping starts on disk.
71
 * for the particular mapping.
72
 *
71
 *
73
 * The iomap_bsize, iomap_size and iomap_delta fields are in bytes and indicate
72
 * The iomap_offset, iomap_bsize and iomap_delta fields are in bytes.
74
 * the size of the mapping, the number of bytes that are valid to access
73
 * iomap_offset is the offset of the mapping in the file itself.
75
 * (read or write), and the offset into the mapping, given the offset
74
 * iomap_bsize is the size of the mapping,  iomap_delta is the 
76
 * supplied to the file I/O map routine.  iomap_delta is the offset of the
75
 * desired data's offset into the mapping, given the offset supplied 
77
 * desired data from the beginning of the mapping.
76
 * to the file I/O map routine.
78
 *
77
 *
79
 * When a request is made to read beyond the logical end of the object,
78
 * When a request is made to read beyond the logical end of the object,
80
 * iomap_size may be set to 0, but iomap_offset and iomap_length should be set to
79
 * iomap_size may be set to 0, but iomap_offset and iomap_length should be set
81
 * the actual amount of underlying storage that has been allocated, if any.
80
 * to the actual amount of underlying storage that has been allocated, if any.
82
 */
81
 */
83
82
84
typedef struct xfs_iomap {
83
typedef struct xfs_iomap {
85
	xfs_daddr_t		iomap_bn;
84
	xfs_daddr_t		iomap_bn;	/* first 512b blk of mapping */
86
	xfs_buftarg_t		*iomap_target;
85
	xfs_buftarg_t		*iomap_target;
87
	loff_t			iomap_offset;
86
	loff_t			iomap_offset;	/* offset of mapping, bytes */
88
	size_t			iomap_delta;
87
	loff_t			iomap_bsize;	/* size of mapping, bytes */
89
	size_t			iomap_bsize;
88
	size_t			iomap_delta;	/* offset into mapping, bytes */
90
	iomap_flags_t		iomap_flags;
89
	iomap_flags_t		iomap_flags;
91
} xfs_iomap_t;
90
} xfs_iomap_t;
92
91
(-)/usr/tmp/TmpDir.24441-0/linux-2.6/xfs_aops.c_1.56 (-4 / +17 lines)
 Lines 407-414    Link Here 
407
	offset <<= PAGE_CACHE_SHIFT;
407
	offset <<= PAGE_CACHE_SHIFT;
408
	offset += p_offset;
408
	offset += p_offset;
409
409
410
	pb = pagebuf_lookup(iomapp->iomap_target,
410
	/* get an "empty" pagebuf to manage IO completion
411
			    iomapp->iomap_offset, iomapp->iomap_bsize, 0);
411
	 * Proper values will be set before returning */
412
	pb = pagebuf_lookup(iomapp->iomap_target, 0, 0, 0);
413
412
	if (!pb)
414
	if (!pb)
413
		return -EAGAIN;
415
		return -EAGAIN;
414
416
 Lines 471-476    Link Here 
471
			nblocks += bs;
473
			nblocks += bs;
472
			atomic_add(bs, &pb->pb_io_remaining);
474
			atomic_add(bs, &pb->pb_io_remaining);
473
			convert_page(inode, page, iomapp, pb, startio, all_bh);
475
			convert_page(inode, page, iomapp, pb, startio, all_bh);
476
                        /* stop if converting the next page might add
477
			 * enough blocks that the corresponding byte
478
			 * count won't fit in our ulong page buf length */
479
			if (nblocks >= ((ULONG_MAX - PAGE_SIZE) >> block_bits))
480
				goto enough;
474
		}
481
		}
475
482
476
		if (tindex == tlast &&
483
		if (tindex == tlast &&
 Lines 481-496    Link Here 
481
				nblocks += bs;
488
				nblocks += bs;
482
				atomic_add(bs, &pb->pb_io_remaining);
489
				atomic_add(bs, &pb->pb_io_remaining);
483
				convert_page(inode, page, iomapp, pb, startio, all_bh);
490
				convert_page(inode, page, iomapp, pb, startio, all_bh);
491
				if (nblocks >= ((ULONG_MAX - PAGE_SIZE) >> block_bits))
492
					goto enough;
484
			}
493
			}
485
		}
494
		}
486
	}
495
	}
487
496
497
enough:
488
	size = nblocks;		/* NB: using 64bit number here */
498
	size = nblocks;		/* NB: using 64bit number here */
489
	size <<= block_bits;	/* convert fsb's to byte range */
499
	size <<= block_bits;	/* convert fsb's to byte range */
490
500
491
	XFS_BUF_DATAIO(pb);
501
	XFS_BUF_DATAIO(pb);
492
	XFS_BUF_ASYNC(pb);
502
	XFS_BUF_ASYNC(pb);
493
	XFS_BUF_SET_SIZE(pb, size);
503
	XFS_BUF_SET_SIZE(pb, size);
504
	XFS_BUF_SET_COUNT(pb, size);
494
	XFS_BUF_SET_OFFSET(pb, offset);
505
	XFS_BUF_SET_OFFSET(pb, offset);
495
	XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode));
506
	XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode));
496
	XFS_BUF_SET_IODONE_FUNC(pb, linvfs_unwritten_convert);
507
	XFS_BUF_SET_IODONE_FUNC(pb, linvfs_unwritten_convert);
 Lines 925-932    Link Here 
925
	}
936
	}
926
937
927
	if (blocks) {
938
	if (blocks) {
928
		size = (iomap.iomap_bsize - iomap.iomap_delta); 
939
		loff_t iosize;
929
		bh_result->b_size = min_t(ssize_t, size, blocks << inode->i_blkbits);
940
		iosize = (iomap.iomap_bsize - iomap.iomap_delta);
941
		bh_result->b_size =
942
		    (ssize_t)min(iosize, (loff_t)(blocks << inode->i_blkbits));
930
	}
943
	}
931
944
932
	return 0;
945
	return 0;
(-)/usr/tmp/TmpDir.24452-0/linux-2.4/xfs_aops.c_1.66 (-5 / +19 lines)
 Lines 374-381    Link Here 
374
	offset <<= PAGE_CACHE_SHIFT;
374
	offset <<= PAGE_CACHE_SHIFT;
375
	offset += p_offset;
375
	offset += p_offset;
376
376
377
	pb = pagebuf_lookup(iomapp->iomap_target,
377
	/* get an "empty" pagebuf to manage IO completion
378
			    iomapp->iomap_offset, iomapp->iomap_bsize, 0);
378
	 * Proper values will be set before returning */
379
	pb = pagebuf_lookup(iomapp->iomap_target, 0, 0, 0);
379
	if (!pb)
380
	if (!pb)
380
		return -EAGAIN;
381
		return -EAGAIN;
381
382
 Lines 438-443    Link Here 
438
			nblocks += bs;
439
			nblocks += bs;
439
			atomic_add(bs, &pb->pb_io_remaining);
440
			atomic_add(bs, &pb->pb_io_remaining);
440
			convert_page(inode, page, iomapp, pb, startio, all_bh);
441
			convert_page(inode, page, iomapp, pb, startio, all_bh);
442
			/* stop if converting the next page might add
443
			 * enough blocks that the corresponding byte
444
			 * count won't fit in our ulong page buf length */
445
			if (nblocks >= ((ULONG_MAX - PAGE_SIZE) >> block_bits))
446
				goto enough;
441
		}
447
		}
442
448
443
		if (tindex == tlast &&
449
		if (tindex == tlast &&
 Lines 448-463    Link Here 
448
				nblocks += bs;
454
				nblocks += bs;
449
				atomic_add(bs, &pb->pb_io_remaining);
455
				atomic_add(bs, &pb->pb_io_remaining);
450
				convert_page(inode, page, iomapp, pb, startio, all_bh);
456
				convert_page(inode, page, iomapp, pb, startio, all_bh);
457
				if (nblocks >= ((ULONG_MAX - PAGE_SIZE) >> block_bits))
458
					goto enough;
451
			}
459
			}
452
		}
460
		}
453
	}
461
	}
454
462
463
enough:
455
	size = nblocks;		/* NB: using 64bit number here */
464
	size = nblocks;		/* NB: using 64bit number here */
456
	size <<= block_bits;	/* convert fsb's to byte range */
465
	size <<= block_bits;	/* convert fsb's to byte range */
457
466
458
	XFS_BUF_DATAIO(pb);
467
	XFS_BUF_DATAIO(pb);
459
	XFS_BUF_ASYNC(pb);
468
	XFS_BUF_ASYNC(pb);
460
	XFS_BUF_SET_SIZE(pb, size);
469
	XFS_BUF_SET_SIZE(pb, size);
470
	XFS_BUF_SET_COUNT(pb, size);
461
	XFS_BUF_SET_OFFSET(pb, offset);
471
	XFS_BUF_SET_OFFSET(pb, offset);
462
	XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode));
472
	XFS_BUF_SET_FSPRIVATE(pb, LINVFS_GET_VP(inode));
463
	XFS_BUF_SET_IODONE_FUNC(pb, linvfs_unwritten_convert);
473
	XFS_BUF_SET_IODONE_FUNC(pb, linvfs_unwritten_convert);
 Lines 1133-1142    Link Here 
1133
	int			error = 0;
1143
	int			error = 0;
1134
	int			pb_flags, map_flags, pg_index = 0;
1144
	int			pb_flags, map_flags, pg_index = 0;
1135
	size_t			length, total;
1145
	size_t			length, total;
1136
	loff_t			offset;
1146
	loff_t			offset, map_size;
1137
	size_t			map_size, size;
1147
	size_t			size;
1138
	vnode_t			*vp = LINVFS_GET_VP(inode);
1148
	vnode_t			*vp = LINVFS_GET_VP(inode);
1139
1149
1150
	/* Note - although the iomap could have a 64-bit size,
1151
	 * kiobuf->length is only an int, so the min(map_size, length)
1152
	 * test will keep us from overflowing the pagebuf size_t size.
1153
	 */
1140
	total = length = iobuf->length;
1154
	total = length = iobuf->length;
1141
	offset = blocknr;
1155
	offset = blocknr;
1142
	offset <<= inode->i_blkbits;
1156
	offset <<= inode->i_blkbits;
 Lines 1153-1159    Link Here 
1153
		BUG_ON(iomap.iomap_flags & IOMAP_DELAY);
1167
		BUG_ON(iomap.iomap_flags & IOMAP_DELAY);
1154
1168
1155
		map_size = iomap.iomap_bsize - iomap.iomap_delta;
1169
		map_size = iomap.iomap_bsize - iomap.iomap_delta;
1156
		size = min(map_size, length);
1170
		size = (size_t)min(map_size, (loff_t)length);
1157
1171
1158
		if ((iomap.iomap_flags & IOMAP_HOLE) ||
1172
		if ((iomap.iomap_flags & IOMAP_HOLE) ||
1159
		    ((iomap.iomap_flags & IOMAP_UNWRITTEN) && rw == READ)) {
1173
		    ((iomap.iomap_flags & IOMAP_UNWRITTEN) && rw == READ)) {

Return to bug 300