From 29b9032b1a96d7ffb8ed6e6064cc6ad2072b9fa3 Mon Sep 17 00:00:00 2001 From: Anton Altaparmakov Date: Tue, 5 Oct 2004 23:32:49 +0100 Subject: [PATCH] NTFS: Switch fs/ntfs/index.h::ntfs_index_entry_mark_dirty() to using the new helper fs/ntfs/aops.c::mark_ntfs_record_dirty() and remove the no longer needed fs/ntfs/index.[hc]::__ntfs_index_entry_mark_dirty(). Signed-off-by: Anton Altaparmakov --- fs/ntfs/ChangeLog | 3 +++ fs/ntfs/index.c | 55 ----------------------------------------------- fs/ntfs/index.h | 6 +++--- 3 files changed, 6 insertions(+), 58 deletions(-) diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog index 54e04f293543a..78208d9bc6735 100644 --- a/fs/ntfs/ChangeLog +++ b/fs/ntfs/ChangeLog @@ -51,6 +51,9 @@ ToDo/Notes: marks all buffers belonging to an ntfs record dirty, followed by marking the page the ntfs record is in dirty and also marking the vfs inode containing the ntfs record dirty (I_DIRTY_PAGES). + - Switch fs/ntfs/index.h::ntfs_index_entry_mark_dirty() to using the + new helper fs/ntfs/aops.c::mark_ntfs_record_dirty() and remove the no + longer needed fs/ntfs/index.[hc]::__ntfs_index_entry_mark_dirty(). 2.1.20 - Fix two stupid bugs introduced in 2.1.18 release. diff --git a/fs/ntfs/index.c b/fs/ntfs/index.c index b19a4882b6895..11be36f68bc99 100644 --- a/fs/ntfs/index.c +++ b/fs/ntfs/index.c @@ -459,58 +459,3 @@ idx_err_out: err = -EIO; goto err_out; } - -#ifdef NTFS_RW - -/** - * __ntfs_index_entry_mark_dirty - mark an index allocation entry dirty - * @ictx: ntfs index context describing the index entry - * - * NOTE: You want to use fs/ntfs/index.h::ntfs_index_entry_mark_dirty() instead! - * - * Mark the index allocation entry described by the index entry context @ictx - * dirty. - * - * The index entry must be in an index block belonging to the index allocation - * attribute. Mark the buffers belonging to the index record as well as the - * page cache page the index block is in dirty. This automatically marks the - * VFS inode of the ntfs index inode to which the index entry belongs dirty, - * too (I_DIRTY_PAGES) and this in turn ensures the page buffers, and hence the - * dirty index block, will be written out to disk later. - */ -void __ntfs_index_entry_mark_dirty(ntfs_index_context *ictx) -{ - 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. - */ - if (ni->itype.index.block_size == PAGE_CACHE_SIZE) { - __set_page_dirty_buffers(page); - return; - } - /* Set only the buffers in which the index block is located dirty. */ - 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); -} - -#endif /* NTFS_RW */ diff --git a/fs/ntfs/index.h b/fs/ntfs/index.h index 159442dfa90a1..b8f503fa2d6e6 100644 --- a/fs/ntfs/index.h +++ b/fs/ntfs/index.h @@ -30,6 +30,7 @@ #include "inode.h" #include "attrib.h" #include "mft.h" +#include "aops.h" /** * @idx_ni: index inode containing the @entry described by this context @@ -115,8 +116,6 @@ static inline void ntfs_index_entry_flush_dcache_page(ntfs_index_context *ictx) flush_dcache_page(ictx->page); } -extern void __ntfs_index_entry_mark_dirty(ntfs_index_context *ictx); - /** * ntfs_index_entry_mark_dirty - mark an index entry dirty * @ictx: ntfs index context describing the index entry @@ -140,7 +139,8 @@ static inline void ntfs_index_entry_mark_dirty(ntfs_index_context *ictx) if (ictx->is_in_root) mark_mft_record_dirty(ictx->actx->ntfs_ino); else - __ntfs_index_entry_mark_dirty(ictx); + mark_ntfs_record_dirty(ictx->idx_ni, ictx->page, + (u8*)ictx->ia - (u8*)page_address(ictx->page)); } #endif /* NTFS_RW */ -- 2.53.0