curiosity between bread and UFS_BALLOC on struct buf
Shane Adams
adamsch1 at yahoo.com
Mon Oct 2 18:12:44 PDT 2006
Hey all,
I've been puzzling with a bit of code. I'm creating a file from within a kernel module, that works fine, but I've got a question if perhaps I'm missing something:
I use UFS_BALLOC to allocate some space. That function has a struct buf thats returned. What I would expect is that I could manipulate the bp->b_data field then do a bwrite and have my changes saved. Doesnt work that way. Only way
I can get it to work is
1 UFS_BALLOC( ... )
2 bwrite( .. )
3 bread( ... )
4 /* Make changes to what I read */
5 bwrite()
Seems like I could get rid of, 2 and 3. I'm not sure why I have to bwrite the buffer returned from UFS_BALLOC. I dug around and there are a few examples of where ffs/ufs manipulate the buffer returned from UFS_BALLOC so I am guessing I'm missing a flag or something.
Hope the question is clear enough!
Cheers,
Shane
More information about the freebsd-fs
mailing list