diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index f863e1d7e227..3587554f45ef 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2462,45 +2462,6 @@ out: | |||
2462 | } | 2462 | } |
2463 | EXPORT_SYMBOL(__generic_file_aio_write); | 2463 | EXPORT_SYMBOL(__generic_file_aio_write); |
2464 | 2464 | ||
2465 | |||
2466 | /** | ||
2467 | * generic_file_aio_write_nolock - write data, usually to a device | ||
2468 | * @iocb: IO state structure | ||
2469 | * @iov: vector with data to write | ||
2470 | * @nr_segs: number of segments in the vector | ||
2471 | * @pos: position in file where to write | ||
2472 | * | ||
2473 | * This is a wrapper around __generic_file_aio_write() which takes care of | ||
2474 | * syncing the file in case of O_SYNC file. It does not take i_mutex for the | ||
2475 | * write itself but may do so during syncing. It is meant for users like block | ||
2476 | * devices which do not need i_mutex during write. If your filesystem needs to | ||
2477 | * do a write but already holds i_mutex, use __generic_file_aio_write() | ||
2478 | * directly and then sync the file like generic_file_aio_write(). | ||
2479 | */ | ||
2480 | ssize_t generic_file_aio_write_nolock(struct kiocb *iocb, | ||
2481 | const struct iovec *iov, unsigned long nr_segs, loff_t pos) | ||
2482 | { | ||
2483 | struct file *file = iocb->ki_filp; | ||
2484 | struct address_space *mapping = file->f_mapping; | ||
2485 | struct inode *inode = mapping->host; | ||
2486 | ssize_t ret; | ||
2487 | |||
2488 | BUG_ON(iocb->ki_pos != pos); | ||
2489 | |||
2490 | ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); | ||
2491 | |||
2492 | if ((ret > 0 || ret == -EIOCBQUEUED) && | ||
2493 | ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { | ||
2494 | ssize_t err; | ||
2495 | |||
2496 | err = sync_page_range_nolock(inode, mapping, pos, ret); | ||
2497 | if (err < 0 && ret > 0) | ||
2498 | ret = err; | ||
2499 | } | ||
2500 | return ret; | ||
2501 | } | ||
2502 | EXPORT_SYMBOL(generic_file_aio_write_nolock); | ||
2503 | |||
2504 | /** | 2465 | /** |
2505 | * generic_file_aio_write - write data to a file | 2466 | * generic_file_aio_write - write data to a file |
2506 | * @iocb: IO state structure | 2467 | * @iocb: IO state structure |