It's probably better to use submit_bh(). Set the BH_Lock and BH_Mapped bits,
also set up b_end_io. Then do a wait_on_buffer(), wait for the IO to
complete. There's some similar code in
fs/jbd/journal.c:journal_write_metadata_buffer().
However, what you're doing is an odd thing. If there is already pagecache
against that block device then the kernel doesn't know that you've changed
the bytes on-disk and will cheerfully proceed to use (and write out) the
cached data. You'll lose your modifications..
It would be better to use sb_getblk() or bread(), to lock the returned
buffer_head, then copy your data into it and to then write it back with
submit_bh() or ll_rw_block(). Or just leave it dirty and let the kernel
write it out in due course.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/