@@ -2526,47 +2526,15 @@ int write_cache_pages(struct address_space *mapping,
2526
2526
}
2527
2527
EXPORT_SYMBOL (write_cache_pages );
2528
2528
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 )
2535
2531
{
2536
2532
struct address_space * mapping = data ;
2537
2533
int ret = mapping -> a_ops -> writepage (page , wbc );
2538
2534
mapping_set_error (mapping , ret );
2539
2535
return ret ;
2540
2536
}
2541
2537
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
-
2570
2538
int do_writepages (struct address_space * mapping , struct writeback_control * wbc )
2571
2539
{
2572
2540
int ret ;
@@ -2577,11 +2545,20 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc)
2577
2545
wb = inode_to_wb_wbc (mapping -> host , wbc );
2578
2546
wb_bandwidth_estimate_start (wb );
2579
2547
while (1 ) {
2580
- if (mapping -> a_ops -> writepages )
2548
+ if (mapping -> a_ops -> writepages ) {
2581
2549
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 )
2585
2562
break ;
2586
2563
2587
2564
/*
0 commit comments