4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 2011, Lawrence Livermore National Security, LLC.
23 * Copyright (c) 2015 by Chunwei Chen. All rights reserved.
28 #include <linux/compat.h>
30 #include <sys/dmu_objset.h>
31 #include <sys/zfs_vfsops.h>
32 #include <sys/zfs_vnops.h>
33 #include <sys/zfs_znode.h>
38 zpl_open(struct inode
*ip
, struct file
*filp
)
42 fstrans_cookie_t cookie
;
44 error
= generic_file_open(ip
, filp
);
49 cookie
= spl_fstrans_mark();
50 error
= -zfs_open(ip
, filp
->f_mode
, filp
->f_flags
, cr
);
51 spl_fstrans_unmark(cookie
);
53 ASSERT3S(error
, <=, 0);
59 zpl_release(struct inode
*ip
, struct file
*filp
)
63 fstrans_cookie_t cookie
;
65 cookie
= spl_fstrans_mark();
66 if (ITOZ(ip
)->z_atime_dirty
)
67 zfs_mark_inode_dirty(ip
);
70 error
= -zfs_close(ip
, filp
->f_flags
, cr
);
71 spl_fstrans_unmark(cookie
);
73 ASSERT3S(error
, <=, 0);
79 zpl_iterate(struct file
*filp
, struct dir_context
*ctx
)
81 struct dentry
*dentry
= filp
->f_path
.dentry
;
84 fstrans_cookie_t cookie
;
87 cookie
= spl_fstrans_mark();
88 error
= -zfs_readdir(dentry
->d_inode
, ctx
, cr
);
89 spl_fstrans_unmark(cookie
);
91 ASSERT3S(error
, <=, 0);
96 #if !defined(HAVE_VFS_ITERATE)
98 zpl_readdir(struct file
*filp
, void *dirent
, filldir_t filldir
)
100 struct dir_context ctx
= DIR_CONTEXT_INIT(dirent
, filldir
, filp
->f_pos
);
103 error
= zpl_iterate(filp
, &ctx
);
104 filp
->f_pos
= ctx
.pos
;
108 #endif /* HAVE_VFS_ITERATE */
110 #if defined(HAVE_FSYNC_WITH_DENTRY)
112 * Linux 2.6.x - 2.6.34 API,
113 * Through 2.6.34 the nfsd kernel server would pass a NULL 'file struct *'
114 * to the fops->fsync() hook. For this reason, we must be careful not to
115 * use filp unconditionally.
118 zpl_fsync(struct file
*filp
, struct dentry
*dentry
, int datasync
)
122 fstrans_cookie_t cookie
;
125 cookie
= spl_fstrans_mark();
126 error
= -zfs_fsync(dentry
->d_inode
, datasync
, cr
);
127 spl_fstrans_unmark(cookie
);
129 ASSERT3S(error
, <=, 0);
135 zpl_aio_fsync(struct kiocb
*kiocb
, int datasync
)
137 struct file
*filp
= kiocb
->ki_filp
;
138 return (zpl_fsync(filp
, filp
->f_path
.dentry
, datasync
));
140 #elif defined(HAVE_FSYNC_WITHOUT_DENTRY)
142 * Linux 2.6.35 - 3.0 API,
143 * As of 2.6.35 the dentry argument to the fops->fsync() hook was deemed
144 * redundant. The dentry is still accessible via filp->f_path.dentry,
145 * and we are guaranteed that filp will never be NULL.
148 zpl_fsync(struct file
*filp
, int datasync
)
150 struct inode
*inode
= filp
->f_mapping
->host
;
153 fstrans_cookie_t cookie
;
156 cookie
= spl_fstrans_mark();
157 error
= -zfs_fsync(inode
, datasync
, cr
);
158 spl_fstrans_unmark(cookie
);
160 ASSERT3S(error
, <=, 0);
166 zpl_aio_fsync(struct kiocb
*kiocb
, int datasync
)
168 return (zpl_fsync(kiocb
->ki_filp
, datasync
));
170 #elif defined(HAVE_FSYNC_RANGE)
172 * Linux 3.1 - 3.x API,
173 * As of 3.1 the responsibility to call filemap_write_and_wait_range() has
174 * been pushed down in to the .fsync() vfs hook. Additionally, the i_mutex
175 * lock is no longer held by the caller, for zfs we don't require the lock
176 * to be held so we don't acquire it.
179 zpl_fsync(struct file
*filp
, loff_t start
, loff_t end
, int datasync
)
181 struct inode
*inode
= filp
->f_mapping
->host
;
184 fstrans_cookie_t cookie
;
186 error
= filemap_write_and_wait_range(inode
->i_mapping
, start
, end
);
191 cookie
= spl_fstrans_mark();
192 error
= -zfs_fsync(inode
, datasync
, cr
);
193 spl_fstrans_unmark(cookie
);
195 ASSERT3S(error
, <=, 0);
201 zpl_aio_fsync(struct kiocb
*kiocb
, int datasync
)
203 return (zpl_fsync(kiocb
->ki_filp
, kiocb
->ki_pos
, -1, datasync
));
206 #error "Unsupported fops->fsync() implementation"
210 zpl_read_common_iovec(struct inode
*ip
, const struct iovec
*iovp
, size_t count
,
211 unsigned long nr_segs
, loff_t
*ppos
, uio_seg_t segment
, int flags
,
212 cred_t
*cr
, size_t skip
)
217 fstrans_cookie_t cookie
;
221 uio
.uio_resid
= count
;
222 uio
.uio_iovcnt
= nr_segs
;
223 uio
.uio_loffset
= *ppos
;
224 uio
.uio_limit
= MAXOFFSET_T
;
225 uio
.uio_segflg
= segment
;
227 cookie
= spl_fstrans_mark();
228 error
= -zfs_read(ip
, &uio
, flags
, cr
);
229 spl_fstrans_unmark(cookie
);
233 read
= count
- uio
.uio_resid
;
235 task_io_account_read(read
);
241 zpl_read_common(struct inode
*ip
, const char *buf
, size_t len
, loff_t
*ppos
,
242 uio_seg_t segment
, int flags
, cred_t
*cr
)
246 iov
.iov_base
= (void *)buf
;
249 return (zpl_read_common_iovec(ip
, &iov
, len
, 1, ppos
, segment
,
254 zpl_read(struct file
*filp
, char __user
*buf
, size_t len
, loff_t
*ppos
)
260 read
= zpl_read_common(filp
->f_mapping
->host
, buf
, len
, ppos
,
261 UIO_USERSPACE
, filp
->f_flags
, cr
);
268 zpl_iter_read_common(struct kiocb
*kiocb
, const struct iovec
*iovp
,
269 unsigned long nr_segs
, size_t count
, uio_seg_t seg
, size_t skip
)
272 struct file
*filp
= kiocb
->ki_filp
;
276 read
= zpl_read_common_iovec(filp
->f_mapping
->host
, iovp
, count
,
277 nr_segs
, &kiocb
->ki_pos
, seg
, filp
->f_flags
, cr
, skip
);
283 #if defined(HAVE_VFS_RW_ITERATE)
285 zpl_iter_read(struct kiocb
*kiocb
, struct iov_iter
*to
)
288 uio_seg_t seg
= UIO_USERSPACE
;
289 if (to
->type
& ITER_KVEC
)
291 if (to
->type
& ITER_BVEC
)
293 ret
= zpl_iter_read_common(kiocb
, to
->iov
, to
->nr_segs
,
294 iov_iter_count(to
), seg
, to
->iov_offset
);
296 iov_iter_advance(to
, ret
);
301 zpl_aio_read(struct kiocb
*kiocb
, const struct iovec
*iovp
,
302 unsigned long nr_segs
, loff_t pos
)
304 return (zpl_iter_read_common(kiocb
, iovp
, nr_segs
, kiocb
->ki_nbytes
,
307 #endif /* HAVE_VFS_RW_ITERATE */
310 zpl_write_common_iovec(struct inode
*ip
, const struct iovec
*iovp
, size_t count
,
311 unsigned long nr_segs
, loff_t
*ppos
, uio_seg_t segment
, int flags
,
312 cred_t
*cr
, size_t skip
)
317 fstrans_cookie_t cookie
;
319 if (flags
& O_APPEND
)
320 *ppos
= i_size_read(ip
);
324 uio
.uio_resid
= count
;
325 uio
.uio_iovcnt
= nr_segs
;
326 uio
.uio_loffset
= *ppos
;
327 uio
.uio_limit
= MAXOFFSET_T
;
328 uio
.uio_segflg
= segment
;
330 cookie
= spl_fstrans_mark();
331 error
= -zfs_write(ip
, &uio
, flags
, cr
);
332 spl_fstrans_unmark(cookie
);
336 wrote
= count
- uio
.uio_resid
;
338 task_io_account_write(wrote
);
343 zpl_write_common(struct inode
*ip
, const char *buf
, size_t len
, loff_t
*ppos
,
344 uio_seg_t segment
, int flags
, cred_t
*cr
)
348 iov
.iov_base
= (void *)buf
;
351 return (zpl_write_common_iovec(ip
, &iov
, len
, 1, ppos
, segment
,
356 zpl_write(struct file
*filp
, const char __user
*buf
, size_t len
, loff_t
*ppos
)
362 wrote
= zpl_write_common(filp
->f_mapping
->host
, buf
, len
, ppos
,
363 UIO_USERSPACE
, filp
->f_flags
, cr
);
370 zpl_iter_write_common(struct kiocb
*kiocb
, const struct iovec
*iovp
,
371 unsigned long nr_segs
, size_t count
, uio_seg_t seg
, size_t skip
)
374 struct file
*filp
= kiocb
->ki_filp
;
378 wrote
= zpl_write_common_iovec(filp
->f_mapping
->host
, iovp
, count
,
379 nr_segs
, &kiocb
->ki_pos
, seg
, filp
->f_flags
, cr
, skip
);
385 #if defined(HAVE_VFS_RW_ITERATE)
387 zpl_iter_write(struct kiocb
*kiocb
, struct iov_iter
*from
)
390 uio_seg_t seg
= UIO_USERSPACE
;
391 if (from
->type
& ITER_KVEC
)
393 if (from
->type
& ITER_BVEC
)
395 ret
= zpl_iter_write_common(kiocb
, from
->iov
, from
->nr_segs
,
396 iov_iter_count(from
), seg
, from
->iov_offset
);
398 iov_iter_advance(from
, ret
);
403 zpl_aio_write(struct kiocb
*kiocb
, const struct iovec
*iovp
,
404 unsigned long nr_segs
, loff_t pos
)
406 return (zpl_iter_write_common(kiocb
, iovp
, nr_segs
, kiocb
->ki_nbytes
,
409 #endif /* HAVE_VFS_RW_ITERATE */
412 zpl_llseek(struct file
*filp
, loff_t offset
, int whence
)
414 #if defined(SEEK_HOLE) && defined(SEEK_DATA)
415 fstrans_cookie_t cookie
;
417 if (whence
== SEEK_DATA
|| whence
== SEEK_HOLE
) {
418 struct inode
*ip
= filp
->f_mapping
->host
;
419 loff_t maxbytes
= ip
->i_sb
->s_maxbytes
;
423 cookie
= spl_fstrans_mark();
424 error
= -zfs_holey(ip
, whence
, &offset
);
425 spl_fstrans_unmark(cookie
);
427 error
= lseek_execute(filp
, ip
, offset
, maxbytes
);
428 spl_inode_unlock(ip
);
432 #endif /* SEEK_HOLE && SEEK_DATA */
434 return (generic_file_llseek(filp
, offset
, whence
));
438 * It's worth taking a moment to describe how mmap is implemented
439 * for zfs because it differs considerably from other Linux filesystems.
440 * However, this issue is handled the same way under OpenSolaris.
442 * The issue is that by design zfs bypasses the Linux page cache and
443 * leaves all caching up to the ARC. This has been shown to work
444 * well for the common read(2)/write(2) case. However, mmap(2)
445 * is problem because it relies on being tightly integrated with the
446 * page cache. To handle this we cache mmap'ed files twice, once in
447 * the ARC and a second time in the page cache. The code is careful
448 * to keep both copies synchronized.
450 * When a file with an mmap'ed region is written to using write(2)
451 * both the data in the ARC and existing pages in the page cache
452 * are updated. For a read(2) data will be read first from the page
453 * cache then the ARC if needed. Neither a write(2) or read(2) will
454 * will ever result in new pages being added to the page cache.
456 * New pages are added to the page cache only via .readpage() which
457 * is called when the vfs needs to read a page off disk to back the
458 * virtual memory region. These pages may be modified without
459 * notifying the ARC and will be written out periodically via
460 * .writepage(). This will occur due to either a sync or the usual
461 * page aging behavior. Note because a read(2) of a mmap'ed file
462 * will always check the page cache first even when the ARC is out
463 * of date correct data will still be returned.
465 * While this implementation ensures correct behavior it does have
466 * have some drawbacks. The most obvious of which is that it
467 * increases the required memory footprint when access mmap'ed
468 * files. It also adds additional complexity to the code keeping
469 * both caches synchronized.
471 * Longer term it may be possible to cleanly resolve this wart by
472 * mapping page cache pages directly on to the ARC buffers. The
473 * Linux address space operations are flexible enough to allow
474 * selection of which pages back a particular index. The trick
475 * would be working out the details of which subsystem is in
476 * charge, the ARC, the page cache, or both. It may also prove
477 * helpful to move the ARC buffers to a scatter-gather lists
478 * rather than a vmalloc'ed region.
481 zpl_mmap(struct file
*filp
, struct vm_area_struct
*vma
)
483 struct inode
*ip
= filp
->f_mapping
->host
;
484 znode_t
*zp
= ITOZ(ip
);
486 fstrans_cookie_t cookie
;
488 cookie
= spl_fstrans_mark();
489 error
= -zfs_map(ip
, vma
->vm_pgoff
, (caddr_t
*)vma
->vm_start
,
490 (size_t)(vma
->vm_end
- vma
->vm_start
), vma
->vm_flags
);
491 spl_fstrans_unmark(cookie
);
495 error
= generic_file_mmap(filp
, vma
);
499 mutex_enter(&zp
->z_lock
);
501 mutex_exit(&zp
->z_lock
);
507 * Populate a page with data for the Linux page cache. This function is
508 * only used to support mmap(2). There will be an identical copy of the
509 * data in the ARC which is kept up to date via .write() and .writepage().
511 * Current this function relies on zpl_read_common() and the O_DIRECT
512 * flag to read in a page. This works but the more correct way is to
513 * update zfs_fillpage() to be Linux friendly and use that interface.
516 zpl_readpage(struct file
*filp
, struct page
*pp
)
521 fstrans_cookie_t cookie
;
523 ASSERT(PageLocked(pp
));
524 ip
= pp
->mapping
->host
;
527 cookie
= spl_fstrans_mark();
528 error
= -zfs_getpage(ip
, pl
, 1);
529 spl_fstrans_unmark(cookie
);
533 ClearPageUptodate(pp
);
537 flush_dcache_page(pp
);
545 * Populate a set of pages with data for the Linux page cache. This
546 * function will only be called for read ahead and never for demand
547 * paging. For simplicity, the code relies on read_cache_pages() to
548 * correctly lock each page for IO and call zpl_readpage().
551 zpl_readpages(struct file
*filp
, struct address_space
*mapping
,
552 struct list_head
*pages
, unsigned nr_pages
)
554 return (read_cache_pages(mapping
, pages
,
555 (filler_t
*)zpl_readpage
, filp
));
559 zpl_putpage(struct page
*pp
, struct writeback_control
*wbc
, void *data
)
561 struct address_space
*mapping
= data
;
562 fstrans_cookie_t cookie
;
564 ASSERT(PageLocked(pp
));
565 ASSERT(!PageWriteback(pp
));
567 cookie
= spl_fstrans_mark();
568 (void) zfs_putpage(mapping
->host
, pp
, wbc
);
569 spl_fstrans_unmark(cookie
);
575 zpl_writepages(struct address_space
*mapping
, struct writeback_control
*wbc
)
577 znode_t
*zp
= ITOZ(mapping
->host
);
578 zfs_sb_t
*zsb
= ITOZSB(mapping
->host
);
579 enum writeback_sync_modes sync_mode
;
583 if (zsb
->z_os
->os_sync
== ZFS_SYNC_ALWAYS
)
584 wbc
->sync_mode
= WB_SYNC_ALL
;
586 sync_mode
= wbc
->sync_mode
;
589 * We don't want to run write_cache_pages() in SYNC mode here, because
590 * that would make putpage() wait for a single page to be committed to
591 * disk every single time, resulting in atrocious performance. Instead
592 * we run it once in non-SYNC mode so that the ZIL gets all the data,
593 * and then we commit it all in one go.
595 wbc
->sync_mode
= WB_SYNC_NONE
;
596 result
= write_cache_pages(mapping
, wbc
, zpl_putpage
, mapping
);
597 if (sync_mode
!= wbc
->sync_mode
) {
600 if (zsb
->z_log
!= NULL
)
601 zil_commit(zsb
->z_log
, zp
->z_id
);
605 * We need to call write_cache_pages() again (we can't just
606 * return after the commit) because the previous call in
607 * non-SYNC mode does not guarantee that we got all the dirty
608 * pages (see the implementation of write_cache_pages() for
609 * details). That being said, this is a no-op in most cases.
611 wbc
->sync_mode
= sync_mode
;
612 result
= write_cache_pages(mapping
, wbc
, zpl_putpage
, mapping
);
618 * Write out dirty pages to the ARC, this function is only required to
619 * support mmap(2). Mapped pages may be dirtied by memory operations
620 * which never call .write(). These dirty pages are kept in sync with
621 * the ARC buffers via this hook.
624 zpl_writepage(struct page
*pp
, struct writeback_control
*wbc
)
626 if (ITOZSB(pp
->mapping
->host
)->z_os
->os_sync
== ZFS_SYNC_ALWAYS
)
627 wbc
->sync_mode
= WB_SYNC_ALL
;
629 return (zpl_putpage(pp
, wbc
, pp
->mapping
));
633 * The only flag combination which matches the behavior of zfs_space()
634 * is FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE. The FALLOC_FL_PUNCH_HOLE
635 * flag was introduced in the 2.6.38 kernel.
637 #if defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE)
639 zpl_fallocate_common(struct inode
*ip
, int mode
, loff_t offset
, loff_t len
)
641 int error
= -EOPNOTSUPP
;
643 #if defined(FALLOC_FL_PUNCH_HOLE) && defined(FALLOC_FL_KEEP_SIZE)
647 fstrans_cookie_t cookie
;
649 if (mode
!= (FALLOC_FL_KEEP_SIZE
| FALLOC_FL_PUNCH_HOLE
))
654 if (offset
< 0 || len
<= 0)
658 olen
= i_size_read(ip
);
661 spl_inode_unlock(ip
);
664 if (offset
+ len
> olen
)
672 cookie
= spl_fstrans_mark();
673 error
= -zfs_space(ip
, F_FREESP
, &bf
, FWRITE
, offset
, cr
);
674 spl_fstrans_unmark(cookie
);
675 spl_inode_unlock(ip
);
678 #endif /* defined(FALLOC_FL_PUNCH_HOLE) && defined(FALLOC_FL_KEEP_SIZE) */
680 ASSERT3S(error
, <=, 0);
683 #endif /* defined(HAVE_FILE_FALLOCATE) || defined(HAVE_INODE_FALLOCATE) */
685 #ifdef HAVE_FILE_FALLOCATE
687 zpl_fallocate(struct file
*filp
, int mode
, loff_t offset
, loff_t len
)
689 return zpl_fallocate_common(filp
->f_path
.dentry
->d_inode
,
692 #endif /* HAVE_FILE_FALLOCATE */
695 * Map zfs file z_pflags (xvattr_t) to linux file attributes. Only file
696 * attributes common to both Linux and Solaris are mapped.
699 zpl_ioctl_getflags(struct file
*filp
, void __user
*arg
)
701 struct inode
*ip
= file_inode(filp
);
702 unsigned int ioctl_flags
= 0;
703 uint64_t zfs_flags
= ITOZ(ip
)->z_pflags
;
706 if (zfs_flags
& ZFS_IMMUTABLE
)
707 ioctl_flags
|= FS_IMMUTABLE_FL
;
709 if (zfs_flags
& ZFS_APPENDONLY
)
710 ioctl_flags
|= FS_APPEND_FL
;
712 if (zfs_flags
& ZFS_NODUMP
)
713 ioctl_flags
|= FS_NODUMP_FL
;
715 ioctl_flags
&= FS_FL_USER_VISIBLE
;
717 error
= copy_to_user(arg
, &ioctl_flags
, sizeof (ioctl_flags
));
723 * fchange() is a helper macro to detect if we have been asked to change a
724 * flag. This is ugly, but the requirement that we do this is a consequence of
725 * how the Linux file attribute interface was designed. Another consequence is
726 * that concurrent modification of files suffers from a TOCTOU race. Neither
727 * are things we can fix without modifying the kernel-userland interface, which
728 * is outside of our jurisdiction.
731 #define fchange(f0, f1, b0, b1) ((((f0) & (b0)) == (b0)) != \
732 (((b1) & (f1)) == (f1)))
735 zpl_ioctl_setflags(struct file
*filp
, void __user
*arg
)
737 struct inode
*ip
= file_inode(filp
);
738 uint64_t zfs_flags
= ITOZ(ip
)->z_pflags
;
739 unsigned int ioctl_flags
;
744 fstrans_cookie_t cookie
;
746 if (copy_from_user(&ioctl_flags
, arg
, sizeof (ioctl_flags
)))
749 if ((ioctl_flags
& ~(FS_IMMUTABLE_FL
| FS_APPEND_FL
| FS_NODUMP_FL
)))
750 return (-EOPNOTSUPP
);
752 if ((ioctl_flags
& ~(FS_FL_USER_MODIFIABLE
)))
755 if ((fchange(ioctl_flags
, zfs_flags
, FS_IMMUTABLE_FL
, ZFS_IMMUTABLE
) ||
756 fchange(ioctl_flags
, zfs_flags
, FS_APPEND_FL
, ZFS_APPENDONLY
)) &&
757 !capable(CAP_LINUX_IMMUTABLE
))
760 if (!zpl_inode_owner_or_capable(ip
))
764 xoap
= xva_getxoptattr(&xva
);
766 XVA_SET_REQ(&xva
, XAT_IMMUTABLE
);
767 if (ioctl_flags
& FS_IMMUTABLE_FL
)
768 xoap
->xoa_immutable
= B_TRUE
;
770 XVA_SET_REQ(&xva
, XAT_APPENDONLY
);
771 if (ioctl_flags
& FS_APPEND_FL
)
772 xoap
->xoa_appendonly
= B_TRUE
;
774 XVA_SET_REQ(&xva
, XAT_NODUMP
);
775 if (ioctl_flags
& FS_NODUMP_FL
)
776 xoap
->xoa_nodump
= B_TRUE
;
779 cookie
= spl_fstrans_mark();
780 error
= -zfs_setattr(ip
, (vattr_t
*)&xva
, 0, cr
);
781 spl_fstrans_unmark(cookie
);
788 zpl_ioctl(struct file
*filp
, unsigned int cmd
, unsigned long arg
)
791 case FS_IOC_GETFLAGS
:
792 return (zpl_ioctl_getflags(filp
, (void *)arg
));
793 case FS_IOC_SETFLAGS
:
794 return (zpl_ioctl_setflags(filp
, (void *)arg
));
802 zpl_compat_ioctl(struct file
*filp
, unsigned int cmd
, unsigned long arg
)
805 case FS_IOC32_GETFLAGS
:
806 cmd
= FS_IOC_GETFLAGS
;
808 case FS_IOC32_SETFLAGS
:
809 cmd
= FS_IOC_SETFLAGS
;
814 return (zpl_ioctl(filp
, cmd
, (unsigned long)compat_ptr(arg
)));
816 #endif /* CONFIG_COMPAT */
819 const struct address_space_operations zpl_address_space_operations
= {
820 .readpages
= zpl_readpages
,
821 .readpage
= zpl_readpage
,
822 .writepage
= zpl_writepage
,
823 .writepages
= zpl_writepages
,
826 const struct file_operations zpl_file_operations
= {
828 .release
= zpl_release
,
829 .llseek
= zpl_llseek
,
832 #ifdef HAVE_VFS_RW_ITERATE
833 .read_iter
= zpl_iter_read
,
834 .write_iter
= zpl_iter_write
,
836 .aio_read
= zpl_aio_read
,
837 .aio_write
= zpl_aio_write
,
841 .aio_fsync
= zpl_aio_fsync
,
842 #ifdef HAVE_FILE_FALLOCATE
843 .fallocate
= zpl_fallocate
,
844 #endif /* HAVE_FILE_FALLOCATE */
845 .unlocked_ioctl
= zpl_ioctl
,
847 .compat_ioctl
= zpl_compat_ioctl
,
851 const struct file_operations zpl_dir_file_operations
= {
852 .llseek
= generic_file_llseek
,
853 .read
= generic_read_dir
,
854 #ifdef HAVE_VFS_ITERATE
855 .iterate
= zpl_iterate
,
857 .readdir
= zpl_readdir
,
860 .unlocked_ioctl
= zpl_ioctl
,
862 .compat_ioctl
= zpl_compat_ioctl
,