aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2004-07-02 12:54:12 +0100
committerAnton Altaparmakov <aia21@cantab.net>2004-07-02 12:54:12 +0100
commitdb14fecd15cf13f1036ab8dba267266b201243b1 (patch)
tree3e60c2c5754baa9d060cf9118d87f55c81ad700e /fs
parenta97689d27e01ad9fa189fbf90fd1762baaf535a7 (diff)
downloadhistory-db14fecd15cf13f1036ab8dba267266b201243b1.tar.gz
NTFS: Update __ntfs_index_entry_mark_dirty() so it makes sure that the
page has buffers. Otherwise we could end up with a dirty page without buffers and our set_page_dirty() would not mark the buffers dirty when they are created and thus they would not be written out and the dirty records would be lost. Signed-off-by: Anton Altaparmakov <aia21@cantab.net>
Diffstat (limited to 'fs')
-rw-r--r--fs/ntfs/index.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/fs/ntfs/index.c b/fs/ntfs/index.c
index 41bfe847ac4465..f4396a02a722da 100644
--- a/fs/ntfs/index.c
+++ b/fs/ntfs/index.c
@@ -478,13 +478,15 @@ idx_err_out:
*/
void __ntfs_index_entry_mark_dirty(ntfs_index_context *ictx)
{
- struct address_space *mapping;
- struct page *page;
ntfs_inode *ni;
+ struct page *page;
+ struct buffer_head *bh, *head;
+ unsigned int rec_start, rec_end, bh_size, bh_start, bh_end;
BUG_ON(ictx->is_in_root);
ni = ictx->idx_ni;
page = ictx->page;
+ BUG_ON(!page_has_buffers(page));
/*
* If the index block is the same size as the page cache page, set all
* the buffers in the page, as well as the page itself, dirty.
@@ -494,24 +496,17 @@ void __ntfs_index_entry_mark_dirty(ntfs_index_context *ictx)
return;
}
/* Set only the buffers in which the index block is located dirty. */
- mapping = page->mapping;
- if (page_has_buffers(page)) {
- struct buffer_head *bh, *head;
- unsigned int bh_start, bh_end, rec_start, rec_end;
- unsigned int bh_size = ni->vol->sb->s_blocksize;
-
- bh = head = page_buffers(page);
- bh_start = 0;
- rec_start = (unsigned int)((u8*)ictx->ia -
- (u8*)page_address(page));
- rec_end = rec_start + ni->itype.index.block_size;
- do {
- bh_end = bh_start + bh_size;
- if ((bh_start >= rec_start) && (bh_end <= rec_end))
- set_buffer_dirty(bh);
- bh_start = bh_end;
- } while ((bh = bh->b_this_page) != head);
- }
+ rec_start = (unsigned int)((u8*)ictx->ia - (u8*)page_address(page));
+ rec_end = rec_start + ni->itype.index.block_size;
+ bh_size = ni->vol->sb->s_blocksize;
+ bh_start = 0;
+ bh = head = page_buffers(page);
+ do {
+ bh_end = bh_start + bh_size;
+ if ((bh_start >= rec_start) && (bh_end <= rec_end))
+ set_buffer_dirty(bh);
+ bh_start = bh_end;
+ } while ((bh = bh->b_this_page) != head);
/* Finally, set the page itself dirty, too. */
__set_page_dirty_nobuffers(page);
}