pub(crate) fn calculate_bio_chunk_index(
    offset: u64,
    end: u64,
    blksize: u64,
    chunk_cnt: u32,
    has_hole: bool,
) -> (u32, u32) {
    debug_assert!(offset < end);

    let index_start = if !has_hole {
        (offset / blksize) as u32
    } else {
        0
    };
    let index_end = if !has_hole {
        cmp::min(((end - 1) / blksize) as u32 + 1, chunk_cnt)
    } else {
        chunk_cnt
    };

    (index_start, index_end)
}
/// Calculate bio chunk indices that overlaps with the provided IO range.
///
/// offset: IO offset to the file start, inclusive.
/// end: IO end to the file start, exclusive.
/// blksize: chunk block size.
/// has_hole: whether a file has holes in it.
Calculate bio chunk indices that overlaps with the provided IO range.
offset: IO offset to the file start, inclusive.
end: IO end to the file start, exclusive.
blksize: chunk block size.
has_hole: whether a file has holes in it.
Calculate bio chunk indices that overlaps with the provided IO range . offset : IO offset to the file start inclusive . end : IO end to the file start exclusive . blksize : chunk block size . has_hole : whether a file has holes in it .
pub(crate) fn calculate_bio_chunk_index(
    offset: u64,
    end: u64,
    blksize: u64,
    chunk_cnt: u32,
    has_hole: bool,
) -> (u32, u32) {
    debug_assert!(offset < end);
    let index_start = if !has_hole {
        (offset / blksize) as u32
    } else {
        0
    };
    let index_end = if !has_hole {
        cmp::min(((end - 1) / blksize) as u32 + 1, chunk_cnt)
    } else {
        chunk_cnt
    };
    (index_start, index_end)
}
pub ( crate ) fn calculate_bio_chunk_index ( offset : u64 , end : u64 , blksize : u64 , chunk_cnt : u32 , has_hole : bool , ) -> ( u32 , u32 ) { debug_assert ! ( offset end ) ; let index_start = if ! has_hole { ( offset / blksize ) as u32 } else { 0 } ; let index_end = if ! has_hole { cmp :: min ( ( ( end - 1 ) / blksize ) as u32 + 1 , chunk_cnt ) } else { chunk_cnt } ; ( index_start , index_end ) }
Calculate bio chunk indices that overlaps with the provided IO range.
Calculate bio chunk indices that overlaps with the provided IO range .
offset
u64
end
u64
blksize
u64
chunk_cnt
u32
has_hole
bool
offset
u64
end
u64
blksize
u64
chunk_cnt
u32
has_hole
bool