Limit the number of segments in single bio request

This commit is contained in:
LI Qing
2024-06-04 16:26:36 +08:00
committed by Tate, Hongliang Tian
parent a883b65187
commit c6aa9f9ee8
6 changed files with 51 additions and 2 deletions

View File

@ -212,6 +212,9 @@ impl From<aster_block::bio::BioEnqueueError> for Error {
aster_block::bio::BioEnqueueError::Refused => {
Error::with_message(Errno::EBUSY, "Refuse to enqueue the bio")
}
aster_block::bio::BioEnqueueError::TooBig => {
Error::with_message(Errno::EINVAL, "Bio is too big")
}
}
}
}

View File

@ -95,6 +95,10 @@ mod test {
bio.complete(BioStatus::Complete);
Ok(())
}
fn max_nr_segments_per_bio(&self) -> usize {
usize::MAX
}
}
/// Exfat disk image
static EXFAT_IMAGE: &[u8] = include_bytes!("../../../../../regression/build/exfat.img");