ipc/sem: rework task wakeups
[cris-mirror.git] / fs / ext4 / file.c
blobb5f184493c57b0fd91cfc5f6c0633577ce770884
1 /*
2 * linux/fs/ext4/file.c
4 * Copyright (C) 1992, 1993, 1994, 1995
5 * Remy Card (card@masi.ibp.fr)
6 * Laboratoire MASI - Institut Blaise Pascal
7 * Universite Pierre et Marie Curie (Paris VI)
9 * from
11 * linux/fs/minix/file.c
13 * Copyright (C) 1991, 1992 Linus Torvalds
15 * ext4 fs regular file handling primitives
17 * 64-bit file support on 64-bit platforms by Jakub Jelinek
18 * (jj@sunsite.ms.mff.cuni.cz)
21 #include <linux/time.h>
22 #include <linux/fs.h>
23 #include <linux/mount.h>
24 #include <linux/path.h>
25 #include <linux/dax.h>
26 #include <linux/quotaops.h>
27 #include <linux/pagevec.h>
28 #include <linux/uio.h>
29 #include "ext4.h"
30 #include "ext4_jbd2.h"
31 #include "xattr.h"
32 #include "acl.h"
34 #ifdef CONFIG_FS_DAX
35 static ssize_t ext4_dax_read_iter(struct kiocb *iocb, struct iov_iter *to)
37 struct inode *inode = file_inode(iocb->ki_filp);
38 ssize_t ret;
40 inode_lock_shared(inode);
42 * Recheck under inode lock - at this point we are sure it cannot
43 * change anymore
45 if (!IS_DAX(inode)) {
46 inode_unlock_shared(inode);
47 /* Fallback to buffered IO in case we cannot support DAX */
48 return generic_file_read_iter(iocb, to);
50 ret = dax_iomap_rw(iocb, to, &ext4_iomap_ops);
51 inode_unlock_shared(inode);
53 file_accessed(iocb->ki_filp);
54 return ret;
56 #endif
58 static ssize_t ext4_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
60 if (!iov_iter_count(to))
61 return 0; /* skip atime */
63 #ifdef CONFIG_FS_DAX
64 if (IS_DAX(file_inode(iocb->ki_filp)))
65 return ext4_dax_read_iter(iocb, to);
66 #endif
67 return generic_file_read_iter(iocb, to);
71 * Called when an inode is released. Note that this is different
72 * from ext4_file_open: open gets called at every open, but release
73 * gets called only when /all/ the files are closed.
75 static int ext4_release_file(struct inode *inode, struct file *filp)
77 if (ext4_test_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE)) {
78 ext4_alloc_da_blocks(inode);
79 ext4_clear_inode_state(inode, EXT4_STATE_DA_ALLOC_CLOSE);
81 /* if we are the last writer on the inode, drop the block reservation */
82 if ((filp->f_mode & FMODE_WRITE) &&
83 (atomic_read(&inode->i_writecount) == 1) &&
84 !EXT4_I(inode)->i_reserved_data_blocks)
86 down_write(&EXT4_I(inode)->i_data_sem);
87 ext4_discard_preallocations(inode);
88 up_write(&EXT4_I(inode)->i_data_sem);
90 if (is_dx(inode) && filp->private_data)
91 ext4_htree_free_dir_info(filp->private_data);
93 return 0;
96 static void ext4_unwritten_wait(struct inode *inode)
98 wait_queue_head_t *wq = ext4_ioend_wq(inode);
100 wait_event(*wq, (atomic_read(&EXT4_I(inode)->i_unwritten) == 0));
104 * This tests whether the IO in question is block-aligned or not.
105 * Ext4 utilizes unwritten extents when hole-filling during direct IO, and they
106 * are converted to written only after the IO is complete. Until they are
107 * mapped, these blocks appear as holes, so dio_zero_block() will assume that
108 * it needs to zero out portions of the start and/or end block. If 2 AIO
109 * threads are at work on the same unwritten block, they must be synchronized
110 * or one thread will zero the other's data, causing corruption.
112 static int
113 ext4_unaligned_aio(struct inode *inode, struct iov_iter *from, loff_t pos)
115 struct super_block *sb = inode->i_sb;
116 int blockmask = sb->s_blocksize - 1;
118 if (pos >= i_size_read(inode))
119 return 0;
121 if ((pos | iov_iter_alignment(from)) & blockmask)
122 return 1;
124 return 0;
127 /* Is IO overwriting allocated and initialized blocks? */
128 static bool ext4_overwrite_io(struct inode *inode, loff_t pos, loff_t len)
130 struct ext4_map_blocks map;
131 unsigned int blkbits = inode->i_blkbits;
132 int err, blklen;
134 if (pos + len > i_size_read(inode))
135 return false;
137 map.m_lblk = pos >> blkbits;
138 map.m_len = EXT4_MAX_BLOCKS(len, pos, blkbits);
139 blklen = map.m_len;
141 err = ext4_map_blocks(NULL, inode, &map, 0);
143 * 'err==len' means that all of the blocks have been preallocated,
144 * regardless of whether they have been initialized or not. To exclude
145 * unwritten extents, we need to check m_flags.
147 return err == blklen && (map.m_flags & EXT4_MAP_MAPPED);
150 static ssize_t ext4_write_checks(struct kiocb *iocb, struct iov_iter *from)
152 struct inode *inode = file_inode(iocb->ki_filp);
153 ssize_t ret;
155 ret = generic_write_checks(iocb, from);
156 if (ret <= 0)
157 return ret;
159 * If we have encountered a bitmap-format file, the size limit
160 * is smaller than s_maxbytes, which is for extent-mapped files.
162 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
163 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
165 if (iocb->ki_pos >= sbi->s_bitmap_maxbytes)
166 return -EFBIG;
167 iov_iter_truncate(from, sbi->s_bitmap_maxbytes - iocb->ki_pos);
169 return iov_iter_count(from);
172 #ifdef CONFIG_FS_DAX
173 static ssize_t
174 ext4_dax_write_iter(struct kiocb *iocb, struct iov_iter *from)
176 struct inode *inode = file_inode(iocb->ki_filp);
177 ssize_t ret;
178 bool overwrite = false;
180 inode_lock(inode);
181 ret = ext4_write_checks(iocb, from);
182 if (ret <= 0)
183 goto out;
184 ret = file_remove_privs(iocb->ki_filp);
185 if (ret)
186 goto out;
187 ret = file_update_time(iocb->ki_filp);
188 if (ret)
189 goto out;
191 if (ext4_overwrite_io(inode, iocb->ki_pos, iov_iter_count(from))) {
192 overwrite = true;
193 downgrade_write(&inode->i_rwsem);
195 ret = dax_iomap_rw(iocb, from, &ext4_iomap_ops);
196 out:
197 if (!overwrite)
198 inode_unlock(inode);
199 else
200 inode_unlock_shared(inode);
201 if (ret > 0)
202 ret = generic_write_sync(iocb, ret);
203 return ret;
205 #endif
207 static ssize_t
208 ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
210 struct inode *inode = file_inode(iocb->ki_filp);
211 int o_direct = iocb->ki_flags & IOCB_DIRECT;
212 int unaligned_aio = 0;
213 int overwrite = 0;
214 ssize_t ret;
216 #ifdef CONFIG_FS_DAX
217 if (IS_DAX(inode))
218 return ext4_dax_write_iter(iocb, from);
219 #endif
221 inode_lock(inode);
222 ret = ext4_write_checks(iocb, from);
223 if (ret <= 0)
224 goto out;
227 * Unaligned direct AIO must be serialized among each other as zeroing
228 * of partial blocks of two competing unaligned AIOs can result in data
229 * corruption.
231 if (o_direct && ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS) &&
232 !is_sync_kiocb(iocb) &&
233 ext4_unaligned_aio(inode, from, iocb->ki_pos)) {
234 unaligned_aio = 1;
235 ext4_unwritten_wait(inode);
238 iocb->private = &overwrite;
239 /* Check whether we do a DIO overwrite or not */
240 if (o_direct && ext4_should_dioread_nolock(inode) && !unaligned_aio &&
241 ext4_overwrite_io(inode, iocb->ki_pos, iov_iter_count(from)))
242 overwrite = 1;
244 ret = __generic_file_write_iter(iocb, from);
245 inode_unlock(inode);
247 if (ret > 0)
248 ret = generic_write_sync(iocb, ret);
250 return ret;
252 out:
253 inode_unlock(inode);
254 return ret;
257 #ifdef CONFIG_FS_DAX
258 static int ext4_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
260 int result;
261 handle_t *handle = NULL;
262 struct inode *inode = file_inode(vma->vm_file);
263 struct super_block *sb = inode->i_sb;
264 bool write = vmf->flags & FAULT_FLAG_WRITE;
266 if (write) {
267 sb_start_pagefault(sb);
268 file_update_time(vma->vm_file);
269 down_read(&EXT4_I(inode)->i_mmap_sem);
270 handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE,
271 EXT4_DATA_TRANS_BLOCKS(sb));
272 } else
273 down_read(&EXT4_I(inode)->i_mmap_sem);
275 if (IS_ERR(handle))
276 result = VM_FAULT_SIGBUS;
277 else
278 result = dax_iomap_fault(vma, vmf, &ext4_iomap_ops);
280 if (write) {
281 if (!IS_ERR(handle))
282 ext4_journal_stop(handle);
283 up_read(&EXT4_I(inode)->i_mmap_sem);
284 sb_end_pagefault(sb);
285 } else
286 up_read(&EXT4_I(inode)->i_mmap_sem);
288 return result;
291 static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr,
292 pmd_t *pmd, unsigned int flags)
294 int result;
295 handle_t *handle = NULL;
296 struct inode *inode = file_inode(vma->vm_file);
297 struct super_block *sb = inode->i_sb;
298 bool write = flags & FAULT_FLAG_WRITE;
300 if (write) {
301 sb_start_pagefault(sb);
302 file_update_time(vma->vm_file);
303 down_read(&EXT4_I(inode)->i_mmap_sem);
304 handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE,
305 ext4_chunk_trans_blocks(inode,
306 PMD_SIZE / PAGE_SIZE));
307 } else
308 down_read(&EXT4_I(inode)->i_mmap_sem);
310 if (IS_ERR(handle))
311 result = VM_FAULT_SIGBUS;
312 else {
313 result = dax_iomap_pmd_fault(vma, addr, pmd, flags,
314 &ext4_iomap_ops);
317 if (write) {
318 if (!IS_ERR(handle))
319 ext4_journal_stop(handle);
320 up_read(&EXT4_I(inode)->i_mmap_sem);
321 sb_end_pagefault(sb);
322 } else
323 up_read(&EXT4_I(inode)->i_mmap_sem);
325 return result;
329 * Handle write fault for VM_MIXEDMAP mappings. Similarly to ext4_dax_fault()
330 * handler we check for races agaist truncate. Note that since we cycle through
331 * i_mmap_sem, we are sure that also any hole punching that began before we
332 * were called is finished by now and so if it included part of the file we
333 * are working on, our pte will get unmapped and the check for pte_same() in
334 * wp_pfn_shared() fails. Thus fault gets retried and things work out as
335 * desired.
337 static int ext4_dax_pfn_mkwrite(struct vm_area_struct *vma,
338 struct vm_fault *vmf)
340 struct inode *inode = file_inode(vma->vm_file);
341 struct super_block *sb = inode->i_sb;
342 loff_t size;
343 int ret;
345 sb_start_pagefault(sb);
346 file_update_time(vma->vm_file);
347 down_read(&EXT4_I(inode)->i_mmap_sem);
348 size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
349 if (vmf->pgoff >= size)
350 ret = VM_FAULT_SIGBUS;
351 else
352 ret = dax_pfn_mkwrite(vma, vmf);
353 up_read(&EXT4_I(inode)->i_mmap_sem);
354 sb_end_pagefault(sb);
356 return ret;
359 static const struct vm_operations_struct ext4_dax_vm_ops = {
360 .fault = ext4_dax_fault,
361 .pmd_fault = ext4_dax_pmd_fault,
362 .page_mkwrite = ext4_dax_fault,
363 .pfn_mkwrite = ext4_dax_pfn_mkwrite,
365 #else
366 #define ext4_dax_vm_ops ext4_file_vm_ops
367 #endif
369 static const struct vm_operations_struct ext4_file_vm_ops = {
370 .fault = ext4_filemap_fault,
371 .map_pages = filemap_map_pages,
372 .page_mkwrite = ext4_page_mkwrite,
375 static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma)
377 struct inode *inode = file->f_mapping->host;
379 if (ext4_encrypted_inode(inode)) {
380 int err = fscrypt_get_encryption_info(inode);
381 if (err)
382 return 0;
383 if (!fscrypt_has_encryption_key(inode))
384 return -ENOKEY;
386 file_accessed(file);
387 if (IS_DAX(file_inode(file))) {
388 vma->vm_ops = &ext4_dax_vm_ops;
389 vma->vm_flags |= VM_MIXEDMAP | VM_HUGEPAGE;
390 } else {
391 vma->vm_ops = &ext4_file_vm_ops;
393 return 0;
396 static int ext4_file_open(struct inode * inode, struct file * filp)
398 struct super_block *sb = inode->i_sb;
399 struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
400 struct vfsmount *mnt = filp->f_path.mnt;
401 struct dentry *dir;
402 struct path path;
403 char buf[64], *cp;
404 int ret;
406 if (unlikely(!(sbi->s_mount_flags & EXT4_MF_MNTDIR_SAMPLED) &&
407 !(sb->s_flags & MS_RDONLY))) {
408 sbi->s_mount_flags |= EXT4_MF_MNTDIR_SAMPLED;
410 * Sample where the filesystem has been mounted and
411 * store it in the superblock for sysadmin convenience
412 * when trying to sort through large numbers of block
413 * devices or filesystem images.
415 memset(buf, 0, sizeof(buf));
416 path.mnt = mnt;
417 path.dentry = mnt->mnt_root;
418 cp = d_path(&path, buf, sizeof(buf));
419 if (!IS_ERR(cp)) {
420 handle_t *handle;
421 int err;
423 handle = ext4_journal_start_sb(sb, EXT4_HT_MISC, 1);
424 if (IS_ERR(handle))
425 return PTR_ERR(handle);
426 BUFFER_TRACE(sbi->s_sbh, "get_write_access");
427 err = ext4_journal_get_write_access(handle, sbi->s_sbh);
428 if (err) {
429 ext4_journal_stop(handle);
430 return err;
432 strlcpy(sbi->s_es->s_last_mounted, cp,
433 sizeof(sbi->s_es->s_last_mounted));
434 ext4_handle_dirty_super(handle, sb);
435 ext4_journal_stop(handle);
438 if (ext4_encrypted_inode(inode)) {
439 ret = fscrypt_get_encryption_info(inode);
440 if (ret)
441 return -EACCES;
442 if (!fscrypt_has_encryption_key(inode))
443 return -ENOKEY;
446 dir = dget_parent(file_dentry(filp));
447 if (ext4_encrypted_inode(d_inode(dir)) &&
448 !fscrypt_has_permitted_context(d_inode(dir), inode)) {
449 ext4_warning(inode->i_sb,
450 "Inconsistent encryption contexts: %lu/%lu",
451 (unsigned long) d_inode(dir)->i_ino,
452 (unsigned long) inode->i_ino);
453 dput(dir);
454 return -EPERM;
456 dput(dir);
458 * Set up the jbd2_inode if we are opening the inode for
459 * writing and the journal is present
461 if (filp->f_mode & FMODE_WRITE) {
462 ret = ext4_inode_attach_jinode(inode);
463 if (ret < 0)
464 return ret;
466 return dquot_file_open(inode, filp);
470 * Here we use ext4_map_blocks() to get a block mapping for a extent-based
471 * file rather than ext4_ext_walk_space() because we can introduce
472 * SEEK_DATA/SEEK_HOLE for block-mapped and extent-mapped file at the same
473 * function. When extent status tree has been fully implemented, it will
474 * track all extent status for a file and we can directly use it to
475 * retrieve the offset for SEEK_DATA/SEEK_HOLE.
479 * When we retrieve the offset for SEEK_DATA/SEEK_HOLE, we would need to
480 * lookup page cache to check whether or not there has some data between
481 * [startoff, endoff] because, if this range contains an unwritten extent,
482 * we determine this extent as a data or a hole according to whether the
483 * page cache has data or not.
485 static int ext4_find_unwritten_pgoff(struct inode *inode,
486 int whence,
487 ext4_lblk_t end_blk,
488 loff_t *offset)
490 struct pagevec pvec;
491 unsigned int blkbits;
492 pgoff_t index;
493 pgoff_t end;
494 loff_t endoff;
495 loff_t startoff;
496 loff_t lastoff;
497 int found = 0;
499 blkbits = inode->i_sb->s_blocksize_bits;
500 startoff = *offset;
501 lastoff = startoff;
502 endoff = (loff_t)end_blk << blkbits;
504 index = startoff >> PAGE_SHIFT;
505 end = endoff >> PAGE_SHIFT;
507 pagevec_init(&pvec, 0);
508 do {
509 int i, num;
510 unsigned long nr_pages;
512 num = min_t(pgoff_t, end - index, PAGEVEC_SIZE);
513 nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index,
514 (pgoff_t)num);
515 if (nr_pages == 0) {
516 if (whence == SEEK_DATA)
517 break;
519 BUG_ON(whence != SEEK_HOLE);
521 * If this is the first time to go into the loop and
522 * offset is not beyond the end offset, it will be a
523 * hole at this offset
525 if (lastoff == startoff || lastoff < endoff)
526 found = 1;
527 break;
531 * If this is the first time to go into the loop and
532 * offset is smaller than the first page offset, it will be a
533 * hole at this offset.
535 if (lastoff == startoff && whence == SEEK_HOLE &&
536 lastoff < page_offset(pvec.pages[0])) {
537 found = 1;
538 break;
541 for (i = 0; i < nr_pages; i++) {
542 struct page *page = pvec.pages[i];
543 struct buffer_head *bh, *head;
546 * If the current offset is not beyond the end of given
547 * range, it will be a hole.
549 if (lastoff < endoff && whence == SEEK_HOLE &&
550 page->index > end) {
551 found = 1;
552 *offset = lastoff;
553 goto out;
556 lock_page(page);
558 if (unlikely(page->mapping != inode->i_mapping)) {
559 unlock_page(page);
560 continue;
563 if (!page_has_buffers(page)) {
564 unlock_page(page);
565 continue;
568 if (page_has_buffers(page)) {
569 lastoff = page_offset(page);
570 bh = head = page_buffers(page);
571 do {
572 if (buffer_uptodate(bh) ||
573 buffer_unwritten(bh)) {
574 if (whence == SEEK_DATA)
575 found = 1;
576 } else {
577 if (whence == SEEK_HOLE)
578 found = 1;
580 if (found) {
581 *offset = max_t(loff_t,
582 startoff, lastoff);
583 unlock_page(page);
584 goto out;
586 lastoff += bh->b_size;
587 bh = bh->b_this_page;
588 } while (bh != head);
591 lastoff = page_offset(page) + PAGE_SIZE;
592 unlock_page(page);
596 * The no. of pages is less than our desired, that would be a
597 * hole in there.
599 if (nr_pages < num && whence == SEEK_HOLE) {
600 found = 1;
601 *offset = lastoff;
602 break;
605 index = pvec.pages[i - 1]->index + 1;
606 pagevec_release(&pvec);
607 } while (index <= end);
609 out:
610 pagevec_release(&pvec);
611 return found;
615 * ext4_seek_data() retrieves the offset for SEEK_DATA.
617 static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize)
619 struct inode *inode = file->f_mapping->host;
620 struct extent_status es;
621 ext4_lblk_t start, last, end;
622 loff_t dataoff, isize;
623 int blkbits;
624 int ret;
626 inode_lock(inode);
628 isize = i_size_read(inode);
629 if (offset >= isize) {
630 inode_unlock(inode);
631 return -ENXIO;
634 blkbits = inode->i_sb->s_blocksize_bits;
635 start = offset >> blkbits;
636 last = start;
637 end = isize >> blkbits;
638 dataoff = offset;
640 do {
641 ret = ext4_get_next_extent(inode, last, end - last + 1, &es);
642 if (ret <= 0) {
643 /* No extent found -> no data */
644 if (ret == 0)
645 ret = -ENXIO;
646 inode_unlock(inode);
647 return ret;
650 last = es.es_lblk;
651 if (last != start)
652 dataoff = (loff_t)last << blkbits;
653 if (!ext4_es_is_unwritten(&es))
654 break;
657 * If there is a unwritten extent at this offset,
658 * it will be as a data or a hole according to page
659 * cache that has data or not.
661 if (ext4_find_unwritten_pgoff(inode, SEEK_DATA,
662 es.es_lblk + es.es_len, &dataoff))
663 break;
664 last += es.es_len;
665 dataoff = (loff_t)last << blkbits;
666 cond_resched();
667 } while (last <= end);
669 inode_unlock(inode);
671 if (dataoff > isize)
672 return -ENXIO;
674 return vfs_setpos(file, dataoff, maxsize);
678 * ext4_seek_hole() retrieves the offset for SEEK_HOLE.
680 static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize)
682 struct inode *inode = file->f_mapping->host;
683 struct extent_status es;
684 ext4_lblk_t start, last, end;
685 loff_t holeoff, isize;
686 int blkbits;
687 int ret;
689 inode_lock(inode);
691 isize = i_size_read(inode);
692 if (offset >= isize) {
693 inode_unlock(inode);
694 return -ENXIO;
697 blkbits = inode->i_sb->s_blocksize_bits;
698 start = offset >> blkbits;
699 last = start;
700 end = isize >> blkbits;
701 holeoff = offset;
703 do {
704 ret = ext4_get_next_extent(inode, last, end - last + 1, &es);
705 if (ret < 0) {
706 inode_unlock(inode);
707 return ret;
709 /* Found a hole? */
710 if (ret == 0 || es.es_lblk > last) {
711 if (last != start)
712 holeoff = (loff_t)last << blkbits;
713 break;
716 * If there is a unwritten extent at this offset,
717 * it will be as a data or a hole according to page
718 * cache that has data or not.
720 if (ext4_es_is_unwritten(&es) &&
721 ext4_find_unwritten_pgoff(inode, SEEK_HOLE,
722 last + es.es_len, &holeoff))
723 break;
725 last += es.es_len;
726 holeoff = (loff_t)last << blkbits;
727 cond_resched();
728 } while (last <= end);
730 inode_unlock(inode);
732 if (holeoff > isize)
733 holeoff = isize;
735 return vfs_setpos(file, holeoff, maxsize);
739 * ext4_llseek() handles both block-mapped and extent-mapped maxbytes values
740 * by calling generic_file_llseek_size() with the appropriate maxbytes
741 * value for each.
743 loff_t ext4_llseek(struct file *file, loff_t offset, int whence)
745 struct inode *inode = file->f_mapping->host;
746 loff_t maxbytes;
748 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
749 maxbytes = EXT4_SB(inode->i_sb)->s_bitmap_maxbytes;
750 else
751 maxbytes = inode->i_sb->s_maxbytes;
753 switch (whence) {
754 case SEEK_SET:
755 case SEEK_CUR:
756 case SEEK_END:
757 return generic_file_llseek_size(file, offset, whence,
758 maxbytes, i_size_read(inode));
759 case SEEK_DATA:
760 return ext4_seek_data(file, offset, maxbytes);
761 case SEEK_HOLE:
762 return ext4_seek_hole(file, offset, maxbytes);
765 return -EINVAL;
768 const struct file_operations ext4_file_operations = {
769 .llseek = ext4_llseek,
770 .read_iter = ext4_file_read_iter,
771 .write_iter = ext4_file_write_iter,
772 .unlocked_ioctl = ext4_ioctl,
773 #ifdef CONFIG_COMPAT
774 .compat_ioctl = ext4_compat_ioctl,
775 #endif
776 .mmap = ext4_file_mmap,
777 .open = ext4_file_open,
778 .release = ext4_release_file,
779 .fsync = ext4_sync_file,
780 .get_unmapped_area = thp_get_unmapped_area,
781 .splice_read = generic_file_splice_read,
782 .splice_write = iter_file_splice_write,
783 .fallocate = ext4_fallocate,
786 const struct inode_operations ext4_file_inode_operations = {
787 .setattr = ext4_setattr,
788 .getattr = ext4_getattr,
789 .listxattr = ext4_listxattr,
790 .get_acl = ext4_get_acl,
791 .set_acl = ext4_set_acl,
792 .fiemap = ext4_fiemap,