@@ -955,7 +955,7 @@ grow_dev_page(struct block_device *bdev, sector_t block,
955955 size );
956956 goto done ;
957957 }
958- if (!try_to_free_buffers (page ))
958+ if (!try_to_free_buffers (page_folio ( page ) ))
959959 goto failed ;
960960 }
961961
@@ -3155,20 +3155,20 @@ int sync_dirty_buffer(struct buffer_head *bh)
31553155EXPORT_SYMBOL (sync_dirty_buffer );
31563156
31573157/*
3158- * try_to_free_buffers() checks if all the buffers on this particular page
3158+ * try_to_free_buffers() checks if all the buffers on this particular folio
31593159 * are unused, and releases them if so.
31603160 *
31613161 * Exclusion against try_to_free_buffers may be obtained by either
3162- * locking the page or by holding its mapping's private_lock.
3162+ * locking the folio or by holding its mapping's private_lock.
31633163 *
3164- * If the page is dirty but all the buffers are clean then we need to
3165- * be sure to mark the page clean as well. This is because the page
3164+ * If the folio is dirty but all the buffers are clean then we need to
3165+ * be sure to mark the folio clean as well. This is because the folio
31663166 * may be against a block device, and a later reattachment of buffers
3167- * to a dirty page will set *all* buffers dirty. Which would corrupt
3167+ * to a dirty folio will set *all* buffers dirty. Which would corrupt
31683168 * filesystem data on the same device.
31693169 *
3170- * The same applies to regular filesystem pages : if all the buffers are
3171- * clean then we set the page clean and proceed. To do that, we require
3170+ * The same applies to regular filesystem folios : if all the buffers are
3171+ * clean then we set the folio clean and proceed. To do that, we require
31723172 * total exclusion from block_dirty_folio(). That is obtained with
31733173 * private_lock.
31743174 *
@@ -3207,40 +3207,40 @@ drop_buffers(struct page *page, struct buffer_head **buffers_to_free)
32073207 return 0 ;
32083208}
32093209
3210- int try_to_free_buffers (struct page * page )
3210+ bool try_to_free_buffers (struct folio * folio )
32113211{
3212- struct address_space * const mapping = page -> mapping ;
3212+ struct address_space * const mapping = folio -> mapping ;
32133213 struct buffer_head * buffers_to_free = NULL ;
3214- int ret = 0 ;
3214+ bool ret = 0 ;
32153215
3216- BUG_ON (!PageLocked ( page ));
3217- if (PageWriteback ( page ))
3218- return 0 ;
3216+ BUG_ON (!folio_test_locked ( folio ));
3217+ if (folio_test_writeback ( folio ))
3218+ return false ;
32193219
32203220 if (mapping == NULL ) { /* can this still happen? */
3221- ret = drop_buffers (page , & buffers_to_free );
3221+ ret = drop_buffers (& folio -> page , & buffers_to_free );
32223222 goto out ;
32233223 }
32243224
32253225 spin_lock (& mapping -> private_lock );
3226- ret = drop_buffers (page , & buffers_to_free );
3226+ ret = drop_buffers (& folio -> page , & buffers_to_free );
32273227
32283228 /*
32293229 * If the filesystem writes its buffers by hand (eg ext3)
3230- * then we can have clean buffers against a dirty page . We
3231- * clean the page here; otherwise the VM will never notice
3230+ * then we can have clean buffers against a dirty folio . We
3231+ * clean the folio here; otherwise the VM will never notice
32323232 * that the filesystem did any IO at all.
32333233 *
32343234 * Also, during truncate, discard_buffer will have marked all
3235- * the page 's buffers clean. We discover that here and clean
3236- * the page also.
3235+ * the folio 's buffers clean. We discover that here and clean
3236+ * the folio also.
32373237 *
32383238 * private_lock must be held over this entire operation in order
32393239 * to synchronise against block_dirty_folio and prevent the
32403240 * dirty bit from being lost.
32413241 */
32423242 if (ret )
3243- cancel_dirty_page ( page );
3243+ folio_cancel_dirty ( folio );
32443244 spin_unlock (& mapping -> private_lock );
32453245out :
32463246 if (buffers_to_free ) {
0 commit comments