diff options
-rw-r--r-- | fs/fs-writeback.c | 54 | ||||
-rw-r--r-- | include/linux/fs.h | 5 | ||||
-rw-r--r-- | include/linux/writeback.h | 4 | ||||
-rw-r--r-- | mm/filemap.c | 64 |
4 files changed, 0 insertions, 127 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index da86ef58e427..628235cf44b5 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -1242,57 +1242,3 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc) | |||
1242 | return ret; | 1242 | return ret; |
1243 | } | 1243 | } |
1244 | EXPORT_SYMBOL(sync_inode); | 1244 | EXPORT_SYMBOL(sync_inode); |
1245 | |||
1246 | /** | ||
1247 | * generic_osync_inode - flush all dirty data for a given inode to disk | ||
1248 | * @inode: inode to write | ||
1249 | * @mapping: the address_space that should be flushed | ||
1250 | * @what: what to write and wait upon | ||
1251 | * | ||
1252 | * This can be called by file_write functions for files which have the | ||
1253 | * O_SYNC flag set, to flush dirty writes to disk. | ||
1254 | * | ||
1255 | * @what is a bitmask, specifying which part of the inode's data should be | ||
1256 | * written and waited upon. | ||
1257 | * | ||
1258 | * OSYNC_DATA: i_mapping's dirty data | ||
1259 | * OSYNC_METADATA: the buffers at i_mapping->private_list | ||
1260 | * OSYNC_INODE: the inode itself | ||
1261 | */ | ||
1262 | |||
1263 | int generic_osync_inode(struct inode *inode, struct address_space *mapping, int what) | ||
1264 | { | ||
1265 | int err = 0; | ||
1266 | int need_write_inode_now = 0; | ||
1267 | int err2; | ||
1268 | |||
1269 | if (what & OSYNC_DATA) | ||
1270 | err = filemap_fdatawrite(mapping); | ||
1271 | if (what & (OSYNC_METADATA|OSYNC_DATA)) { | ||
1272 | err2 = sync_mapping_buffers(mapping); | ||
1273 | if (!err) | ||
1274 | err = err2; | ||
1275 | } | ||
1276 | if (what & OSYNC_DATA) { | ||
1277 | err2 = filemap_fdatawait(mapping); | ||
1278 | if (!err) | ||
1279 | err = err2; | ||
1280 | } | ||
1281 | |||
1282 | spin_lock(&inode_lock); | ||
1283 | if ((inode->i_state & I_DIRTY) && | ||
1284 | ((what & OSYNC_INODE) || (inode->i_state & I_DIRTY_DATASYNC))) | ||
1285 | need_write_inode_now = 1; | ||
1286 | spin_unlock(&inode_lock); | ||
1287 | |||
1288 | if (need_write_inode_now) { | ||
1289 | err2 = write_inode_now(inode, 1); | ||
1290 | if (!err) | ||
1291 | err = err2; | ||
1292 | } | ||
1293 | else | ||
1294 | inode_sync_wait(inode); | ||
1295 | |||
1296 | return err; | ||
1297 | } | ||
1298 | EXPORT_SYMBOL(generic_osync_inode); | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index e2c7f5167662..37f53216998a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1455,11 +1455,6 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); | |||
1455 | #define DT_SOCK 12 | 1455 | #define DT_SOCK 12 |
1456 | #define DT_WHT 14 | 1456 | #define DT_WHT 14 |
1457 | 1457 | ||
1458 | #define OSYNC_METADATA (1<<0) | ||
1459 | #define OSYNC_DATA (1<<1) | ||
1460 | #define OSYNC_INODE (1<<2) | ||
1461 | int generic_osync_inode(struct inode *, struct address_space *, int); | ||
1462 | |||
1463 | /* | 1458 | /* |
1464 | * This is the "filldir" function type, used by readdir() to let | 1459 | * This is the "filldir" function type, used by readdir() to let |
1465 | * the kernel specify what kind of dirent layout it wants to have. | 1460 | * the kernel specify what kind of dirent layout it wants to have. |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 78b1e4684cc9..d347632f1861 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -150,10 +150,6 @@ int write_cache_pages(struct address_space *mapping, | |||
150 | struct writeback_control *wbc, writepage_t writepage, | 150 | struct writeback_control *wbc, writepage_t writepage, |
151 | void *data); | 151 | void *data); |
152 | int do_writepages(struct address_space *mapping, struct writeback_control *wbc); | 152 | int do_writepages(struct address_space *mapping, struct writeback_control *wbc); |
153 | int sync_page_range(struct inode *inode, struct address_space *mapping, | ||
154 | loff_t pos, loff_t count); | ||
155 | int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, | ||
156 | loff_t pos, loff_t count); | ||
157 | void set_page_dirty_balance(struct page *page, int page_mkwrite); | 153 | void set_page_dirty_balance(struct page *page, int page_mkwrite); |
158 | void writeback_set_ratelimit(void); | 154 | void writeback_set_ratelimit(void); |
159 | 155 | ||
diff --git a/mm/filemap.c b/mm/filemap.c index 849293c4f418..dd51c68e2b86 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -326,70 +326,6 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start, | |||
326 | EXPORT_SYMBOL(filemap_fdatawait_range); | 326 | EXPORT_SYMBOL(filemap_fdatawait_range); |
327 | 327 | ||
328 | /** | 328 | /** |
329 | * sync_page_range - write and wait on all pages in the passed range | ||
330 | * @inode: target inode | ||
331 | * @mapping: target address_space | ||
332 | * @pos: beginning offset in pages to write | ||
333 | * @count: number of bytes to write | ||
334 | * | ||
335 | * Write and wait upon all the pages in the passed range. This is a "data | ||
336 | * integrity" operation. It waits upon in-flight writeout before starting and | ||
337 | * waiting upon new writeout. If there was an IO error, return it. | ||
338 | * | ||
339 | * We need to re-take i_mutex during the generic_osync_inode list walk because | ||
340 | * it is otherwise livelockable. | ||
341 | */ | ||
342 | int sync_page_range(struct inode *inode, struct address_space *mapping, | ||
343 | loff_t pos, loff_t count) | ||
344 | { | ||
345 | pgoff_t start = pos >> PAGE_CACHE_SHIFT; | ||
346 | pgoff_t end = (pos + count - 1) >> PAGE_CACHE_SHIFT; | ||
347 | int ret; | ||
348 | |||
349 | if (!mapping_cap_writeback_dirty(mapping) || !count) | ||
350 | return 0; | ||
351 | ret = filemap_fdatawrite_range(mapping, pos, pos + count - 1); | ||
352 | if (ret == 0) { | ||
353 | mutex_lock(&inode->i_mutex); | ||
354 | ret = generic_osync_inode(inode, mapping, OSYNC_METADATA); | ||
355 | mutex_unlock(&inode->i_mutex); | ||
356 | } | ||
357 | if (ret == 0) | ||
358 | ret = wait_on_page_writeback_range(mapping, start, end); | ||
359 | return ret; | ||
360 | } | ||
361 | EXPORT_SYMBOL(sync_page_range); | ||
362 | |||
363 | /** | ||
364 | * sync_page_range_nolock - write & wait on all pages in the passed range without locking | ||
365 | * @inode: target inode | ||
366 | * @mapping: target address_space | ||
367 | * @pos: beginning offset in pages to write | ||
368 | * @count: number of bytes to write | ||
369 | * | ||
370 | * Note: Holding i_mutex across sync_page_range_nolock() is not a good idea | ||
371 | * as it forces O_SYNC writers to different parts of the same file | ||
372 | * to be serialised right until io completion. | ||
373 | */ | ||
374 | int sync_page_range_nolock(struct inode *inode, struct address_space *mapping, | ||
375 | loff_t pos, loff_t count) | ||
376 | { | ||
377 | pgoff_t start = pos >> PAGE_CACHE_SHIFT; | ||
378 | pgoff_t end = (pos + count - 1) >> PAGE_CACHE_SHIFT; | ||
379 | int ret; | ||
380 | |||
381 | if (!mapping_cap_writeback_dirty(mapping) || !count) | ||
382 | return 0; | ||
383 | ret = filemap_fdatawrite_range(mapping, pos, pos + count - 1); | ||
384 | if (ret == 0) | ||
385 | ret = generic_osync_inode(inode, mapping, OSYNC_METADATA); | ||
386 | if (ret == 0) | ||
387 | ret = wait_on_page_writeback_range(mapping, start, end); | ||
388 | return ret; | ||
389 | } | ||
390 | EXPORT_SYMBOL(sync_page_range_nolock); | ||
391 | |||
392 | /** | ||
393 | * filemap_fdatawait - wait for all under-writeback pages to complete | 329 | * filemap_fdatawait - wait for all under-writeback pages to complete |
394 | * @mapping: address space structure to wait for | 330 | * @mapping: address space structure to wait for |
395 | * | 331 | * |