From 0d2af52141e470c9d601ee5fa41eee692957b488 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Fri, 15 Mar 2002 18:49:47 +0000 Subject: [PATCH] Introduce the new 64-bit size disk block, daddr64_t. Change the bio and buffer structures to have daddr64_t bio_pblkno, b_blkno, and b_lblkno fields which allows access to disks larger than a Terabyte in size. This change also requires that the VOP_BMAP vnode operation accept and return daddr64_t blocks. This delta should not affect system operation in any way. It merely sets up the necessary interfaces to allow the development of disk drivers that work with these larger disk block addresses. It also allows for the development of UFS2 which will use 64-bit block addresses. --- sys/coda/coda_vnops.c | 4 ++-- sys/dev/ccd/ccd.c | 2 +- sys/dev/md/md.c | 2 +- sys/dev/vinum/vinumdaemon.c | 2 +- sys/dev/vinum/vinuminterrupt.c | 12 ++++++------ sys/dev/vinum/vinumrequest.c | 8 ++++---- sys/dev/vinum/vinumrevive.c | 2 +- sys/fs/coda/coda_vnops.c | 4 ++-- sys/fs/hpfs/hpfs_vnops.c | 8 ++++++-- sys/fs/msdosfs/msdosfs_fat.c | 5 ++++- sys/fs/msdosfs/msdosfs_vnops.c | 19 +++++++++++++------ sys/geom/geom_ccd.c | 2 +- sys/gnu/ext2fs/ext2_bmap.c | 13 +++++++++---- sys/gnu/ext2fs/ext2_subr.c | 2 +- sys/gnu/fs/ext2fs/ext2_bmap.c | 13 +++++++++---- sys/gnu/fs/ext2fs/ext2_subr.c | 2 +- sys/kern/vfs_bio.c | 4 ++-- sys/kern/vfs_cluster.c | 6 +++--- sys/kern/vnode_if.src | 4 ++-- sys/sys/bio.h | 6 +++--- sys/sys/buf.h | 4 ++-- sys/sys/types.h | 1 + sys/ufs/ffs/ffs_snapshot.c | 8 ++++---- sys/ufs/ffs/ffs_softdep.c | 7 +++++-- sys/ufs/ufs/ufs_bmap.c | 13 +++++++++---- sys/ufs/ufs/ufs_vnops.c | 4 +++- sys/vm/vnode_pager.c | 4 ++-- 27 files changed, 98 insertions(+), 63 deletions(-) diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c index 3c3eee9a95a0..646ee34b9d0b 100644 --- a/sys/coda/coda_vnops.c +++ b/sys/coda/coda_vnops.c @@ -1693,7 +1693,7 @@ coda_bmap(v) struct vnode *vp __attribute__((unused)) = ap->a_vp; /* file's vnode */ daddr_t bn __attribute__((unused)) = ap->a_bn; /* fs block number */ struct vnode **vpp = ap->a_vpp; /* RETURN vp of device */ - daddr_t *bnp __attribute__((unused)) = ap->a_bnp; /* RETURN device block number */ + daddr64_t *bnp __attribute__((unused)) = ap->a_bnp; /* RETURN device block number */ struct thread *td __attribute__((unused)) = curthread; /* upcall decl */ /* locals */ @@ -1706,7 +1706,7 @@ coda_bmap(v) return EINVAL; ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb); #if 0 - printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %p, ap->a_runp %p, ap->a_runb %p) = %d\n", + printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %lld, ap->a_runp %p, ap->a_runb %p) = %d\n", cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret); #endif return ret; diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index a1d196582a36..72b2f7ea2d6c 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -1173,7 +1173,7 @@ ccdiodone(struct bio *ibp) bp->bio_error = cbp->cb_buf.bio_error ? cbp->cb_buf.bio_error : EIO; } - printf("ccd%d: error %d on component %d block %d (ccd block %d)%s\n", + printf("ccd%d: error %d on component %d block %d (ccd block %lld)%s\n", unit, bp->bio_error, cbp->cb_comp, (int)cbp->cb_buf.bio_blkno, bp->bio_blkno, msg); } diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index c1ddf8a92ff9..27f54994d70e 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -383,7 +383,7 @@ mdstrategy(struct bio *bp) int error; if (md_debug > 1) - printf("mdstrategy(%p) %s %x, %d, %ld, %p)\n", + printf("mdstrategy(%p) %s %x, %lld, %ld, %p)\n", bp, devtoname(bp->bio_dev), bp->bio_flags, bp->bio_blkno, bp->bio_bcount / DEV_BSIZE, bp->bio_data); diff --git a/sys/dev/vinum/vinumdaemon.c b/sys/dev/vinum/vinumdaemon.c index f03d36bca91d..570495b9ee6a 100644 --- a/sys/dev/vinum/vinumdaemon.c +++ b/sys/dev/vinum/vinumdaemon.c @@ -109,7 +109,7 @@ vinum_daemon(void) struct request *rq = request->info.rq; log(LOG_WARNING, - "vinum: recovering I/O request: %p\n%s dev %d.%d, offset 0x%x, length %ld\n", + "vinum: recovering I/O request: %p\n%s dev %d.%d, offset 0x%llx, length %ld\n", rq, rq->bp->b_iocmd == BIO_READ ? "Read" : "Write", major(rq->bp->b_dev), diff --git a/sys/dev/vinum/vinuminterrupt.c b/sys/dev/vinum/vinuminterrupt.c index 288fa580f560..0d40bf21323d 100644 --- a/sys/dev/vinum/vinuminterrupt.c +++ b/sys/dev/vinum/vinuminterrupt.c @@ -100,7 +100,7 @@ complete_rqe(struct buf *bp) set_sd_state(rqe->sdno, sd_crashed, setstate_force); /* subdisk is crashed */ } log(LOG_ERR, - "%s:%s read error, block %d for %ld bytes\n", + "%s:%s read error, block %lld for %ld bytes\n", gravity, sd->name, bp->b_blkno, @@ -111,20 +111,20 @@ complete_rqe(struct buf *bp) set_sd_state(rqe->sdno, sd_stale, setstate_force); /* subdisk is stale */ } log(LOG_ERR, - "%s:%s write error, block %d for %ld bytes\n", + "%s:%s write error, block %lld for %ld bytes\n", gravity, sd->name, bp->b_blkno, bp->b_bcount); } log(LOG_ERR, - "%s: user buffer block %d for %ld bytes\n", + "%s: user buffer block %lld for %ld bytes\n", sd->name, ubp->b_blkno, ubp->b_bcount); if (rq->error == ENXIO) { /* the drive's down too */ log(LOG_ERR, - "%s: fatal drive I/O error, block %d for %ld bytes\n", + "%s: fatal drive I/O error, block %lld for %ld bytes\n", DRIVE[rqe->driveno].label.name, bp->b_blkno, bp->b_bcount); @@ -409,7 +409,7 @@ complete_raid5_write(struct rqelement *rqe) #ifdef VINUMDEBUG if (debug & DEBUG_ADDRESSES) log(LOG_DEBUG, - " %s dev %d.%d, sd %d, offset 0x%x, devoffset 0x%x, length %ld\n", + " %s dev %d.%d, sd %d, offset 0x%x, devoffset 0x%llx, length %ld\n", rqe->b.b_iocmd == BIO_READ ? "Read" : "Write", major(rqe->b.b_dev), minor(rqe->b.b_dev), @@ -448,7 +448,7 @@ complete_raid5_write(struct rqelement *rqe) #ifdef VINUMDEBUG if (debug & DEBUG_ADDRESSES) log(LOG_DEBUG, - " %s dev %d.%d, sd %d, offset 0x%x, devoffset 0x%x, length %ld\n", + " %s dev %d.%d, sd %d, offset 0x%x, devoffset 0x%llx, length %ld\n", rqe->b.b_iocmd == BIO_READ ? "Read" : "Write", major(rqe->b.b_dev), minor(rqe->b.b_dev), diff --git a/sys/dev/vinum/vinumrequest.c b/sys/dev/vinum/vinumrequest.c index e7cd1c4cc48d..9dde28c1af07 100644 --- a/sys/dev/vinum/vinumrequest.c +++ b/sys/dev/vinum/vinumrequest.c @@ -340,7 +340,7 @@ launch_requests(struct request *rq, int reviveok) #ifdef VINUMDEBUG if (debug & DEBUG_REVIVECONFLICT) log(LOG_DEBUG, - "Revive conflict sd %d: %p\n%s dev %d.%d, offset 0x%x, length %ld\n", + "Revive conflict sd %d: %p\n%s dev %d.%d, offset 0x%llx, length %ld\n", rq->sdno, rq, rq->bp->b_iocmd == BIO_READ ? "Read" : "Write", @@ -355,7 +355,7 @@ launch_requests(struct request *rq, int reviveok) #ifdef VINUMDEBUG if (debug & DEBUG_ADDRESSES) log(LOG_DEBUG, - "Request: %p\n%s dev %d.%d, offset 0x%x, length %ld\n", + "Request: %p\n%s dev %d.%d, offset 0x%llx, length %ld\n", rq, rq->bp->b_iocmd == BIO_READ ? "Read" : "Write", major(rq->bp->b_dev), @@ -427,7 +427,7 @@ launch_requests(struct request *rq, int reviveok) #ifdef VINUMDEBUG if (debug & DEBUG_ADDRESSES) log(LOG_DEBUG, - " %s dev %d.%d, sd %d, offset 0x%x, devoffset 0x%x, length %ld\n", + " %s dev %d.%d, sd %d, offset 0x%x, devoffset 0x%llx, length %ld\n", rqe->b.b_iocmd == BIO_READ ? "Read" : "Write", major(rqe->b.b_dev), minor(rqe->b.b_dev), @@ -630,7 +630,7 @@ bre(struct request *rq, #ifdef VINUMDEBUG if (debug & DEBUG_EOFINFO) { /* tell on the request */ log(LOG_DEBUG, - "vinum: EOF on plex %s, sd %s offset %x (user offset %x)\n", + "vinum: EOF on plex %s, sd %s offset %x (user offset %llx)\n", plex->name, sd->name, (u_int) sd->sectors, diff --git a/sys/dev/vinum/vinumrevive.c b/sys/dev/vinum/vinumrevive.c index 85b73f3f011c..1e368dbed95c 100644 --- a/sys/dev/vinum/vinumrevive.c +++ b/sys/dev/vinum/vinumrevive.c @@ -201,7 +201,7 @@ revive_block(int sdno) if (debug & DEBUG_REVIVECONFLICT) log(LOG_DEBUG, - "Relaunch revive conflict sd %d: %p\n%s dev %d.%d, offset 0x%x, length %ld\n", + "Relaunch revive conflict sd %d: %p\n%s dev %d.%d, offset 0x%llx, length %ld\n", rq->sdno, rq, rq->bp->b_iocmd == BIO_READ ? "Read" : "Write", diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index 3c3eee9a95a0..646ee34b9d0b 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -1693,7 +1693,7 @@ coda_bmap(v) struct vnode *vp __attribute__((unused)) = ap->a_vp; /* file's vnode */ daddr_t bn __attribute__((unused)) = ap->a_bn; /* fs block number */ struct vnode **vpp = ap->a_vpp; /* RETURN vp of device */ - daddr_t *bnp __attribute__((unused)) = ap->a_bnp; /* RETURN device block number */ + daddr64_t *bnp __attribute__((unused)) = ap->a_bnp; /* RETURN device block number */ struct thread *td __attribute__((unused)) = curthread; /* upcall decl */ /* locals */ @@ -1706,7 +1706,7 @@ coda_bmap(v) return EINVAL; ret = VOP_BMAP(cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb); #if 0 - printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %p, ap->a_runp %p, ap->a_runb %p) = %d\n", + printf("VOP_BMAP(cp->c_ovp %p, bn %p, vpp %p, bnp %lld, ap->a_runp %p, ap->a_runb %p) = %d\n", cp->c_ovp, bn, vpp, bnp, ap->a_runp, ap->a_runb, ret); #endif return ret; diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index 2e6ec561fc06..e3ed555d342a 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -275,6 +275,7 @@ hpfs_bmap(ap) } */ *ap; { register struct hpfsnode *hp = VTOHP(ap->a_vp); + daddr_t blkno; int error; if (ap->a_vpp != NULL) @@ -286,7 +287,8 @@ hpfs_bmap(ap) dprintf(("hpfs_bmap(0x%x, 0x%x): ",hp->h_no, ap->a_bn)); - error = hpfs_hpbmap (hp, ap->a_bn, ap->a_bnp, ap->a_runp); + error = hpfs_hpbmap (hp, ap->a_bn, &blkno, ap->a_runp); + *ap->a_bnp = blkno; return (error); } @@ -677,6 +679,7 @@ hpfs_strategy(ap) register struct buf *bp = ap->a_bp; register struct vnode *vp = ap->a_vp; register struct hpfsnode *hp = VTOHP(ap->a_vp); + daddr_t blkno; int error; dprintf(("hpfs_strategy(): \n")); @@ -684,7 +687,8 @@ hpfs_strategy(ap) if (vp->v_type == VBLK || vp->v_type == VCHR) panic("hpfs_strategy: spec"); if (bp->b_blkno == bp->b_lblkno) { - error = hpfs_hpbmap (hp, bp->b_lblkno, &bp->b_blkno, NULL); + error = hpfs_hpbmap (hp, bp->b_lblkno, &blkno, NULL); + bp->b_blkno = blkno; if (error) { printf("hpfs_strategy: hpfs_bpbmap FAILED %d\n", error); bp->b_error = error; diff --git a/sys/fs/msdosfs/msdosfs_fat.c b/sys/fs/msdosfs/msdosfs_fat.c index 828edb7066be..7c4f6c923566 100644 --- a/sys/fs/msdosfs/msdosfs_fat.c +++ b/sys/fs/msdosfs/msdosfs_fat.c @@ -994,6 +994,7 @@ extendfile(dep, count, bpp, ncp, flags) u_long cn, got; struct msdosfsmount *pmp = dep->de_pmp; struct buf *bp; + daddr_t blkno; /* * Don't try to extend the root directory @@ -1083,10 +1084,12 @@ extendfile(dep, count, bpp, ncp, flags) */ if (pcbmap(dep, de_bn2cn(pmp, bp->b_lblkno), - &bp->b_blkno, 0, 0)) + &blkno, 0, 0)) bp->b_blkno = -1; if (bp->b_blkno == -1) panic("extendfile: pcbmap"); + else + bp->b_blkno = blkno; } clrbuf(bp); if (bpp) { diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index d506937f1a6f..51e541fb6db4 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -711,10 +711,11 @@ msdosfs_write(ap) * for the fat table. (see msdosfs_strategy) */ if (bp->b_blkno == bp->b_lblkno) { - error = pcbmap(dep, bp->b_lblkno, &bp->b_blkno, - 0, 0); + error = pcbmap(dep, bp->b_lblkno, &bn, 0, 0); if (error) bp->b_blkno = -1; + else + bp->b_blkno = bn; } if (bp->b_blkno == -1) { brelse(bp); @@ -1733,14 +1734,16 @@ static int msdosfs_bmap(ap) struct vop_bmap_args /* { struct vnode *a_vp; - daddr_t a_bn; + daddr64_t a_bn; struct vnode **a_vpp; - daddr_t *a_bnp; + daddr64_t *a_bnp; int *a_runp; int *a_runb; } */ *ap; { struct denode *dep = VTODE(ap->a_vp); + daddr_t blkno; + int error; if (ap->a_vpp != NULL) *ap->a_vpp = dep->de_devvp; @@ -1755,7 +1758,9 @@ msdosfs_bmap(ap) if (ap->a_runb) { *ap->a_runb = 0; } - return (pcbmap(dep, ap->a_bn, ap->a_bnp, 0, 0)); + error = pcbmap(dep, ap->a_bn, &blkno, 0, 0); + *ap->a_bnp = blkno; + return (error); } static int @@ -1769,6 +1774,7 @@ msdosfs_strategy(ap) struct denode *dep = VTODE(bp->b_vp); struct vnode *vp; int error = 0; + daddr_t blkno; if (bp->b_vp->v_type == VBLK || bp->b_vp->v_type == VCHR) panic("msdosfs_strategy: spec"); @@ -1779,7 +1785,8 @@ msdosfs_strategy(ap) * don't allow files with holes, so we shouldn't ever see this. */ if (bp->b_blkno == bp->b_lblkno) { - error = pcbmap(dep, bp->b_lblkno, &bp->b_blkno, 0, 0); + error = pcbmap(dep, bp->b_lblkno, &blkno, 0, 0); + bp->b_blkno = blkno; if (error) { bp->b_error = error; bp->b_ioflags |= BIO_ERROR; diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index a1d196582a36..72b2f7ea2d6c 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -1173,7 +1173,7 @@ ccdiodone(struct bio *ibp) bp->bio_error = cbp->cb_buf.bio_error ? cbp->cb_buf.bio_error : EIO; } - printf("ccd%d: error %d on component %d block %d (ccd block %d)%s\n", + printf("ccd%d: error %d on component %d block %d (ccd block %lld)%s\n", unit, bp->bio_error, cbp->cb_comp, (int)cbp->cb_buf.bio_blkno, bp->bio_blkno, msg); } diff --git a/sys/gnu/ext2fs/ext2_bmap.c b/sys/gnu/ext2fs/ext2_bmap.c index ce4ddb8cfe99..fa8ea019f06e 100644 --- a/sys/gnu/ext2fs/ext2_bmap.c +++ b/sys/gnu/ext2fs/ext2_bmap.c @@ -64,13 +64,16 @@ int ufs_bmap(ap) struct vop_bmap_args /* { struct vnode *a_vp; - ufs_daddr_t a_bn; + daddr64_t a_bn; struct vnode **a_vpp; - ufs_daddr_t *a_bnp; + daddr64_t *a_bnp; int *a_runp; int *a_runb; } */ *ap; { + daddr_t blkno; + int error; + /* * Check for underlying vnode requests and ensure that logical * to physical mapping is requested. @@ -80,8 +83,10 @@ ufs_bmap(ap) if (ap->a_bnp == NULL) return (0); - return (ufs_bmaparray(ap->a_vp, ap->a_bn, ap->a_bnp, - ap->a_runp, ap->a_runb)); + error = ufs_bmaparray(ap->a_vp, ap->a_bn, &blkno, + ap->a_runp, ap->a_runb); + *ap->a_bnp = blkno; + return (error); } /* diff --git a/sys/gnu/ext2fs/ext2_subr.c b/sys/gnu/ext2fs/ext2_subr.c index 49210b00d562..fc8b6233085b 100644 --- a/sys/gnu/ext2fs/ext2_subr.c +++ b/sys/gnu/ext2fs/ext2_subr.c @@ -120,7 +120,7 @@ ext2_checkoverlap(bp, ip) ep->b_blkno + btodb(ep->b_bcount) <= start) continue; vprint("Disk overlap", vp); - (void)printf("\tstart %d, end %d overlap start %d, end %ld\n", + (void)printf("\tstart %d, end %d overlap start %lld, end %ld\n", start, last, ep->b_blkno, (long)(ep->b_blkno + btodb(ep->b_bcount) - 1)); panic("Disk buffer overlap"); diff --git a/sys/gnu/fs/ext2fs/ext2_bmap.c b/sys/gnu/fs/ext2fs/ext2_bmap.c index ce4ddb8cfe99..fa8ea019f06e 100644 --- a/sys/gnu/fs/ext2fs/ext2_bmap.c +++ b/sys/gnu/fs/ext2fs/ext2_bmap.c @@ -64,13 +64,16 @@ int ufs_bmap(ap) struct vop_bmap_args /* { struct vnode *a_vp; - ufs_daddr_t a_bn; + daddr64_t a_bn; struct vnode **a_vpp; - ufs_daddr_t *a_bnp; + daddr64_t *a_bnp; int *a_runp; int *a_runb; } */ *ap; { + daddr_t blkno; + int error; + /* * Check for underlying vnode requests and ensure that logical * to physical mapping is requested. @@ -80,8 +83,10 @@ ufs_bmap(ap) if (ap->a_bnp == NULL) return (0); - return (ufs_bmaparray(ap->a_vp, ap->a_bn, ap->a_bnp, - ap->a_runp, ap->a_runb)); + error = ufs_bmaparray(ap->a_vp, ap->a_bn, &blkno, + ap->a_runp, ap->a_runb); + *ap->a_bnp = blkno; + return (error); } /* diff --git a/sys/gnu/fs/ext2fs/ext2_subr.c b/sys/gnu/fs/ext2fs/ext2_subr.c index 49210b00d562..fc8b6233085b 100644 --- a/sys/gnu/fs/ext2fs/ext2_subr.c +++ b/sys/gnu/fs/ext2fs/ext2_subr.c @@ -120,7 +120,7 @@ ext2_checkoverlap(bp, ip) ep->b_blkno + btodb(ep->b_bcount) <= start) continue; vprint("Disk overlap", vp); - (void)printf("\tstart %d, end %d overlap start %d, end %ld\n", + (void)printf("\tstart %d, end %d overlap start %lld, end %ld\n", start, last, ep->b_blkno, (long)(ep->b_blkno + btodb(ep->b_bcount) - 1)); panic("Disk buffer overlap"); diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index bf4970d47943..87b93ba3e293 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -3349,7 +3349,7 @@ vm_hold_free_pages(struct buf * bp, vm_offset_t from, vm_offset_t to) p = bp->b_pages[index]; if (p && (index < bp->b_npages)) { if (p->busy) { - printf("vm_hold_free_pages: blkno: %d, lblkno: %d\n", + printf("vm_hold_free_pages: blkno: %lld, lblkno: %lld\n", bp->b_blkno, bp->b_lblkno); } bp->b_pages[index] = NULL; @@ -3381,7 +3381,7 @@ DB_SHOW_COMMAND(buffer, db_show_buffer) db_printf("b_flags = 0x%b\n", (u_int)bp->b_flags, PRINT_BUF_FLAGS); db_printf("b_error = %d, b_bufsize = %ld, b_bcount = %ld, " "b_resid = %ld\nb_dev = (%d,%d), b_data = %p, " - "b_blkno = %d, b_pblkno = %d\n", + "b_blkno = %lld, b_pblkno = %lld\n", bp->b_error, bp->b_bufsize, bp->b_bcount, bp->b_resid, major(bp->b_dev), minor(bp->b_dev), bp->b_data, bp->b_blkno, bp->b_pblkno); diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index 2c941fbec30a..59b1f939d33f 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -67,7 +67,7 @@ static struct cluster_save * cluster_collectbufs __P((struct vnode *vp, struct buf *last_bp)); static struct buf * cluster_rbuild __P((struct vnode *vp, u_quad_t filesize, daddr_t lbn, - daddr_t blkno, long size, int run, struct buf *fbp)); + daddr64_t blkno, long size, int run, struct buf *fbp)); static int write_behind = 1; SYSCTL_INT(_vfs, OID_AUTO, write_behind, CTLFLAG_RW, &write_behind, 0, @@ -103,7 +103,7 @@ cluster_read(vp, filesize, lblkno, size, cred, totread, seqcount, bpp) struct buf **bpp; { struct buf *bp, *rbp, *reqbp; - daddr_t blkno, origblkno; + daddr64_t blkno, origblkno; int error, num_ra; int i; int maxra, racluster; @@ -319,7 +319,7 @@ cluster_rbuild(vp, filesize, lbn, blkno, size, run, fbp) struct vnode *vp; u_quad_t filesize; daddr_t lbn; - daddr_t blkno; + daddr64_t blkno; long size; int run; struct buf *fbp; diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src index cdeb5e58d97d..7d1f6b00a51b 100644 --- a/sys/kern/vnode_if.src +++ b/sys/kern/vnode_if.src @@ -378,9 +378,9 @@ vop_unlock { # vop_bmap { IN struct vnode *vp; - IN daddr_t bn; + IN daddr64_t bn; OUT struct vnode **vpp; - IN daddr_t *bnp; + IN daddr64_t *bnp; OUT int *runp; OUT int *runb; }; diff --git a/sys/sys/bio.h b/sys/sys/bio.h index 7f1328d027fe..c5b8ba20117a 100644 --- a/sys/sys/bio.h +++ b/sys/sys/bio.h @@ -65,7 +65,7 @@ struct iodone_chain { struct bio { u_int bio_cmd; /* I/O operation. */ dev_t bio_dev; /* Device to do I/O on. */ - daddr_t bio_blkno; /* Underlying physical block number. */ + daddr64_t bio_blkno; /* Underlying physical block number. */ off_t bio_offset; /* Offset into file. */ long bio_bcount; /* Valid bytes in buffer. */ caddr_t bio_data; /* Memory, superblocks, indirect etc. */ @@ -81,7 +81,7 @@ struct bio { TAILQ_ENTRY(bio) bio_queue; /* Disksort queue. */ /* XXX: these go away when bio chaining is introduced */ - daddr_t bio_pblkno; /* physical block number */ + daddr64_t bio_pblkno; /* physical block number */ struct iodone_chain *bio_done_chain; struct bio *bio_linkage; off_t bio_length; @@ -136,7 +136,7 @@ biofinish(struct bio *bp, struct devstat *stat, int error) struct bio_queue_head { TAILQ_HEAD(bio_queue, bio) queue; - daddr_t last_pblkno; + daddr64_t last_pblkno; struct bio *insert_point; struct bio *switch_point; int busy; diff --git a/sys/sys/buf.h b/sys/sys/buf.h index ca0383ef630e..2cfae96ace99 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -127,7 +127,7 @@ struct buf { long b_runningbufspace; /* when I/O is running, pipelining */ caddr_t b_kvabase; /* base kva for buffer */ int b_kvasize; /* size of kva for buffer */ - daddr_t b_lblkno; /* Logical block number. */ + daddr64_t b_lblkno; /* Logical block number. */ struct vnode *b_vp; /* Device vnode. */ int b_dirtyoff; /* Offset in buffer of dirty region. */ int b_dirtyend; /* Offset of end of dirty region. */ @@ -365,7 +365,7 @@ BUF_REFCNT(struct buf *bp) struct buf_queue_head { TAILQ_HEAD(buf_queue, buf) queue; - daddr_t last_pblkno; + daddr64_t last_pblkno; struct buf *insert_point; struct buf *switch_point; }; diff --git a/sys/sys/types.h b/sys/sys/types.h index db3c04d78ba2..b4babf59ff75 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -71,6 +71,7 @@ typedef char * caddr_t; /* core address */ typedef __const char * c_caddr_t; /* core address, pointer to const */ typedef __volatile char *v_caddr_t; /* core address, pointer to volatile */ typedef int32_t daddr_t; /* disk address */ +typedef int64_t daddr64_t; /* 64-bit disk address */ typedef u_int32_t u_daddr_t; /* unsigned disk address */ typedef u_int32_t fixpt_t; /* fixed point number */ diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index fd472190fba7..faca50f58bd8 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -511,8 +511,8 @@ ffs_snapshot(mp, snapfile) /* * Copy a cylinder group map. All the unallocated blocks are marked * BLK_NOCOPY so that the snapshot knows that it need not copy them - * if they are later written. If how is one, then this is a first - * pass, so only setting needs to be done. If how is 2, then this + * if they are later written. If passno is one, then this is a first + * pass, so only setting needs to be done. If passno is 2, then this * is a revision to a previous pass which must be undone as the * replacement pass is done. */ @@ -1102,7 +1102,7 @@ ffs_snapblkfree(fs, devvp, bno, size, inum) } #ifdef DEBUG if (snapdebug) - printf("%s%d lbn %d for inum %d size %ld to blkno %d\n", + printf("%s%d lbn %d for inum %d size %ld to blkno %lld\n", "Copyonremove: snapino ", ip->i_number, lbn, inum, size, cbp->b_blkno); #endif @@ -1319,7 +1319,7 @@ ffs_copyonwrite(devvp, bp) printf("fs metadata"); else printf("inum %d", VTOI(bp->b_vp)->i_number); - printf(" lblkno %d to blkno %d\n", bp->b_lblkno, + printf(" lblkno %lld to blkno %lld\n", bp->b_lblkno, cbp->b_blkno); } #endif diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index b07a356b07e3..475ba177af8d 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1654,6 +1654,7 @@ setup_allocindir_phase2(bp, ip, aip) struct allocindir *oldaip; struct freefrag *freefrag; struct newblk *newblk; + daddr_t blkno; if (bp->b_lblkno >= 0) panic("setup_allocindir_phase2: not indir blk"); @@ -1733,8 +1734,10 @@ setup_allocindir_phase2(bp, ip, aip) newindirdep->ir_state = ATTACHED; LIST_INIT(&newindirdep->ir_deplisthd); LIST_INIT(&newindirdep->ir_donehd); - if (bp->b_blkno == bp->b_lblkno) - ufs_bmaparray(bp->b_vp, bp->b_lblkno, &bp->b_blkno, NULL, NULL); + if (bp->b_blkno == bp->b_lblkno) { + ufs_bmaparray(bp->b_vp, bp->b_lblkno, &blkno, NULL, NULL); + bp->b_blkno = blkno; + } newindirdep->ir_savebp = getblk(ip->i_devvp, bp->b_blkno, bp->b_bcount, 0, 0); BUF_KERNPROC(newindirdep->ir_savebp); diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c index ce4ddb8cfe99..fa8ea019f06e 100644 --- a/sys/ufs/ufs/ufs_bmap.c +++ b/sys/ufs/ufs/ufs_bmap.c @@ -64,13 +64,16 @@ int ufs_bmap(ap) struct vop_bmap_args /* { struct vnode *a_vp; - ufs_daddr_t a_bn; + daddr64_t a_bn; struct vnode **a_vpp; - ufs_daddr_t *a_bnp; + daddr64_t *a_bnp; int *a_runp; int *a_runb; } */ *ap; { + daddr_t blkno; + int error; + /* * Check for underlying vnode requests and ensure that logical * to physical mapping is requested. @@ -80,8 +83,10 @@ ufs_bmap(ap) if (ap->a_bnp == NULL) return (0); - return (ufs_bmaparray(ap->a_vp, ap->a_bn, ap->a_bnp, - ap->a_runp, ap->a_runb)); + error = ufs_bmaparray(ap->a_vp, ap->a_bn, &blkno, + ap->a_runp, ap->a_runb); + *ap->a_bnp = blkno; + return (error); } /* diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index cc66243f3e46..bf05ff3c9008 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1916,13 +1916,15 @@ ufs_strategy(ap) register struct buf *bp = ap->a_bp; register struct vnode *vp = ap->a_vp; register struct inode *ip; + daddr_t blkno; int error; ip = VTOI(vp); if (vp->v_type == VBLK || vp->v_type == VCHR) panic("ufs_strategy: spec"); if (bp->b_blkno == bp->b_lblkno) { - error = ufs_bmaparray(vp, bp->b_lblkno, &bp->b_blkno, NULL, NULL); + error = ufs_bmaparray(vp, bp->b_lblkno, &blkno, NULL, NULL); + bp->b_blkno = blkno; if (error) { bp->b_error = error; bp->b_ioflags |= BIO_ERROR; diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index bed9b7590f4a..85d04e40fb83 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -193,7 +193,7 @@ vnode_pager_haspage(object, pindex, before, after) int *after; { struct vnode *vp = object->handle; - daddr_t bn; + daddr64_t bn; int err; daddr_t reqblock; int poff; @@ -370,7 +370,7 @@ vnode_pager_addr(vp, address, run) { int rtaddress; int bsize; - daddr_t block; + daddr64_t block; struct vnode *rtvp; int err; daddr_t vblock;