Skip to contentSkip to conversation

custom block device driver with 6k block size...

DISCUSSION Rob Harris 1 participant 1 message Apr 28, 2015

lore
Share & tools
lore

Rob Harris

author
#0 lore raw

Greetings.

I've been working on developing a custom block device that (unfortunately) uses 6k block sizes. I've been trying to deal directly with the BIO's (make_request_fn) and even though I've configured the request_queue as follows...

    blk_queue_io_min( smc_dev->req_queue, SIX_KB );
    blk_queue_io_opt( smc_dev->req_queue, TWELVE_KB );
    blk_queue_max_segments( smc_dev->req_queue, SIX_KB * 100 / TWELVE_KB );
    blk_queue_max_segment_size( smc_dev->req_queue, SIX_KB * 100 );
    blk_queue_max_hw_sectors( smc_dev->req_queue, SIX_KB * 100 / 512 );
    blk_queue_logical_block_size( smc_dev->req_queue, SIX_KB );
    blk_queue_physical_block_size( smc_dev->req_queue, SIX_KB );
    blk_queue_segment_boundary( smc_dev->req_queue, SIX_KB-1 );

    queue_flag_set_unlocked( QUEUE_FLAG_NONROT, smc_dev->req_queue );
    queue_flag_clear_unlocked( QUEUE_FLAG_ADD_RANDOM, smc_dev->req_queue );

... I still seem to always get handed BIO's with PAGE_SIZE(4k) segment_sizes in the bio_vec and I never seem to get any sort of bio_vec coalescing when trying a blk_bio_map_sg. Everything returned is always small (if at all) multiples of PAGE_SIZE. I would love to DMA large buffers directly back and forth to the controller, but offsetting the delta between the 4k and 6k offset is a pain.

Is there something simple that I'm missing or doing wrong?

Thanks,
-Rob Harris