Clone the {b|bio}_offset field, and make sure it is always initialized
in struct bio. Eventually, bio_offset will probably obsolete the bio_blkno and bio_pblkno fields. Remove the special hack in atapi-cd.c to determine of bio_offset was valid.
This commit is contained in:
parent
7dbc44ea92
commit
a708c222de
@ -1146,14 +1146,7 @@ acd_start(struct atapi_softc *atp)
|
|||||||
|
|
||||||
bzero(ccb, sizeof(ccb));
|
bzero(ccb, sizeof(ccb));
|
||||||
count = (bp->bio_bcount + (cdp->block_size - 1)) / cdp->block_size;
|
count = (bp->bio_bcount + (cdp->block_size - 1)) / cdp->block_size;
|
||||||
{
|
lba = bp->bio_offset / cdp->block_size;
|
||||||
/* XXX Hack until b_offset is always initialized */
|
|
||||||
struct buf *bup = (struct buf *)bp;
|
|
||||||
if (bup->b_flags & B_PHYS)
|
|
||||||
lba = bup->b_offset / cdp->block_size;
|
|
||||||
else
|
|
||||||
lba = bp->bio_blkno / (cdp->block_size / DEV_BSIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bp->bio_cmd == BIO_READ) {
|
if (bp->bio_cmd == BIO_READ) {
|
||||||
/* if transfer goes beyond EOM adjust it to be within limits */
|
/* if transfer goes beyond EOM adjust it to be within limits */
|
||||||
|
@ -201,6 +201,8 @@ diskstrategy(struct bio *bp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KASSERT(dp->d_devsw != NULL, ("NULL devsw"));
|
||||||
|
KASSERT(dp->d_devsw->d_strategy != NULL, ("NULL d_strategy"));
|
||||||
dp->d_devsw->d_strategy(bp);
|
dp->d_devsw->d_strategy(bp);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -137,9 +137,9 @@ struct buf {
|
|||||||
#define b_iodone b_io.bio_done
|
#define b_iodone b_io.bio_done
|
||||||
#define b_iodone_chain b_io.bio_done_chain
|
#define b_iodone_chain b_io.bio_done_chain
|
||||||
#define b_ioflags b_io.bio_flags
|
#define b_ioflags b_io.bio_flags
|
||||||
#define b_offset b_io.bio_offset
|
|
||||||
#define b_pblkno b_io.bio_pblkno
|
#define b_pblkno b_io.bio_pblkno
|
||||||
#define b_resid b_io.bio_resid
|
#define b_resid b_io.bio_resid
|
||||||
|
off_t b_offset; /* Offset into file. */
|
||||||
LIST_ENTRY(buf) b_hash; /* Hash chain. */
|
LIST_ENTRY(buf) b_hash; /* Hash chain. */
|
||||||
TAILQ_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
|
TAILQ_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
|
||||||
TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
|
TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
|
||||||
|
@ -137,9 +137,9 @@ struct buf {
|
|||||||
#define b_iodone b_io.bio_done
|
#define b_iodone b_io.bio_done
|
||||||
#define b_iodone_chain b_io.bio_done_chain
|
#define b_iodone_chain b_io.bio_done_chain
|
||||||
#define b_ioflags b_io.bio_flags
|
#define b_ioflags b_io.bio_flags
|
||||||
#define b_offset b_io.bio_offset
|
|
||||||
#define b_pblkno b_io.bio_pblkno
|
#define b_pblkno b_io.bio_pblkno
|
||||||
#define b_resid b_io.bio_resid
|
#define b_resid b_io.bio_resid
|
||||||
|
off_t b_offset; /* Offset into file. */
|
||||||
LIST_ENTRY(buf) b_hash; /* Hash chain. */
|
LIST_ENTRY(buf) b_hash; /* Hash chain. */
|
||||||
TAILQ_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
|
TAILQ_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */
|
||||||
TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
|
TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */
|
||||||
|
@ -138,11 +138,15 @@ typedef void devfs_remove_t __P((dev_t dev));
|
|||||||
* of surgery, reset the flag and restart all the stuff on the stall
|
* of surgery, reset the flag and restart all the stuff on the stall
|
||||||
* queue.
|
* queue.
|
||||||
*/
|
*/
|
||||||
#define DEV_STRATEGY(bp, dummy) \
|
#define DEV_STRATEGY(bp, dummy) \
|
||||||
do { \
|
do { \
|
||||||
if ((!(bp)->b_iocmd) || ((bp)->b_iocmd & ((bp)->b_iocmd - 1))) \
|
if ((!(bp)->b_iocmd) || ((bp)->b_iocmd & ((bp)->b_iocmd - 1))) \
|
||||||
Debugger("d_iocmd botch"); \
|
Debugger("d_iocmd botch"); \
|
||||||
(*devsw((bp)->b_dev)->d_strategy)(&(bp)->b_io); \
|
if ((bp)->b_flags & B_PHYS) \
|
||||||
|
(bp)->b_io.bio_offset = (bp)->b_offset; \
|
||||||
|
else \
|
||||||
|
(bp)->b_io.bio_offset = dbtob((bp)->b_blkno); \
|
||||||
|
(*devsw((bp)->b_dev)->d_strategy)(&(bp)->b_io); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -138,11 +138,15 @@ typedef void devfs_remove_t __P((dev_t dev));
|
|||||||
* of surgery, reset the flag and restart all the stuff on the stall
|
* of surgery, reset the flag and restart all the stuff on the stall
|
||||||
* queue.
|
* queue.
|
||||||
*/
|
*/
|
||||||
#define DEV_STRATEGY(bp, dummy) \
|
#define DEV_STRATEGY(bp, dummy) \
|
||||||
do { \
|
do { \
|
||||||
if ((!(bp)->b_iocmd) || ((bp)->b_iocmd & ((bp)->b_iocmd - 1))) \
|
if ((!(bp)->b_iocmd) || ((bp)->b_iocmd & ((bp)->b_iocmd - 1))) \
|
||||||
Debugger("d_iocmd botch"); \
|
Debugger("d_iocmd botch"); \
|
||||||
(*devsw((bp)->b_dev)->d_strategy)(&(bp)->b_io); \
|
if ((bp)->b_flags & B_PHYS) \
|
||||||
|
(bp)->b_io.bio_offset = (bp)->b_offset; \
|
||||||
|
else \
|
||||||
|
(bp)->b_io.bio_offset = dbtob((bp)->b_blkno); \
|
||||||
|
(*devsw((bp)->b_dev)->d_strategy)(&(bp)->b_io); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user