diff options
author | David Chinner <dgc@sgi.com> | 2007-02-12 03:51:41 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:27 -0500 |
commit | 33a266dda9fbbe72dd978a451a8ee33c59da5e9c (patch) | |
tree | 7e3fa4100e436f12b4c0ed562dd1f6dc9ec84fd4 /include/linux/buffer_head.h | |
parent | 42da9cbd3eedde33a42acc2cb06f454814cf5de0 (diff) |
[PATCH] Make BH_Unwritten a first class bufferhead flag V2
Currently, XFS uses BH_PrivateStart for flagging unwritten extent state in a
bufferhead. Recently, I found the long standing mmap/unwritten extent
conversion bug, and it was to do with partial page invalidation not clearing
the unwritten flag from bufferheads attached to the page but beyond EOF. See
here for a full explaination:
http://oss.sgi.com/archives/xfs/2006-12/msg00196.html
The solution I have checked into the XFS dev tree involves duplicating code
from block_invalidatepage to clear the unwritten flag from the bufferhead(s),
and then calling block_invalidatepage() to do the rest.
Christoph suggested that this would be better solved by pushing the unwritten
flag into the common buffer head flags and just adding the call to
discard_buffer():
http://oss.sgi.com/archives/xfs/2006-12/msg00239.html
The following patch makes BH_Unwritten a first class citizen.
Signed-off-by: Dave Chinner <dgc@sgi.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/buffer_head.h')
-rw-r--r-- | include/linux/buffer_head.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 5d9fb0e94156..ffbdb6621f52 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -34,6 +34,7 @@ enum bh_state_bits { | |||
34 | BH_Write_EIO, /* I/O error on write */ | 34 | BH_Write_EIO, /* I/O error on write */ |
35 | BH_Ordered, /* ordered write */ | 35 | BH_Ordered, /* ordered write */ |
36 | BH_Eopnotsupp, /* operation not supported (barrier) */ | 36 | BH_Eopnotsupp, /* operation not supported (barrier) */ |
37 | BH_Unwritten, /* Buffer is allocated on disk but not written */ | ||
37 | 38 | ||
38 | BH_PrivateStart,/* not a state bit, but the first bit available | 39 | BH_PrivateStart,/* not a state bit, but the first bit available |
39 | * for private allocation by other entities | 40 | * for private allocation by other entities |
@@ -126,6 +127,7 @@ BUFFER_FNS(Boundary, boundary) | |||
126 | BUFFER_FNS(Write_EIO, write_io_error) | 127 | BUFFER_FNS(Write_EIO, write_io_error) |
127 | BUFFER_FNS(Ordered, ordered) | 128 | BUFFER_FNS(Ordered, ordered) |
128 | BUFFER_FNS(Eopnotsupp, eopnotsupp) | 129 | BUFFER_FNS(Eopnotsupp, eopnotsupp) |
130 | BUFFER_FNS(Unwritten, unwritten) | ||
129 | 131 | ||
130 | #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) | 132 | #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) |
131 | #define touch_buffer(bh) mark_page_accessed(bh->b_page) | 133 | #define touch_buffer(bh) mark_page_accessed(bh->b_page) |