# HG changeset patch # User Alexey Zaytsev # Date 1340070474 14400 # Node ID 9823b670b19334db151f67715e03174cfe4b32aa # Parent 142190a1b4911ba1ce022ad83777054c1ec99b07 1882 blkdev should limit physio by bd->d_maxxfer instead of maxphys Reviewed by: Robert Mustacchi Reviewed by: Garrett D'Amore Approved by: Dan McDonald diff -r 142190a1b491 -r 9823b670b193 usr/src/uts/common/io/blkdev/blkdev.c --- a/usr/src/uts/common/io/blkdev/blkdev.c Mon Jun 18 21:47:52 2012 -0400 +++ b/usr/src/uts/common/io/blkdev/blkdev.c Mon Jun 18 21:47:54 2012 -0400 @@ -899,32 +899,51 @@ return (rv); } +void +bd_minphys(struct buf *bp) +{ + minor_t inst; + bd_t *bd; + inst = BDINST(bp->b_edev); + + bd = ddi_get_soft_state(bd_state, inst); + + /* + * In a non-debug kernel, bd_strategy will catch !bd as + * well, and will fail nicely. + */ + ASSERT(bd); + + if (bp->b_bcount > bd->d_maxxfer) + bp->b_bcount = bd->d_maxxfer; +} + static int bd_read(dev_t dev, struct uio *uio, cred_t *credp) { _NOTE(ARGUNUSED(credp)); - return (physio(bd_strategy, NULL, dev, B_READ, minphys, uio)); + return (physio(bd_strategy, NULL, dev, B_READ, bd_minphys, uio)); } static int bd_write(dev_t dev, struct uio *uio, cred_t *credp) { _NOTE(ARGUNUSED(credp)); - return (physio(bd_strategy, NULL, dev, B_WRITE, minphys, uio)); + return (physio(bd_strategy, NULL, dev, B_WRITE, bd_minphys, uio)); } static int bd_aread(dev_t dev, struct aio_req *aio, cred_t *credp) { _NOTE(ARGUNUSED(credp)); - return (aphysio(bd_strategy, anocancel, dev, B_READ, minphys, aio)); + return (aphysio(bd_strategy, anocancel, dev, B_READ, bd_minphys, aio)); } static int bd_awrite(dev_t dev, struct aio_req *aio, cred_t *credp) { _NOTE(ARGUNUSED(credp)); - return (aphysio(bd_strategy, anocancel, dev, B_WRITE, minphys, aio)); + return (aphysio(bd_strategy, anocancel, dev, B_WRITE, bd_minphys, aio)); } static int