Commit 94004ed726f38a841cc51f97c4a3f9eda9fbd0d9

Authored by Christoph Hellwig
Committed by Jan Kara
1 parent 6b2f3d1f76

kill wait_on_page_writeback_range

All callers really want the more logical filemap_fdatawait_range interface,
so convert them to use it and merge wait_on_page_writeback_range into
filemap_fdatawait_range.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>

Showing 5 changed files with 18 additions and 45 deletions Side-by-side Diff

Documentation/filesystems/vfs.txt
... ... @@ -472,7 +472,7 @@
472 472 writing out the whole address_space.
473 473  
474 474 The Writeback tag is used by filemap*wait* and sync_page* functions,
475   -via wait_on_page_writeback_range, to wait for all writeback to
  475 +via filemap_fdatawait_range, to wait for all writeback to
476 476 complete. While waiting ->sync_page (if defined) will be called on
477 477 each page that is found to require writeback.
478 478  
... ... @@ -286,7 +286,7 @@
286 286 if (err) {
287 287 /*
288 288 * Because AS_EIO is cleared by
289   - * wait_on_page_writeback_range(), set it again so
  289 + * filemap_fdatawait_range(), set it again so
290 290 * that user process can get -EIO from fsync().
291 291 */
292 292 set_bit(AS_EIO,
... ... @@ -453,9 +453,7 @@
453 453  
454 454 ret = 0;
455 455 if (flags & SYNC_FILE_RANGE_WAIT_BEFORE) {
456   - ret = wait_on_page_writeback_range(mapping,
457   - offset >> PAGE_CACHE_SHIFT,
458   - endbyte >> PAGE_CACHE_SHIFT);
  456 + ret = filemap_fdatawait_range(mapping, offset, endbyte);
459 457 if (ret < 0)
460 458 goto out;
461 459 }
... ... @@ -468,9 +466,7 @@
468 466 }
469 467  
470 468 if (flags & SYNC_FILE_RANGE_WAIT_AFTER) {
471   - ret = wait_on_page_writeback_range(mapping,
472   - offset >> PAGE_CACHE_SHIFT,
473   - endbyte >> PAGE_CACHE_SHIFT);
  469 + ret = filemap_fdatawait_range(mapping, offset, endbyte);
474 470 }
475 471 out:
476 472 return ret;
... ... @@ -2091,8 +2091,6 @@
2091 2091 extern int filemap_write_and_wait(struct address_space *mapping);
2092 2092 extern int filemap_write_and_wait_range(struct address_space *mapping,
2093 2093 loff_t lstart, loff_t lend);
2094   -extern int wait_on_page_writeback_range(struct address_space *mapping,
2095   - pgoff_t start, pgoff_t end);
2096 2094 extern int __filemap_fdatawrite_range(struct address_space *mapping,
2097 2095 loff_t start, loff_t end, int sync_mode);
2098 2096 extern int filemap_fdatawrite_range(struct address_space *mapping,
... ... @@ -260,27 +260,27 @@
260 260 EXPORT_SYMBOL(filemap_flush);
261 261  
262 262 /**
263   - * wait_on_page_writeback_range - wait for writeback to complete
264   - * @mapping: target address_space
265   - * @start: beginning page index
266   - * @end: ending page index
  263 + * filemap_fdatawait_range - wait for writeback to complete
  264 + * @mapping: address space structure to wait for
  265 + * @start_byte: offset in bytes where the range starts
  266 + * @end_byte: offset in bytes where the range ends (inclusive)
267 267 *
268   - * Wait for writeback to complete against pages indexed by start->end
269   - * inclusive
  268 + * Walk the list of under-writeback pages of the given address space
  269 + * in the given range and wait for all of them.
270 270 */
271   -int wait_on_page_writeback_range(struct address_space *mapping,
272   - pgoff_t start, pgoff_t end)
  271 +int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte,
  272 + loff_t end_byte)
273 273 {
  274 + pgoff_t index = start_byte >> PAGE_CACHE_SHIFT;
  275 + pgoff_t end = end_byte >> PAGE_CACHE_SHIFT;
274 276 struct pagevec pvec;
275 277 int nr_pages;
276 278 int ret = 0;
277   - pgoff_t index;
278 279  
279   - if (end < start)
  280 + if (end_byte < start_byte)
280 281 return 0;
281 282  
282 283 pagevec_init(&pvec, 0);
283   - index = start;
284 284 while ((index <= end) &&
285 285 (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
286 286 PAGECACHE_TAG_WRITEBACK,
... ... @@ -310,25 +310,6 @@
310 310  
311 311 return ret;
312 312 }
313   -
314   -/**
315   - * filemap_fdatawait_range - wait for all under-writeback pages to complete in a given range
316   - * @mapping: address space structure to wait for
317   - * @start: offset in bytes where the range starts
318   - * @end: offset in bytes where the range ends (inclusive)
319   - *
320   - * Walk the list of under-writeback pages of the given address space
321   - * in the given range and wait for all of them.
322   - *
323   - * This is just a simple wrapper so that callers don't have to convert offsets
324   - * to page indexes themselves
325   - */
326   -int filemap_fdatawait_range(struct address_space *mapping, loff_t start,
327   - loff_t end)
328   -{
329   - return wait_on_page_writeback_range(mapping, start >> PAGE_CACHE_SHIFT,
330   - end >> PAGE_CACHE_SHIFT);
331   -}
332 313 EXPORT_SYMBOL(filemap_fdatawait_range);
333 314  
334 315 /**
... ... @@ -345,8 +326,7 @@
345 326 if (i_size == 0)
346 327 return 0;
347 328  
348   - return wait_on_page_writeback_range(mapping, 0,
349   - (i_size - 1) >> PAGE_CACHE_SHIFT);
  329 + return filemap_fdatawait_range(mapping, 0, i_size - 1);
350 330 }
351 331 EXPORT_SYMBOL(filemap_fdatawait);
352 332  
... ... @@ -393,9 +373,8 @@
393 373 WB_SYNC_ALL);
394 374 /* See comment of filemap_write_and_wait() */
395 375 if (err != -EIO) {
396   - int err2 = wait_on_page_writeback_range(mapping,
397   - lstart >> PAGE_CACHE_SHIFT,
398   - lend >> PAGE_CACHE_SHIFT);
  376 + int err2 = filemap_fdatawait_range(mapping,
  377 + lstart, lend);
399 378 if (!err)
400 379 err = err2;
401 380 }