tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Reading and writing buffers to disk for multiple pages



Hi,

I am a newbie who is developing a device driver for NetBSD. For this driver, I need to do some read/write operations to the disk. Therefore, I was using 'struct buf' from buf.h. I figured I can set the buf.b_data to the reference of a continuously/consecutively allocated memory. This memory is supposed to hold read/write data. Once the buf is set with appropriate values, the bdev_strategy(buf)  function is called to do the R/W operation on the device.

My concern is what if I do not have a reference to a consecutive memory to set the buf.b_data with, i.e. what should I do if I have multiple non-consecutive pages to write to the device? Should I create one buf per non-consecutive pages and call the bdev_strategy(buf) for each of them? Is there any way to write multiple pages using a single buf? 

I am trying to figure the proper way to handle such a situation instead of serializing using memalloc() and memcpy(). Please let me know your suggestion.

Thanks,
Mehrab



Home | Main Index | Thread Index | Old Index