[XFS] Fix a comment typo, originally noticed by Ming Zhang.
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / fs / xfs / linux-2.6 / xfs_file.c
CommitLineData
1da177e4 1/*
7b718769
NS
2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
1da177e4 4 *
7b718769
NS
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
1da177e4
LT
7 * published by the Free Software Foundation.
8 *
7b718769
NS
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
1da177e4 13 *
7b718769
NS
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1da177e4 17 */
1da177e4 18#include "xfs.h"
a844f451 19#include "xfs_bit.h"
1da177e4 20#include "xfs_log.h"
a844f451 21#include "xfs_inum.h"
1da177e4 22#include "xfs_sb.h"
a844f451 23#include "xfs_ag.h"
1da177e4
LT
24#include "xfs_dir.h"
25#include "xfs_dir2.h"
26#include "xfs_trans.h"
27#include "xfs_dmapi.h"
28#include "xfs_mount.h"
29#include "xfs_bmap_btree.h"
30#include "xfs_alloc_btree.h"
31#include "xfs_ialloc_btree.h"
32#include "xfs_alloc.h"
33#include "xfs_btree.h"
34#include "xfs_attr_sf.h"
35#include "xfs_dir_sf.h"
36#include "xfs_dir2_sf.h"
37#include "xfs_dinode.h"
38#include "xfs_inode.h"
39#include "xfs_error.h"
40#include "xfs_rw.h"
41#include "xfs_ioctl32.h"
42
43#include <linux/dcache.h>
44#include <linux/smp_lock.h>
45
3562fd45 46static struct vm_operations_struct xfs_file_vm_ops;
6fac0cb4 47#ifdef CONFIG_XFS_DMAPI
3562fd45 48static struct vm_operations_struct xfs_dmapi_file_vm_ops;
6fac0cb4 49#endif
1da177e4
LT
50
51STATIC inline ssize_t
3562fd45 52__xfs_file_read(
1da177e4
LT
53 struct kiocb *iocb,
54 char __user *buf,
55 int ioflags,
56 size_t count,
57 loff_t pos)
58{
59 struct iovec iov = {buf, count};
60 struct file *file = iocb->ki_filp;
ec86dc02 61 vnode_t *vp = vn_from_inode(file->f_dentry->d_inode);
1da177e4
LT
62 ssize_t rval;
63
64 BUG_ON(iocb->ki_pos != pos);
65
66 if (unlikely(file->f_flags & O_DIRECT))
67 ioflags |= IO_ISDIRECT;
68 VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
69 return rval;
70}
71
1da177e4 72STATIC ssize_t
3562fd45 73xfs_file_aio_read(
1da177e4
LT
74 struct kiocb *iocb,
75 char __user *buf,
76 size_t count,
77 loff_t pos)
78{
3562fd45 79 return __xfs_file_read(iocb, buf, IO_ISAIO, count, pos);
1da177e4
LT
80}
81
82STATIC ssize_t
3562fd45 83xfs_file_aio_read_invis(
1da177e4
LT
84 struct kiocb *iocb,
85 char __user *buf,
86 size_t count,
87 loff_t pos)
88{
3562fd45 89 return __xfs_file_read(iocb, buf, IO_ISAIO|IO_INVIS, count, pos);
1da177e4
LT
90}
91
1da177e4 92STATIC inline ssize_t
3562fd45 93__xfs_file_write(
1da177e4
LT
94 struct kiocb *iocb,
95 const char __user *buf,
96 int ioflags,
97 size_t count,
98 loff_t pos)
99{
100 struct iovec iov = {(void __user *)buf, count};
101 struct file *file = iocb->ki_filp;
102 struct inode *inode = file->f_mapping->host;
ec86dc02 103 vnode_t *vp = vn_from_inode(inode);
1da177e4
LT
104 ssize_t rval;
105
106 BUG_ON(iocb->ki_pos != pos);
107 if (unlikely(file->f_flags & O_DIRECT))
108 ioflags |= IO_ISDIRECT;
109
110 VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval);
111 return rval;
112}
113
1da177e4 114STATIC ssize_t
3562fd45 115xfs_file_aio_write(
1da177e4
LT
116 struct kiocb *iocb,
117 const char __user *buf,
118 size_t count,
119 loff_t pos)
120{
3562fd45 121 return __xfs_file_write(iocb, buf, IO_ISAIO, count, pos);
1da177e4
LT
122}
123
124STATIC ssize_t
3562fd45 125xfs_file_aio_write_invis(
1da177e4
LT
126 struct kiocb *iocb,
127 const char __user *buf,
128 size_t count,
129 loff_t pos)
130{
3562fd45 131 return __xfs_file_write(iocb, buf, IO_ISAIO|IO_INVIS, count, pos);
1da177e4
LT
132}
133
1da177e4 134STATIC inline ssize_t
3562fd45 135__xfs_file_readv(
1da177e4
LT
136 struct file *file,
137 const struct iovec *iov,
138 int ioflags,
139 unsigned long nr_segs,
140 loff_t *ppos)
141{
142 struct inode *inode = file->f_mapping->host;
ec86dc02 143 vnode_t *vp = vn_from_inode(inode);
524fbf5d 144 struct kiocb kiocb;
1da177e4
LT
145 ssize_t rval;
146
524fbf5d
NS
147 init_sync_kiocb(&kiocb, file);
148 kiocb.ki_pos = *ppos;
1da177e4
LT
149
150 if (unlikely(file->f_flags & O_DIRECT))
151 ioflags |= IO_ISDIRECT;
524fbf5d 152 VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
1da177e4 153
524fbf5d 154 *ppos = kiocb.ki_pos;
1da177e4
LT
155 return rval;
156}
157
158STATIC ssize_t
3562fd45 159xfs_file_readv(
1da177e4
LT
160 struct file *file,
161 const struct iovec *iov,
162 unsigned long nr_segs,
163 loff_t *ppos)
164{
3562fd45 165 return __xfs_file_readv(file, iov, 0, nr_segs, ppos);
1da177e4
LT
166}
167
168STATIC ssize_t
3562fd45 169xfs_file_readv_invis(
1da177e4
LT
170 struct file *file,
171 const struct iovec *iov,
172 unsigned long nr_segs,
173 loff_t *ppos)
174{
3562fd45 175 return __xfs_file_readv(file, iov, IO_INVIS, nr_segs, ppos);
1da177e4
LT
176}
177
1da177e4 178STATIC inline ssize_t
3562fd45 179__xfs_file_writev(
1da177e4
LT
180 struct file *file,
181 const struct iovec *iov,
182 int ioflags,
183 unsigned long nr_segs,
184 loff_t *ppos)
185{
186 struct inode *inode = file->f_mapping->host;
ec86dc02 187 vnode_t *vp = vn_from_inode(inode);
524fbf5d 188 struct kiocb kiocb;
1da177e4
LT
189 ssize_t rval;
190
524fbf5d
NS
191 init_sync_kiocb(&kiocb, file);
192 kiocb.ki_pos = *ppos;
1da177e4
LT
193 if (unlikely(file->f_flags & O_DIRECT))
194 ioflags |= IO_ISDIRECT;
195
524fbf5d 196 VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
1da177e4 197
524fbf5d 198 *ppos = kiocb.ki_pos;
1da177e4
LT
199 return rval;
200}
201
1da177e4 202STATIC ssize_t
3562fd45 203xfs_file_writev(
1da177e4
LT
204 struct file *file,
205 const struct iovec *iov,
206 unsigned long nr_segs,
207 loff_t *ppos)
208{
3562fd45 209 return __xfs_file_writev(file, iov, 0, nr_segs, ppos);
1da177e4
LT
210}
211
212STATIC ssize_t
3562fd45 213xfs_file_writev_invis(
1da177e4
LT
214 struct file *file,
215 const struct iovec *iov,
216 unsigned long nr_segs,
217 loff_t *ppos)
218{
3562fd45 219 return __xfs_file_writev(file, iov, IO_INVIS, nr_segs, ppos);
1da177e4
LT
220}
221
222STATIC ssize_t
3562fd45 223xfs_file_sendfile(
1da177e4 224 struct file *filp,
1b895840 225 loff_t *pos,
1da177e4
LT
226 size_t count,
227 read_actor_t actor,
228 void *target)
229{
ec86dc02 230 vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
1da177e4
LT
231 ssize_t rval;
232
1b895840 233 VOP_SENDFILE(vp, filp, pos, 0, count, actor, target, NULL, rval);
1da177e4
LT
234 return rval;
235}
236
1b895840
NS
237STATIC ssize_t
238xfs_file_sendfile_invis(
239 struct file *filp,
240 loff_t *pos,
241 size_t count,
242 read_actor_t actor,
243 void *target)
244{
245 vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
246 ssize_t rval;
247
248 VOP_SENDFILE(vp, filp, pos, IO_INVIS, count, actor, target, NULL, rval);
249 return rval;
250}
251
252STATIC ssize_t
253xfs_file_splice_read(
254 struct file *infilp,
cbb7e577 255 loff_t *ppos,
3a326a2c 256 struct pipe_inode_info *pipe,
1b895840
NS
257 size_t len,
258 unsigned int flags)
259{
260 vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
261 ssize_t rval;
262
cbb7e577 263 VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, 0, NULL, rval);
1b895840
NS
264 return rval;
265}
266
267STATIC ssize_t
268xfs_file_splice_read_invis(
269 struct file *infilp,
cbb7e577 270 loff_t *ppos,
3a326a2c 271 struct pipe_inode_info *pipe,
1b895840
NS
272 size_t len,
273 unsigned int flags)
274{
275 vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode);
276 ssize_t rval;
277
cbb7e577 278 VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, IO_INVIS, NULL, rval);
1b895840
NS
279 return rval;
280}
281
282STATIC ssize_t
283xfs_file_splice_write(
3a326a2c 284 struct pipe_inode_info *pipe,
1b895840 285 struct file *outfilp,
cbb7e577 286 loff_t *ppos,
1b895840
NS
287 size_t len,
288 unsigned int flags)
289{
290 vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
291 ssize_t rval;
292
cbb7e577 293 VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, 0, NULL, rval);
1b895840
NS
294 return rval;
295}
296
297STATIC ssize_t
298xfs_file_splice_write_invis(
3a326a2c 299 struct pipe_inode_info *pipe,
1b895840 300 struct file *outfilp,
cbb7e577 301 loff_t *ppos,
1b895840
NS
302 size_t len,
303 unsigned int flags)
304{
305 vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode);
306 ssize_t rval;
307
cbb7e577 308 VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, IO_INVIS, NULL, rval);
1b895840
NS
309 return rval;
310}
1da177e4
LT
311
312STATIC int
3562fd45 313xfs_file_open(
1da177e4
LT
314 struct inode *inode,
315 struct file *filp)
316{
ec86dc02 317 vnode_t *vp = vn_from_inode(inode);
1da177e4
LT
318 int error;
319
320 if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS)
321 return -EFBIG;
1da177e4
LT
322 VOP_OPEN(vp, NULL, error);
323 return -error;
324}
325
1da177e4 326STATIC int
3562fd45 327xfs_file_release(
1da177e4
LT
328 struct inode *inode,
329 struct file *filp)
330{
ec86dc02 331 vnode_t *vp = vn_from_inode(inode);
1da177e4
LT
332 int error = 0;
333
334 if (vp)
335 VOP_RELEASE(vp, error);
336 return -error;
337}
338
1da177e4 339STATIC int
3562fd45 340xfs_file_fsync(
1da177e4
LT
341 struct file *filp,
342 struct dentry *dentry,
343 int datasync)
344{
345 struct inode *inode = dentry->d_inode;
ec86dc02 346 vnode_t *vp = vn_from_inode(inode);
1da177e4
LT
347 int error;
348 int flags = FSYNC_WAIT;
349
350 if (datasync)
351 flags |= FSYNC_DATA;
1da177e4
LT
352 VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error);
353 return -error;
354}
355
bb3f724e 356#ifdef CONFIG_XFS_DMAPI
bb3f724e 357STATIC struct page *
3562fd45 358xfs_vm_nopage(
bb3f724e
DR
359 struct vm_area_struct *area,
360 unsigned long address,
361 int *type)
362{
363 struct inode *inode = area->vm_file->f_dentry->d_inode;
ec86dc02 364 vnode_t *vp = vn_from_inode(inode);
bb3f724e
DR
365 xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
366 int error;
367
368 ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI);
369
370 error = XFS_SEND_MMAP(mp, area, 0);
371 if (error)
372 return NULL;
373
374 return filemap_nopage(area, address, type);
375}
bb3f724e
DR
376#endif /* CONFIG_XFS_DMAPI */
377
1da177e4 378STATIC int
3562fd45 379xfs_file_readdir(
1da177e4
LT
380 struct file *filp,
381 void *dirent,
382 filldir_t filldir)
383{
384 int error = 0;
1b895840 385 vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
1da177e4
LT
386 uio_t uio;
387 iovec_t iov;
388 int eof = 0;
389 caddr_t read_buf;
390 int namelen, size = 0;
391 size_t rlen = PAGE_CACHE_SIZE;
392 xfs_off_t start_offset, curr_offset;
393 xfs_dirent_t *dbp = NULL;
394
1da177e4
LT
395 /* Try fairly hard to get memory */
396 do {
397 if ((read_buf = (caddr_t)kmalloc(rlen, GFP_KERNEL)))
398 break;
399 rlen >>= 1;
400 } while (rlen >= 1024);
401
402 if (read_buf == NULL)
403 return -ENOMEM;
404
405 uio.uio_iov = &iov;
406 uio.uio_segflg = UIO_SYSSPACE;
407 curr_offset = filp->f_pos;
408 if (filp->f_pos != 0x7fffffff)
409 uio.uio_offset = filp->f_pos;
410 else
411 uio.uio_offset = 0xffffffff;
412
413 while (!eof) {
414 uio.uio_resid = iov.iov_len = rlen;
415 iov.iov_base = read_buf;
416 uio.uio_iovcnt = 1;
417
418 start_offset = uio.uio_offset;
419
420 VOP_READDIR(vp, &uio, NULL, &eof, error);
421 if ((uio.uio_offset == start_offset) || error) {
422 size = 0;
423 break;
424 }
425
426 size = rlen - uio.uio_resid;
427 dbp = (xfs_dirent_t *)read_buf;
428 while (size > 0) {
429 namelen = strlen(dbp->d_name);
430
431 if (filldir(dirent, dbp->d_name, namelen,
432 (loff_t) curr_offset & 0x7fffffff,
433 (ino_t) dbp->d_ino,
434 DT_UNKNOWN)) {
435 goto done;
436 }
437 size -= dbp->d_reclen;
438 curr_offset = (loff_t)dbp->d_off /* & 0x7fffffff */;
1b895840 439 dbp = (xfs_dirent_t *)((char *)dbp + dbp->d_reclen);
1da177e4
LT
440 }
441 }
442done:
443 if (!error) {
444 if (size == 0)
445 filp->f_pos = uio.uio_offset & 0x7fffffff;
446 else if (dbp)
447 filp->f_pos = curr_offset;
448 }
449
450 kfree(read_buf);
451 return -error;
452}
453
1da177e4 454STATIC int
3562fd45 455xfs_file_mmap(
1da177e4
LT
456 struct file *filp,
457 struct vm_area_struct *vma)
458{
459 struct inode *ip = filp->f_dentry->d_inode;
ec86dc02 460 vnode_t *vp = vn_from_inode(ip);
524fbf5d 461 vattr_t vattr;
1da177e4
LT
462 int error;
463
3562fd45 464 vma->vm_ops = &xfs_file_vm_ops;
6fac0cb4 465
6fac0cb4 466#ifdef CONFIG_XFS_DMAPI
bb3f724e 467 if (vp->v_vfsp->vfs_flag & VFS_DMI) {
3562fd45 468 vma->vm_ops = &xfs_dmapi_file_vm_ops;
1da177e4 469 }
bb3f724e 470#endif /* CONFIG_XFS_DMAPI */
1da177e4 471
524fbf5d
NS
472 vattr.va_mask = XFS_AT_UPDATIME;
473 VOP_SETATTR(vp, &vattr, XFS_AT_UPDATIME, NULL, error);
220b5284 474 if (likely(!error))
524fbf5d 475 __vn_revalidate(vp, &vattr); /* update flags */
1da177e4
LT
476 return 0;
477}
478
479
480STATIC long
3562fd45 481xfs_file_ioctl(
1da177e4
LT
482 struct file *filp,
483 unsigned int cmd,
484 unsigned long arg)
485{
486 int error;
1f6553f9 487 struct inode *inode = filp->f_dentry->d_inode;
ec86dc02 488 vnode_t *vp = vn_from_inode(inode);
1da177e4
LT
489
490 VOP_IOCTL(vp, inode, filp, 0, cmd, (void __user *)arg, error);
491 VMODIFY(vp);
492
493 /* NOTE: some of the ioctl's return positive #'s as a
494 * byte count indicating success, such as
495 * readlink_by_handle. So we don't "sign flip"
496 * like most other routines. This means true
497 * errors need to be returned as a negative value.
498 */
499 return error;
500}
501
502STATIC long
3562fd45 503xfs_file_ioctl_invis(
1da177e4
LT
504 struct file *filp,
505 unsigned int cmd,
506 unsigned long arg)
507{
1f6553f9 508 struct inode *inode = filp->f_dentry->d_inode;
ec86dc02 509 vnode_t *vp = vn_from_inode(inode);
1b895840 510 int error;
1da177e4 511
1da177e4
LT
512 VOP_IOCTL(vp, inode, filp, IO_INVIS, cmd, (void __user *)arg, error);
513 VMODIFY(vp);
514
515 /* NOTE: some of the ioctl's return positive #'s as a
516 * byte count indicating success, such as
517 * readlink_by_handle. So we don't "sign flip"
518 * like most other routines. This means true
519 * errors need to be returned as a negative value.
520 */
521 return error;
522}
523
bb3f724e 524#ifdef CONFIG_XFS_DMAPI
1da177e4
LT
525#ifdef HAVE_VMOP_MPROTECT
526STATIC int
3562fd45 527xfs_vm_mprotect(
1da177e4
LT
528 struct vm_area_struct *vma,
529 unsigned int newflags)
530{
ec86dc02 531 vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode);
1da177e4
LT
532 int error = 0;
533
534 if (vp->v_vfsp->vfs_flag & VFS_DMI) {
535 if ((vma->vm_flags & VM_MAYSHARE) &&
536 (newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE)) {
537 xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
538
539 error = XFS_SEND_MMAP(mp, vma, VM_WRITE);
540 }
541 }
542 return error;
543}
544#endif /* HAVE_VMOP_MPROTECT */
bb3f724e 545#endif /* CONFIG_XFS_DMAPI */
1da177e4
LT
546
547#ifdef HAVE_FOP_OPEN_EXEC
548/* If the user is attempting to execute a file that is offline then
549 * we have to trigger a DMAPI READ event before the file is marked as busy
550 * otherwise the invisible I/O will not be able to write to the file to bring
551 * it back online.
552 */
553STATIC int
3562fd45 554xfs_file_open_exec(
1da177e4
LT
555 struct inode *inode)
556{
ec86dc02 557 vnode_t *vp = vn_from_inode(inode);
1da177e4
LT
558 xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp);
559 int error = 0;
1da177e4
LT
560 xfs_inode_t *ip;
561
562 if (vp->v_vfsp->vfs_flag & VFS_DMI) {
75e17b3c
CH
563 ip = xfs_vtoi(vp);
564 if (!ip) {
1da177e4
LT
565 error = -EINVAL;
566 goto open_exec_out;
567 }
1da177e4
LT
568 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)) {
569 error = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp,
570 0, 0, 0, NULL);
571 }
572 }
573open_exec_out:
574 return error;
575}
576#endif /* HAVE_FOP_OPEN_EXEC */
577
4b6f5d20 578const struct file_operations xfs_file_operations = {
1da177e4
LT
579 .llseek = generic_file_llseek,
580 .read = do_sync_read,
bb3f724e 581 .write = do_sync_write,
3562fd45
NS
582 .readv = xfs_file_readv,
583 .writev = xfs_file_writev,
584 .aio_read = xfs_file_aio_read,
585 .aio_write = xfs_file_aio_write,
586 .sendfile = xfs_file_sendfile,
1b895840
NS
587 .splice_read = xfs_file_splice_read,
588 .splice_write = xfs_file_splice_write,
3562fd45 589 .unlocked_ioctl = xfs_file_ioctl,
1da177e4 590#ifdef CONFIG_COMPAT
3562fd45 591 .compat_ioctl = xfs_file_compat_ioctl,
1da177e4 592#endif
3562fd45
NS
593 .mmap = xfs_file_mmap,
594 .open = xfs_file_open,
595 .release = xfs_file_release,
596 .fsync = xfs_file_fsync,
1da177e4 597#ifdef HAVE_FOP_OPEN_EXEC
3562fd45 598 .open_exec = xfs_file_open_exec,
1da177e4
LT
599#endif
600};
601
4b6f5d20 602const struct file_operations xfs_invis_file_operations = {
1da177e4
LT
603 .llseek = generic_file_llseek,
604 .read = do_sync_read,
bb3f724e 605 .write = do_sync_write,
3562fd45
NS
606 .readv = xfs_file_readv_invis,
607 .writev = xfs_file_writev_invis,
608 .aio_read = xfs_file_aio_read_invis,
609 .aio_write = xfs_file_aio_write_invis,
1b895840
NS
610 .sendfile = xfs_file_sendfile_invis,
611 .splice_read = xfs_file_splice_read_invis,
612 .splice_write = xfs_file_splice_write_invis,
3562fd45 613 .unlocked_ioctl = xfs_file_ioctl_invis,
1da177e4 614#ifdef CONFIG_COMPAT
3562fd45 615 .compat_ioctl = xfs_file_compat_invis_ioctl,
1da177e4 616#endif
3562fd45
NS
617 .mmap = xfs_file_mmap,
618 .open = xfs_file_open,
619 .release = xfs_file_release,
620 .fsync = xfs_file_fsync,
1da177e4
LT
621};
622
623
4b6f5d20 624const struct file_operations xfs_dir_file_operations = {
1da177e4 625 .read = generic_read_dir,
3562fd45
NS
626 .readdir = xfs_file_readdir,
627 .unlocked_ioctl = xfs_file_ioctl,
d3870398 628#ifdef CONFIG_COMPAT
3562fd45 629 .compat_ioctl = xfs_file_compat_ioctl,
d3870398 630#endif
3562fd45 631 .fsync = xfs_file_fsync,
1da177e4
LT
632};
633
3562fd45 634static struct vm_operations_struct xfs_file_vm_ops = {
1da177e4
LT
635 .nopage = filemap_nopage,
636 .populate = filemap_populate,
6fac0cb4
DR
637};
638
639#ifdef CONFIG_XFS_DMAPI
3562fd45
NS
640static struct vm_operations_struct xfs_dmapi_file_vm_ops = {
641 .nopage = xfs_vm_nopage,
6fac0cb4 642 .populate = filemap_populate,
1da177e4 643#ifdef HAVE_VMOP_MPROTECT
3562fd45 644 .mprotect = xfs_vm_mprotect,
1da177e4
LT
645#endif
646};
6fac0cb4 647#endif /* CONFIG_XFS_DMAPI */