···8585 removal of the get_bh()/put_bh() pairs for each buffer.8686 - Fix fs/ntfs/aops.c::ntfs_{read,write}_block() to handle the case8787 where a concurrent truncate has truncated the runlist under our feet.8888+ - Fix page_has_buffers()/page_buffers() handling in fs/ntfs/aops.c.888989902.1.23 - Implement extension of resident files and make writing safe as well as9091 many bug fixes, cleanups, and enhancements...
+21-17
fs/ntfs/aops.c
···185185 blocksize_bits = VFS_I(ni)->i_blkbits;186186 blocksize = 1 << blocksize_bits;187187188188- if (!page_has_buffers(page))188188+ if (!page_has_buffers(page)) {189189 create_empty_buffers(page, blocksize, 0);190190- bh = head = page_buffers(page);191191- if (unlikely(!bh)) {192192- unlock_page(page);193193- return -ENOMEM;190190+ if (unlikely(!page_has_buffers(page))) {191191+ unlock_page(page);192192+ return -ENOMEM;193193+ }194194 }195195+ bh = head = page_buffers(page);196196+ BUG_ON(!bh);195197196198 iblock = (s64)page->index << (PAGE_CACHE_SHIFT - blocksize_bits);197199 read_lock_irqsave(&ni->size_lock, flags);···532530 BUG_ON(!PageUptodate(page));533531 create_empty_buffers(page, blocksize,534532 (1 << BH_Uptodate) | (1 << BH_Dirty));533533+ if (unlikely(!page_has_buffers(page))) {534534+ ntfs_warning(vol->sb, "Error allocating page "535535+ "buffers. Redirtying page so we try "536536+ "again later.");537537+ /*538538+ * Put the page back on mapping->dirty_pages, but leave539539+ * its buffers' dirty state as-is.540540+ */541541+ redirty_page_for_writepage(wbc, page);542542+ unlock_page(page);543543+ return 0;544544+ }535545 }536546 bh = head = page_buffers(page);537537- if (unlikely(!bh)) {538538- ntfs_warning(vol->sb, "Error allocating page buffers. "539539- "Redirtying page so we try again later.");540540- /*541541- * Put the page back on mapping->dirty_pages, but leave its542542- * buffer's dirty state as-is.543543- */544544- redirty_page_for_writepage(wbc, page);545545- unlock_page(page);546546- return 0;547547- }547547+ BUG_ON(!bh);548548549549 /* NOTE: Different naming scheme to ntfs_read_block()! */550550···914910 sync = (wbc->sync_mode == WB_SYNC_ALL);915911916912 /* Make sure we have mapped buffers. */917917- BUG_ON(!page_has_buffers(page));918913 bh = head = page_buffers(page);919914 BUG_ON(!bh);920915···24002397 buffers_to_free = bh;24012398 }24022399 bh = head = page_buffers(page);24002400+ BUG_ON(!bh);24032401 do {24042402 bh_ofs = bh_offset(bh);24052403 if (bh_ofs + bh_size <= ofs)