Skip to content

Commit c2ca7a5

Browse files
Christoph Hellwigakpm00
authored andcommitted
mm: remove generic_writepages
Now that all external callers are gone, just fold it into do_writepages. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Jan Kara <[email protected]> Cc: Joel Becker <[email protected]> Cc: Joseph Qi <[email protected]> Cc: Konstantin Komarov <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Theodore Ts'o <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 17c30ee commit c2ca7a5

File tree

2 files changed

+15
-40
lines changed

2 files changed

+15
-40
lines changed

include/linux/writeback.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,6 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb);
369369
typedef int (*writepage_t)(struct page *page, struct writeback_control *wbc,
370370
void *data);
371371

372-
int generic_writepages(struct address_space *mapping,
373-
struct writeback_control *wbc);
374372
void tag_pages_for_writeback(struct address_space *mapping,
375373
pgoff_t start, pgoff_t end);
376374
int write_cache_pages(struct address_space *mapping,

mm/page-writeback.c

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,47 +2526,15 @@ int write_cache_pages(struct address_space *mapping,
25262526
}
25272527
EXPORT_SYMBOL(write_cache_pages);
25282528

2529-
/*
2530-
* Function used by generic_writepages to call the real writepage
2531-
* function and set the mapping flags on error
2532-
*/
2533-
static int __writepage(struct page *page, struct writeback_control *wbc,
2534-
void *data)
2529+
static int writepage_cb(struct page *page, struct writeback_control *wbc,
2530+
void *data)
25352531
{
25362532
struct address_space *mapping = data;
25372533
int ret = mapping->a_ops->writepage(page, wbc);
25382534
mapping_set_error(mapping, ret);
25392535
return ret;
25402536
}
25412537

2542-
/**
2543-
* generic_writepages - walk the list of dirty pages of the given address space and writepage() all of them.
2544-
* @mapping: address space structure to write
2545-
* @wbc: subtract the number of written pages from *@wbc->nr_to_write
2546-
*
2547-
* This is a library function, which implements the writepages()
2548-
* address_space_operation.
2549-
*
2550-
* Return: %0 on success, negative error code otherwise
2551-
*/
2552-
int generic_writepages(struct address_space *mapping,
2553-
struct writeback_control *wbc)
2554-
{
2555-
struct blk_plug plug;
2556-
int ret;
2557-
2558-
/* deal with chardevs and other special file */
2559-
if (!mapping->a_ops->writepage)
2560-
return 0;
2561-
2562-
blk_start_plug(&plug);
2563-
ret = write_cache_pages(mapping, wbc, __writepage, mapping);
2564-
blk_finish_plug(&plug);
2565-
return ret;
2566-
}
2567-
2568-
EXPORT_SYMBOL(generic_writepages);
2569-
25702538
int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
25712539
{
25722540
int ret;
@@ -2577,11 +2545,20 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
25772545
wb = inode_to_wb_wbc(mapping->host, wbc);
25782546
wb_bandwidth_estimate_start(wb);
25792547
while (1) {
2580-
if (mapping->a_ops->writepages)
2548+
if (mapping->a_ops->writepages) {
25812549
ret = mapping->a_ops->writepages(mapping, wbc);
2582-
else
2583-
ret = generic_writepages(mapping, wbc);
2584-
if ((ret != -ENOMEM) || (wbc->sync_mode != WB_SYNC_ALL))
2550+
} else if (mapping->a_ops->writepage) {
2551+
struct blk_plug plug;
2552+
2553+
blk_start_plug(&plug);
2554+
ret = write_cache_pages(mapping, wbc, writepage_cb,
2555+
mapping);
2556+
blk_finish_plug(&plug);
2557+
} else {
2558+
/* deal with chardevs and other special files */
2559+
ret = 0;
2560+
}
2561+
if (ret != -ENOMEM || wbc->sync_mode != WB_SYNC_ALL)
25852562
break;
25862563

25872564
/*

0 commit comments

Comments
 (0)