@@ -1799,7 +1799,7 @@ static int __ext4_journalled_writepage(struct page *page,
1799
1799
* lock so we have to do some magic.
1800
1800
*
1801
1801
* This function can get called via...
1802
- * - ext4_da_writepages after taking page lock (have journal handle)
1802
+ * - ext4_writepages after taking page lock (have journal handle)
1803
1803
* - journal_submit_inode_data_buffers (no journal handle)
1804
1804
* - shrink_page_list via the kswapd/direct reclaim (no journal handle)
1805
1805
* - grab_page_cache when doing write_begin (have journal handle)
@@ -2217,7 +2217,7 @@ static int mpage_map_and_submit_extent(handle_t *handle,
2217
2217
2218
2218
/*
2219
2219
* Calculate the total number of credits to reserve for one writepages
2220
- * iteration. This is called from ext4_da_writepages (). We map an extent of
2220
+ * iteration. This is called from ext4_writepages (). We map an extent of
2221
2221
* upto MAX_WRITEPAGES_EXTENT_LEN blocks and then we go on and finish mapping
2222
2222
* the last partial page. So in total we can map MAX_WRITEPAGES_EXTENT_LEN +
2223
2223
* bpp - 1 blocks in bpp different extents.
@@ -2349,8 +2349,17 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
2349
2349
return err ;
2350
2350
}
2351
2351
2352
- static int ext4_da_writepages (struct address_space * mapping ,
2353
- struct writeback_control * wbc )
2352
+ static int __writepage (struct page * page , struct writeback_control * wbc ,
2353
+ void * data )
2354
+ {
2355
+ struct address_space * mapping = data ;
2356
+ int ret = ext4_writepage (page , wbc );
2357
+ mapping_set_error (mapping , ret );
2358
+ return ret ;
2359
+ }
2360
+
2361
+ static int ext4_writepages (struct address_space * mapping ,
2362
+ struct writeback_control * wbc )
2354
2363
{
2355
2364
pgoff_t writeback_index = 0 ;
2356
2365
long nr_to_write = wbc -> nr_to_write ;
@@ -2364,7 +2373,7 @@ static int ext4_da_writepages(struct address_space *mapping,
2364
2373
bool done ;
2365
2374
struct blk_plug plug ;
2366
2375
2367
- trace_ext4_da_writepages (inode , wbc );
2376
+ trace_ext4_writepages (inode , wbc );
2368
2377
2369
2378
/*
2370
2379
* No pages to write? This is mainly a kludge to avoid starting
@@ -2374,13 +2383,23 @@ static int ext4_da_writepages(struct address_space *mapping,
2374
2383
if (!mapping -> nrpages || !mapping_tagged (mapping , PAGECACHE_TAG_DIRTY ))
2375
2384
return 0 ;
2376
2385
2386
+ if (ext4_should_journal_data (inode )) {
2387
+ struct blk_plug plug ;
2388
+ int ret ;
2389
+
2390
+ blk_start_plug (& plug );
2391
+ ret = write_cache_pages (mapping , wbc , __writepage , mapping );
2392
+ blk_finish_plug (& plug );
2393
+ return ret ;
2394
+ }
2395
+
2377
2396
/*
2378
2397
* If the filesystem has aborted, it is read-only, so return
2379
2398
* right away instead of dumping stack traces later on that
2380
2399
* will obscure the real source of the problem. We test
2381
2400
* EXT4_MF_FS_ABORTED instead of sb->s_flag's MS_RDONLY because
2382
2401
* the latter could be true if the filesystem is mounted
2383
- * read-only, and in that case, ext4_da_writepages should
2402
+ * read-only, and in that case, ext4_writepages should
2384
2403
* *never* be called, so if that ever happens, we would want
2385
2404
* the stack trace.
2386
2405
*/
@@ -2520,8 +2539,8 @@ static int ext4_da_writepages(struct address_space *mapping,
2520
2539
mapping -> writeback_index = mpd .first_page ;
2521
2540
2522
2541
out_writepages :
2523
- trace_ext4_da_writepages_result (inode , wbc , ret ,
2524
- nr_to_write - wbc -> nr_to_write );
2542
+ trace_ext4_writepages_result (inode , wbc , ret ,
2543
+ nr_to_write - wbc -> nr_to_write );
2525
2544
return ret ;
2526
2545
}
2527
2546
@@ -2769,7 +2788,7 @@ int ext4_alloc_da_blocks(struct inode *inode)
2769
2788
* laptop_mode, not even desirable). However, to do otherwise
2770
2789
* would require replicating code paths in:
2771
2790
*
2772
- * ext4_da_writepages () ->
2791
+ * ext4_writepages () ->
2773
2792
* write_cache_pages() ---> (via passed in callback function)
2774
2793
* __mpage_da_writepage() -->
2775
2794
* mpage_add_bh_to_extent()
@@ -3213,6 +3232,7 @@ static const struct address_space_operations ext4_aops = {
3213
3232
.readpage = ext4_readpage ,
3214
3233
.readpages = ext4_readpages ,
3215
3234
.writepage = ext4_writepage ,
3235
+ .writepages = ext4_writepages ,
3216
3236
.write_begin = ext4_write_begin ,
3217
3237
.write_end = ext4_write_end ,
3218
3238
.bmap = ext4_bmap ,
@@ -3228,6 +3248,7 @@ static const struct address_space_operations ext4_journalled_aops = {
3228
3248
.readpage = ext4_readpage ,
3229
3249
.readpages = ext4_readpages ,
3230
3250
.writepage = ext4_writepage ,
3251
+ .writepages = ext4_writepages ,
3231
3252
.write_begin = ext4_write_begin ,
3232
3253
.write_end = ext4_journalled_write_end ,
3233
3254
.set_page_dirty = ext4_journalled_set_page_dirty ,
@@ -3243,7 +3264,7 @@ static const struct address_space_operations ext4_da_aops = {
3243
3264
.readpage = ext4_readpage ,
3244
3265
.readpages = ext4_readpages ,
3245
3266
.writepage = ext4_writepage ,
3246
- .writepages = ext4_da_writepages ,
3267
+ .writepages = ext4_writepages ,
3247
3268
.write_begin = ext4_da_write_begin ,
3248
3269
.write_end = ext4_da_write_end ,
3249
3270
.bmap = ext4_bmap ,
0 commit comments