aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ntfs/ChangeLog2
-rw-r--r--fs/ntfs/aops.c14
2 files changed, 10 insertions, 6 deletions
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index 788e3bd2528b..7f7eec58fee2 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -113,6 +113,8 @@ ToDo/Notes:
113 - Update attribute definition handling. 113 - Update attribute definition handling.
114 - Add NTFS_MAX_CLUSTER_SIZE and NTFS_MAX_PAGES_PER_CLUSTER constants. 114 - Add NTFS_MAX_CLUSTER_SIZE and NTFS_MAX_PAGES_PER_CLUSTER constants.
115 - Use NTFS_MAX_CLUSTER_SIZE in super.c instead of hard coding 0x10000. 115 - Use NTFS_MAX_CLUSTER_SIZE in super.c instead of hard coding 0x10000.
116 - Use MAX_BUF_PER_PAGE instead of variable sized array allocation for
117 better code generation and one less sparse warning in fs/ntfs/aops.c.
116 118
1172.1.22 - Many bug and race fixes and error handling improvements. 1192.1.22 - Many bug and race fixes and error handling improvements.
118 120
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c
index 6241c4cfbe28..24c46c200337 100644
--- a/fs/ntfs/aops.c
+++ b/fs/ntfs/aops.c
@@ -825,17 +825,15 @@ static int ntfs_write_mst_block(struct page *page,
825 ntfs_inode *ni = NTFS_I(vi); 825 ntfs_inode *ni = NTFS_I(vi);
826 ntfs_volume *vol = ni->vol; 826 ntfs_volume *vol = ni->vol;
827 u8 *kaddr; 827 u8 *kaddr;
828 unsigned char bh_size_bits = vi->i_blkbits;
829 unsigned int bh_size = 1 << bh_size_bits;
830 unsigned int rec_size = ni->itype.index.block_size; 828 unsigned int rec_size = ni->itype.index.block_size;
831 ntfs_inode *locked_nis[PAGE_CACHE_SIZE / rec_size]; 829 ntfs_inode *locked_nis[PAGE_CACHE_SIZE / rec_size];
832 struct buffer_head *bh, *head, *tbh, *rec_start_bh; 830 struct buffer_head *bh, *head, *tbh, *rec_start_bh;
833 int max_bhs = PAGE_CACHE_SIZE / bh_size; 831 struct buffer_head *bhs[MAX_BUF_PER_PAGE];
834 struct buffer_head *bhs[max_bhs];
835 runlist_element *rl; 832 runlist_element *rl;
836 int i, nr_locked_nis, nr_recs, nr_bhs, bhs_per_rec, err, err2; 833 int i, nr_locked_nis, nr_recs, nr_bhs, max_bhs, bhs_per_rec, err, err2;
837 unsigned rec_size_bits; 834 unsigned bh_size, rec_size_bits;
838 BOOL sync, is_mft, page_is_dirty, rec_is_dirty; 835 BOOL sync, is_mft, page_is_dirty, rec_is_dirty;
836 unsigned char bh_size_bits;
839 837
840 ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, page index " 838 ntfs_debug("Entering for inode 0x%lx, attribute type 0x%x, page index "
841 "0x%lx.", vi->i_ino, ni->type, page->index); 839 "0x%lx.", vi->i_ino, ni->type, page->index);
@@ -850,7 +848,11 @@ static int ntfs_write_mst_block(struct page *page,
850 */ 848 */
851 BUG_ON(!(is_mft || S_ISDIR(vi->i_mode) || 849 BUG_ON(!(is_mft || S_ISDIR(vi->i_mode) ||
852 (NInoAttr(ni) && ni->type == AT_INDEX_ALLOCATION))); 850 (NInoAttr(ni) && ni->type == AT_INDEX_ALLOCATION)));
851 bh_size_bits = vi->i_blkbits;
852 bh_size = 1 << bh_size_bits;
853 max_bhs = PAGE_CACHE_SIZE / bh_size;
853 BUG_ON(!max_bhs); 854 BUG_ON(!max_bhs);
855 BUG_ON(max_bhs > MAX_BUF_PER_PAGE);
854 856
855 /* Were we called for sync purposes? */ 857 /* Were we called for sync purposes? */
856 sync = (wbc->sync_mode == WB_SYNC_ALL); 858 sync = (wbc->sync_mode == WB_SYNC_ALL);