Mercurial > illumos > illumos-gate
changeset 13729:9823b670b193
1882 blkdev should limit physio by bd->d_maxxfer instead of maxphys
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Dan McDonald <danmcd@nexenta.com>
author | Alexey Zaytsev <alexey.zaytsev@nexenta.com> |
---|---|
date | Mon, 18 Jun 2012 21:47:54 -0400 |
parents | 142190a1b491 |
children | bd805c3b8675 |
files | usr/src/uts/common/io/blkdev/blkdev.c |
diffstat | 1 files changed, 23 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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