Lines Matching refs:iocb

2422 static int filemap_update_page(struct kiocb *iocb,  in filemap_update_page()  argument
2428 if (iocb->ki_flags & IOCB_NOWAIT) { in filemap_update_page()
2437 if (iocb->ki_flags & (IOCB_NOWAIT | IOCB_NOIO)) in filemap_update_page()
2439 if (!(iocb->ki_flags & IOCB_WAITQ)) { in filemap_update_page()
2448 error = __folio_lock_async(folio, iocb->ki_waitq); in filemap_update_page()
2458 if (filemap_range_uptodate(mapping, iocb->ki_pos, count, folio, in filemap_update_page()
2463 if (iocb->ki_flags & (IOCB_NOIO | IOCB_NOWAIT | IOCB_WAITQ)) in filemap_update_page()
2466 error = filemap_read_folio(iocb->ki_filp, mapping->a_ops->read_folio, in filemap_update_page()
2523 static int filemap_readahead(struct kiocb *iocb, struct file *file, in filemap_readahead() argument
2529 if (iocb->ki_flags & IOCB_NOIO) in filemap_readahead()
2535 static int filemap_get_pages(struct kiocb *iocb, size_t count, in filemap_get_pages() argument
2538 struct file *filp = iocb->ki_filp; in filemap_get_pages()
2541 pgoff_t index = iocb->ki_pos >> PAGE_SHIFT; in filemap_get_pages()
2547 last_index = DIV_ROUND_UP(iocb->ki_pos + count, PAGE_SIZE); in filemap_get_pages()
2554 if (iocb->ki_flags & IOCB_NOIO) in filemap_get_pages()
2561 if (iocb->ki_flags & (IOCB_NOWAIT | IOCB_WAITQ)) in filemap_get_pages()
2564 iocb->ki_pos >> PAGE_SHIFT, fbatch); in filemap_get_pages()
2572 err = filemap_readahead(iocb, filp, mapping, folio, last_index); in filemap_get_pages()
2577 if ((iocb->ki_flags & IOCB_WAITQ) && in filemap_get_pages()
2579 iocb->ki_flags |= IOCB_NOWAIT; in filemap_get_pages()
2580 err = filemap_update_page(iocb, mapping, count, folio, in filemap_get_pages()
2617 ssize_t filemap_read(struct kiocb *iocb, struct iov_iter *iter, in filemap_read() argument
2620 struct file *filp = iocb->ki_filp; in filemap_read()
2630 if (unlikely(iocb->ki_pos >= inode->i_sb->s_maxbytes)) in filemap_read()
2646 if ((iocb->ki_flags & IOCB_WAITQ) && already_read) in filemap_read()
2647 iocb->ki_flags |= IOCB_NOWAIT; in filemap_read()
2649 if (unlikely(iocb->ki_pos >= i_size_read(inode))) in filemap_read()
2652 error = filemap_get_pages(iocb, iter->count, &fbatch, false); in filemap_read()
2665 if (unlikely(iocb->ki_pos >= isize)) in filemap_read()
2667 end_offset = min_t(loff_t, isize, iocb->ki_pos + iter->count); in filemap_read()
2688 if (!pos_same_folio(iocb->ki_pos, last_pos - 1, in filemap_read()
2695 size_t offset = iocb->ki_pos & (fsize - 1); in filemap_read()
2696 size_t bytes = min_t(loff_t, end_offset - iocb->ki_pos, in filemap_read()
2715 iocb->ki_pos += copied; in filemap_read()
2716 last_pos = iocb->ki_pos; in filemap_read()
2727 } while (iov_iter_count(iter) && iocb->ki_pos < isize && !error); in filemap_read()
2735 int kiocb_write_and_wait(struct kiocb *iocb, size_t count) in kiocb_write_and_wait() argument
2737 struct address_space *mapping = iocb->ki_filp->f_mapping; in kiocb_write_and_wait()
2738 loff_t pos = iocb->ki_pos; in kiocb_write_and_wait()
2741 if (iocb->ki_flags & IOCB_NOWAIT) { in kiocb_write_and_wait()
2750 int kiocb_invalidate_pages(struct kiocb *iocb, size_t count) in kiocb_invalidate_pages() argument
2752 struct address_space *mapping = iocb->ki_filp->f_mapping; in kiocb_invalidate_pages()
2753 loff_t pos = iocb->ki_pos; in kiocb_invalidate_pages()
2757 if (iocb->ki_flags & IOCB_NOWAIT) { in kiocb_invalidate_pages()
2799 generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) in generic_file_read_iter() argument
2807 if (iocb->ki_flags & IOCB_DIRECT) { in generic_file_read_iter()
2808 struct file *file = iocb->ki_filp; in generic_file_read_iter()
2812 retval = kiocb_write_and_wait(iocb, count); in generic_file_read_iter()
2817 retval = mapping->a_ops->direct_IO(iocb, iter); in generic_file_read_iter()
2819 iocb->ki_pos += retval; in generic_file_read_iter()
2836 if (iocb->ki_pos >= i_size_read(inode)) in generic_file_read_iter()
2840 return filemap_read(iocb, iter, retval); in generic_file_read_iter()
2902 struct kiocb iocb; in filemap_splice_read() local
2911 init_sync_kiocb(&iocb, in); in filemap_splice_read()
2912 iocb.ki_pos = *ppos; in filemap_splice_read()
2927 iocb.ki_pos = *ppos; in filemap_splice_read()
2928 error = filemap_get_pages(&iocb, len, &fbatch, true); in filemap_splice_read()
3874 void kiocb_invalidate_post_direct_write(struct kiocb *iocb, size_t count) in kiocb_invalidate_post_direct_write() argument
3876 struct address_space *mapping = iocb->ki_filp->f_mapping; in kiocb_invalidate_post_direct_write()
3880 iocb->ki_pos >> PAGE_SHIFT, in kiocb_invalidate_post_direct_write()
3881 (iocb->ki_pos + count - 1) >> PAGE_SHIFT)) in kiocb_invalidate_post_direct_write()
3882 dio_warn_stale_pagecache(iocb->ki_filp); in kiocb_invalidate_post_direct_write()
3886 generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from) in generic_file_direct_write() argument
3888 struct address_space *mapping = iocb->ki_filp->f_mapping; in generic_file_direct_write()
3896 written = kiocb_invalidate_pages(iocb, write_len); in generic_file_direct_write()
3903 written = mapping->a_ops->direct_IO(iocb, from); in generic_file_direct_write()
3924 loff_t pos = iocb->ki_pos; in generic_file_direct_write()
3926 kiocb_invalidate_post_direct_write(iocb, written); in generic_file_direct_write()
3933 iocb->ki_pos = pos; in generic_file_direct_write()
3941 ssize_t generic_perform_write(struct kiocb *iocb, struct iov_iter *i) in generic_perform_write() argument
3943 struct file *file = iocb->ki_filp; in generic_perform_write()
3944 loff_t pos = iocb->ki_pos; in generic_perform_write()
4017 iocb->ki_pos += written; in generic_perform_write()
4043 ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from) in __generic_file_write_iter() argument
4045 struct file *file = iocb->ki_filp; in __generic_file_write_iter()
4058 if (iocb->ki_flags & IOCB_DIRECT) { in __generic_file_write_iter()
4059 ret = generic_file_direct_write(iocb, from); in __generic_file_write_iter()
4069 return direct_write_fallback(iocb, from, ret, in __generic_file_write_iter()
4070 generic_perform_write(iocb, from)); in __generic_file_write_iter()
4073 return generic_perform_write(iocb, from); in __generic_file_write_iter()
4090 ssize_t generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from) in generic_file_write_iter() argument
4092 struct file *file = iocb->ki_filp; in generic_file_write_iter()
4097 ret = generic_write_checks(iocb, from); in generic_file_write_iter()
4099 ret = __generic_file_write_iter(iocb, from); in generic_file_write_iter()
4103 ret = generic_write_sync(iocb, ret); in generic_file_write_iter()