2006-02-13 23:03:32

by Joshua Hudson

[permalink] [raw]
Subject: sb_bread & bforget

New filesystem is using BTrees for directories. An update will touch
multiple blocks, loaded into buffer_head structures with sb_bread.

If update fails (only possible causes are read error & disk full), is it
kosher to call bforget on all modified buffer_head structures, or
does that have some unintended consequences?


2006-02-14 04:10:05

by Andrew Morton

[permalink] [raw]
Subject: Re: sb_bread & bforget

Joshua Hudson <[email protected]> wrote:
>
> New filesystem is using BTrees for directories. An update will touch
> multiple blocks, loaded into buffer_head structures with sb_bread.
>
> If update fails (only possible causes are read error & disk full), is it
> kosher to call bforget on all modified buffer_head structures, or
> does that have some unintended consequences?

It's probably wrong. bforget() will clear the dirty bit, so you'd lose
anything else which had been written to that buffer but not written back.

bforget() is used for truncate, where we know the data is being tosed away.