diff options
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index 98196327ddf0..39ff14403d13 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1181,7 +1181,20 @@ __getblk_slow(struct block_device *bdev, sector_t block, int size) | |||
1181 | void mark_buffer_dirty(struct buffer_head *bh) | 1181 | void mark_buffer_dirty(struct buffer_head *bh) |
1182 | { | 1182 | { |
1183 | WARN_ON_ONCE(!buffer_uptodate(bh)); | 1183 | WARN_ON_ONCE(!buffer_uptodate(bh)); |
1184 | if (!buffer_dirty(bh) && !test_set_buffer_dirty(bh)) | 1184 | |
1185 | /* | ||
1186 | * Very *carefully* optimize the it-is-already-dirty case. | ||
1187 | * | ||
1188 | * Don't let the final "is it dirty" escape to before we | ||
1189 | * perhaps modified the buffer. | ||
1190 | */ | ||
1191 | if (buffer_dirty(bh)) { | ||
1192 | smp_mb(); | ||
1193 | if (buffer_dirty(bh)) | ||
1194 | return; | ||
1195 | } | ||
1196 | |||
1197 | if (!test_set_buffer_dirty(bh)) | ||
1185 | __set_page_dirty(bh->b_page, page_mapping(bh->b_page), 0); | 1198 | __set_page_dirty(bh->b_page, page_mapping(bh->b_page), 0); |
1186 | } | 1199 | } |
1187 | 1200 | ||