sector_shift = block_bits - BBSHIFT;
bn = iomapp->iomap_bn >> sector_shift;
bn += delta;
+ BUG_ON(!bn && !(iomapp->iomap_flags & IOMAP_REALTIME));
ASSERT((bn << sector_shift) >= iomapp->iomap_bn);
lock_buffer(bh);
bn = iomap.iomap_bn >> (inode->i_blkbits - BBSHIFT);
bn += delta;
-
+ BUG_ON(!bn && !(iomap.iomap_flags & IOMAP_REALTIME));
bh_result->b_blocknr = bn;
- bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
set_buffer_mapped(bh_result);
}
if (create && (iomap.iomap_flags & IOMAP_UNWRITTEN)) {
}
if (iomap.iomap_flags & IOMAP_DELAY) {
- if (unlikely(direct))
- BUG();
+ BUG_ON(direct);
if (create) {
set_buffer_mapped(bh_result);
set_buffer_uptodate(bh_result);
}
- bh_result->b_bdev = iomap.iomap_target->pbr_bdev;
set_buffer_delay(bh_result);
}
if (blocks) {
- loff_t iosize;
- iosize = (iomap.iomap_bsize - iomap.iomap_delta);
- bh_result->b_size =
- (ssize_t)min(iosize, (loff_t)(blocks << inode->i_blkbits));
+ bh_result->b_size = (ssize_t)min(
+ (loff_t)(iomap.iomap_bsize - iomap.iomap_delta),
+ (loff_t)(blocks << inode->i_blkbits));
}
return 0;
/*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
+ * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
int high; /* high index of binary search */
int low; /* low index of binary search */
+ /* Initialize the extent entry structure to catch access to
+ * uninitialized br_startblock field.
+ */
+
+ got.br_startoff = 0xffa5a5a5a5a5a5a5;
+ got.br_blockcount = 0xa55a5a5a5a5a5a5a;
+ got.br_state = XFS_EXT_INVALID;
+
+ #if XFS_BIG_BLKNOS
+ got.br_startblock = 0xffffa5a5a5a5a5a5;
+ #else
+ got.br_startblock = 0xffffa5a5;
+ #endif
if (lastx != NULLEXTNUM && lastx < nextents)
ep = base + lastx;
else
xfs_bmbt_rec_t *base; /* base of extent list */
xfs_extnum_t lastx; /* last extent index used */
xfs_extnum_t nextents; /* extent list size */
+ xfs_bmbt_rec_t *ep; /* extent list entry pointer */
+ int rt; /* realtime flag */
XFS_STATS_INC(xs_look_exlist);
ifp = XFS_IFORK_PTR(ip, whichfork);
nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
base = &ifp->if_u1.if_extents[0];
- return xfs_bmap_do_search_extents(base, lastx, nextents, bno, eofp,
+ ep = xfs_bmap_do_search_extents(base, lastx, nextents, bno, eofp,
lastxp, gotp, prevp);
+ rt = ip->i_d.di_flags & XFS_DIFLAG_REALTIME;
+ if(!rt && !gotp->br_startblock && (*lastxp != NULLEXTNUM)) {
+ cmn_err(CE_PANIC,"Access to block zero: fs: <%s> inode: %lld "
+ "start_block : %llx start_off : %llx blkcnt : %llx "
+ "extent-state : %x \n",
+ (ip->i_mount)->m_fsname,(long long)ip->i_ino,
+ gotp->br_startblock, gotp->br_startoff,
+ gotp->br_blockcount,gotp->br_state);
+ }
+ return ep;
}
nisize = io->io_new_size;
for (pbm = 0; imaps && pbm < iomaps; imaps--, iomapp++, imap++, pbm++) {
- iomapp->iomap_target = io->io_flags & XFS_IOCORE_RT ?
- mp->m_rtdev_targp : mp->m_ddev_targp;
iomapp->iomap_offset = XFS_FSB_TO_B(mp, imap->br_startoff);
iomapp->iomap_delta = offset - iomapp->iomap_offset;
iomapp->iomap_bsize = XFS_FSB_TO_B(mp, imap->br_blockcount);
iomapp->iomap_flags = flags;
+ if (io->io_flags & XFS_IOCORE_RT) {
+ iomapp->iomap_flags |= IOMAP_REALTIME;
+ iomapp->iomap_target = mp->m_rtdev_targp;
+ } else {
+ iomapp->iomap_target = mp->m_ddev_targp;
+ }
start_block = imap->br_startblock;
if (start_block == HOLESTARTBLOCK) {
iomapp->iomap_bn = IOMAP_DADDR_NULL;
- iomapp->iomap_flags = IOMAP_HOLE;
+ iomapp->iomap_flags |= IOMAP_HOLE;
} else if (start_block == DELAYSTARTBLOCK) {
iomapp->iomap_bn = IOMAP_DADDR_NULL;
- iomapp->iomap_flags = IOMAP_DELAY;
+ iomapp->iomap_flags |= IOMAP_DELAY;
} else {
iomapp->iomap_bn = XFS_FSB_TO_DB_IO(io, start_block);
if (ISUNWRITTEN(imap))
*ret_imap = imap[0];
*nmaps = 1;
+ if ( !(io->io_flags & XFS_IOCORE_RT) && !ret_imap->br_startblock) {
+ cmn_err(CE_PANIC,"Access to block zero: fs <%s> inode: %lld "
+ "start_block : %llx start_off : %llx blkcnt : %llx "
+ "extent-state : %x \n",
+ (ip->i_mount)->m_fsname,
+ (long long)ip->i_ino,
+ ret_imap->br_startblock, ret_imap->br_startoff,
+ ret_imap->br_blockcount,ret_imap->br_state);
+ }
return 0;
error0: /* Cancel bmap, unlock inode, and cancel trans */
return error;
}
for (n = 0; n < nimaps; n++) {
+ if ( !(io->io_flags & XFS_IOCORE_RT) &&
+ !imap[n].br_startblock) {
+ cmn_err(CE_PANIC,"Access to block "
+ "zero: fs <%s> inode: %lld "
+ "start_block : %llx start_off "
+ ": %llx blkcnt : %llx "
+ "extent-state : %x \n",
+ (ip->i_mount)->m_fsname,
+ (long long)ip->i_ino,
+ imap[n].br_startblock,
+ imap[n].br_startoff,
+ imap[n].br_blockcount,
+ imap[n].br_state);
+ }
if ((imap[n].br_startblock != HOLESTARTBLOCK) &&
(imap[n].br_startblock != DELAYSTARTBLOCK)) {
goto write_map;
*ret_imap = imap[0];
*nmaps = 1;
+ if ( !(io->io_flags & XFS_IOCORE_RT) && !ret_imap->br_startblock) {
+ cmn_err(CE_PANIC,"Access to block zero: fs <%s> inode: %lld "
+ "start_block : %llx start_off : %llx blkcnt : %llx "
+ "extent-state : %x \n",
+ (ip->i_mount)->m_fsname,
+ (long long)ip->i_ino,
+ ret_imap->br_startblock, ret_imap->br_startoff,
+ ret_imap->br_blockcount,ret_imap->br_state);
+ }
return 0;
}
int *retmap)
{
xfs_mount_t *mp = ip->i_mount;
+ xfs_iocore_t *io = &ip->i_iocore;
xfs_fileoff_t offset_fsb, last_block;
xfs_fileoff_t end_fsb, map_start_fsb;
xfs_fsblock_t first_block;
*/
for (i = 0; i < nimaps; i++) {
+ if ( !(io->io_flags & XFS_IOCORE_RT) &&
+ !imap[i].br_startblock) {
+ cmn_err(CE_PANIC,"Access to block zero: "
+ "fs <%s> inode: %lld "
+ "start_block : %llx start_off : %llx "
+ "blkcnt : %llx extent-state : %x \n",
+ (ip->i_mount)->m_fsname,
+ (long long)ip->i_ino,
+ imap[i].br_startblock,
+ imap[i].br_startoff,
+ imap[i].br_blockcount,imap[i].br_state);
+ }
if ((map->br_startoff >= imap[i].br_startoff) &&
(map->br_startoff < (imap[i].br_startoff +
imap[i].br_blockcount))) {
size_t count)
{
xfs_mount_t *mp = ip->i_mount;
+ xfs_iocore_t *io = &ip->i_iocore;
xfs_trans_t *tp;
xfs_fileoff_t offset_fsb;
xfs_filblks_t count_fsb;
xfs_iunlock(ip, XFS_ILOCK_EXCL);
if (error)
goto error0;
+
+ if ( !(io->io_flags & XFS_IOCORE_RT) && !imap.br_startblock) {
+ cmn_err(CE_PANIC,"Access to block zero: fs <%s> "
+ "inode: %lld start_block : %llx start_off : "
+ "%llx blkcnt : %llx extent-state : %x \n",
+ (ip->i_mount)->m_fsname,
+ (long long)ip->i_ino,
+ imap.br_startblock,imap.br_startoff,
+ imap.br_blockcount,imap.br_state);
+ }
if ((numblks_fsb = imap.br_blockcount) == 0) {
/*