lkml.org 
[lkml]   [2007]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 025 of 35] Treat rq->hard_nr_sectors as setting an overriding limit in the size of the request
    On Tue, Jul 31, 2007 at 12:17:59PM +1000, NeilBrown wrote:
    >
    > For a request to be able to refer to part of a bio, we need to be able
    > to impose a size limit at the request level. So allow hard_nr_sectors
    > to be less than the size of the bios (and bio_vecs) and interpret it
    > such that anything in the last bio beyond that limit is ignored.
    >
    > As some bios can be less than one sector - as happens when a SCSI
    > sense command is being submitted - we need to set hard_nr_sectors to
    > bi_size rounded up in blk_rq_bio_prep, and we need to abort the
    > rq_for_each_segment loop if _iter.bio becomes NULL even if _iter.size
    > is still non-zero

    This is pretty confusing. In all other places, bi_size -> #sector
    conversion is done by rounding down but only in blk_rq_bio_prep() it's
    being rounded up.

    Is my following reasoning correct?

    It was okay till now because unaligned requests don't get merged and
    also haven't done partial completions (end_that_request_first with
    partial count)? So till now, hard_nr_sectors and nr_sectors didn't
    really matter for unaligned requests but now it matters because it's
    considered while iterating over bvecs in rq.

    If so, I think the correct thing to do would be changing bio_sectors()
    to round up first or let block layer measure transfer in bytes not in
    sectors. I don't think everyone would agree with the latter tho. I
    (tentatively) think it would be better to represent length in bytes
    tho. A lot of requests which aren't aligned to 512 bytes pass through
    the block layer and the mismatch can result in subtle bugs.

    Thanks.

    --
    tejun
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-08-01 19:47    [W:0.020 / U:91.124 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site