Too many stupid questions about the block layer

From: Roni Feldman
Date: Thu Aug 28 2008 - 16:38:20 EST


Hello list,

This is pretty long -- I sure hope this is the right place to ask these :)

First of all, I have a board with a NAND flash device, to which I have
a 8k-wide PCI interface.
I've been wondering about these:

1. I would prefer if the block layer always passed me 8k long
segments, even though the hard sector size is 2k. I tried using
blk_queue_hardsect_size() and set it to 8k, but for some reason I get
a panic. Is it possible that hardsect cannot be larger than PAGE_SIZE
(makes some sense)? Or is it just a bug of mine?

2. (This is in case I can't have 8k-one-segment-bios/requests) I'm not
sure whether I should implement request_fn() or make_request_fn(),
since although the device is flash, there's sense in writing
consecutive sectors in one go - with each write of a block of sectors,
the devices erases a whole erase block, which is the size of many
sectors. More writes of consecutive sectors means we don't erase the
same erase block as much. Can I get the same "segment merging"
functionality from the block layer if I use make_request() instead of
request()?

3. I want to handle requests in a kernel thread, one by one. Ideally,
I would just pass the request to my kthread, and call blk_stop_queue
(since I can only handle one request at a time). In my kthread, I will
issue a DMA transfer for the request and in the end call
blk_end_request(), and the blk_start_queue(). But can the block layer
somehow add bio's to my request while the kthread runs? Is there a way
to lock the request (maybe blkdev_dequeue_request)? Am I even on the
right track?

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