diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-21 21:10:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-21 21:10:19 -0400 |
commit | 52ab3f3dc711eeccbfbcc5d4f5c5d9b9ff59650f (patch) | |
tree | f6fa8468885835152f131e3abc094da369d15669 /fs/xfs/linux-2.6/xfs_file.c | |
parent | 43104f1da88f5335e9a45695df92a735ad550dda (diff) | |
parent | 98174e46974323e4941c72e46345f7277755e146 (diff) |
Merge git://oss.sgi.com:8090/xfs-2.6
* git://oss.sgi.com:8090/xfs-2.6: (43 commits)
[XFS] Remove files from the build that are now unused.
[XFS] Fix a Makefile issue related to exports.o handling.
[XFS] Remove version 1 directory code. Never functioned on Linux, just
[XFS] Map EFSCORRUPTED to an actual error code, not just a made up one
[XFS] Kill direct access to ->count in valusema(); all we ever use it for
[XFS] Remove unneeded conditional code on NFS export interface related
[XFS] Remove an incorrect use of unlikely() on a relatively likely code
[XFS] Push some common code out of write path into core XFS code for
[XFS] Remove unnecessary local from open_exec dmapi path.
[XFS] Minor XFS documentation updates.
[XFS] Fix broken const use inside local suffix_strtoul routine.
[XFS] Fix nused counter. It's currently getting set to -1 rather than
[XFS] Fix mismerge of the fs_writable cleanup patch causing a freeze/thaw
[XFS] Fix up debug code so that bulkstat wont generate thousands of
[XFS] Remove unused parameter from di2xflags routine.
[XFS] Cleanup a missed porting conversion, and freezing.
[XFS] Resolve a namespace collision on remaining vtypes for FreeBSD
[XFS] Resolve a namespace collision on vnode/vnodeops for FreeBSD porters.
[XFS] Resolve a namespace collision on vfs/vfsops for FreeBSD porters.
[XFS] statvfs component of directory/project quota support, code
...
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_file.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_file.c | 170 |
1 files changed, 66 insertions, 104 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index c847416f6d10..70662371bb11 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include "xfs_inum.h" | 21 | #include "xfs_inum.h" |
22 | #include "xfs_sb.h" | 22 | #include "xfs_sb.h" |
23 | #include "xfs_ag.h" | 23 | #include "xfs_ag.h" |
24 | #include "xfs_dir.h" | ||
25 | #include "xfs_dir2.h" | 24 | #include "xfs_dir2.h" |
26 | #include "xfs_trans.h" | 25 | #include "xfs_trans.h" |
27 | #include "xfs_dmapi.h" | 26 | #include "xfs_dmapi.h" |
@@ -32,7 +31,6 @@ | |||
32 | #include "xfs_alloc.h" | 31 | #include "xfs_alloc.h" |
33 | #include "xfs_btree.h" | 32 | #include "xfs_btree.h" |
34 | #include "xfs_attr_sf.h" | 33 | #include "xfs_attr_sf.h" |
35 | #include "xfs_dir_sf.h" | ||
36 | #include "xfs_dir2_sf.h" | 34 | #include "xfs_dir2_sf.h" |
37 | #include "xfs_dinode.h" | 35 | #include "xfs_dinode.h" |
38 | #include "xfs_inode.h" | 36 | #include "xfs_inode.h" |
@@ -58,15 +56,12 @@ __xfs_file_read( | |||
58 | { | 56 | { |
59 | struct iovec iov = {buf, count}; | 57 | struct iovec iov = {buf, count}; |
60 | struct file *file = iocb->ki_filp; | 58 | struct file *file = iocb->ki_filp; |
61 | vnode_t *vp = vn_from_inode(file->f_dentry->d_inode); | 59 | bhv_vnode_t *vp = vn_from_inode(file->f_dentry->d_inode); |
62 | ssize_t rval; | ||
63 | 60 | ||
64 | BUG_ON(iocb->ki_pos != pos); | 61 | BUG_ON(iocb->ki_pos != pos); |
65 | |||
66 | if (unlikely(file->f_flags & O_DIRECT)) | 62 | if (unlikely(file->f_flags & O_DIRECT)) |
67 | ioflags |= IO_ISDIRECT; | 63 | ioflags |= IO_ISDIRECT; |
68 | VOP_READ(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval); | 64 | return bhv_vop_read(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL); |
69 | return rval; | ||
70 | } | 65 | } |
71 | 66 | ||
72 | STATIC ssize_t | 67 | STATIC ssize_t |
@@ -100,15 +95,12 @@ __xfs_file_write( | |||
100 | struct iovec iov = {(void __user *)buf, count}; | 95 | struct iovec iov = {(void __user *)buf, count}; |
101 | struct file *file = iocb->ki_filp; | 96 | struct file *file = iocb->ki_filp; |
102 | struct inode *inode = file->f_mapping->host; | 97 | struct inode *inode = file->f_mapping->host; |
103 | vnode_t *vp = vn_from_inode(inode); | 98 | bhv_vnode_t *vp = vn_from_inode(inode); |
104 | ssize_t rval; | ||
105 | 99 | ||
106 | BUG_ON(iocb->ki_pos != pos); | 100 | BUG_ON(iocb->ki_pos != pos); |
107 | if (unlikely(file->f_flags & O_DIRECT)) | 101 | if (unlikely(file->f_flags & O_DIRECT)) |
108 | ioflags |= IO_ISDIRECT; | 102 | ioflags |= IO_ISDIRECT; |
109 | 103 | return bhv_vop_write(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL); | |
110 | VOP_WRITE(vp, iocb, &iov, 1, &iocb->ki_pos, ioflags, NULL, rval); | ||
111 | return rval; | ||
112 | } | 104 | } |
113 | 105 | ||
114 | STATIC ssize_t | 106 | STATIC ssize_t |
@@ -140,7 +132,7 @@ __xfs_file_readv( | |||
140 | loff_t *ppos) | 132 | loff_t *ppos) |
141 | { | 133 | { |
142 | struct inode *inode = file->f_mapping->host; | 134 | struct inode *inode = file->f_mapping->host; |
143 | vnode_t *vp = vn_from_inode(inode); | 135 | bhv_vnode_t *vp = vn_from_inode(inode); |
144 | struct kiocb kiocb; | 136 | struct kiocb kiocb; |
145 | ssize_t rval; | 137 | ssize_t rval; |
146 | 138 | ||
@@ -149,7 +141,8 @@ __xfs_file_readv( | |||
149 | 141 | ||
150 | if (unlikely(file->f_flags & O_DIRECT)) | 142 | if (unlikely(file->f_flags & O_DIRECT)) |
151 | ioflags |= IO_ISDIRECT; | 143 | ioflags |= IO_ISDIRECT; |
152 | VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); | 144 | rval = bhv_vop_read(vp, &kiocb, iov, nr_segs, |
145 | &kiocb.ki_pos, ioflags, NULL); | ||
153 | 146 | ||
154 | *ppos = kiocb.ki_pos; | 147 | *ppos = kiocb.ki_pos; |
155 | return rval; | 148 | return rval; |
@@ -184,7 +177,7 @@ __xfs_file_writev( | |||
184 | loff_t *ppos) | 177 | loff_t *ppos) |
185 | { | 178 | { |
186 | struct inode *inode = file->f_mapping->host; | 179 | struct inode *inode = file->f_mapping->host; |
187 | vnode_t *vp = vn_from_inode(inode); | 180 | bhv_vnode_t *vp = vn_from_inode(inode); |
188 | struct kiocb kiocb; | 181 | struct kiocb kiocb; |
189 | ssize_t rval; | 182 | ssize_t rval; |
190 | 183 | ||
@@ -193,7 +186,8 @@ __xfs_file_writev( | |||
193 | if (unlikely(file->f_flags & O_DIRECT)) | 186 | if (unlikely(file->f_flags & O_DIRECT)) |
194 | ioflags |= IO_ISDIRECT; | 187 | ioflags |= IO_ISDIRECT; |
195 | 188 | ||
196 | VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval); | 189 | rval = bhv_vop_write(vp, &kiocb, iov, nr_segs, |
190 | &kiocb.ki_pos, ioflags, NULL); | ||
197 | 191 | ||
198 | *ppos = kiocb.ki_pos; | 192 | *ppos = kiocb.ki_pos; |
199 | return rval; | 193 | return rval; |
@@ -227,11 +221,8 @@ xfs_file_sendfile( | |||
227 | read_actor_t actor, | 221 | read_actor_t actor, |
228 | void *target) | 222 | void *target) |
229 | { | 223 | { |
230 | vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); | 224 | return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode), |
231 | ssize_t rval; | 225 | filp, pos, 0, count, actor, target, NULL); |
232 | |||
233 | VOP_SENDFILE(vp, filp, pos, 0, count, actor, target, NULL, rval); | ||
234 | return rval; | ||
235 | } | 226 | } |
236 | 227 | ||
237 | STATIC ssize_t | 228 | STATIC ssize_t |
@@ -242,11 +233,8 @@ xfs_file_sendfile_invis( | |||
242 | read_actor_t actor, | 233 | read_actor_t actor, |
243 | void *target) | 234 | void *target) |
244 | { | 235 | { |
245 | vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); | 236 | return bhv_vop_sendfile(vn_from_inode(filp->f_dentry->d_inode), |
246 | ssize_t rval; | 237 | filp, pos, IO_INVIS, count, actor, target, NULL); |
247 | |||
248 | VOP_SENDFILE(vp, filp, pos, IO_INVIS, count, actor, target, NULL, rval); | ||
249 | return rval; | ||
250 | } | 238 | } |
251 | 239 | ||
252 | STATIC ssize_t | 240 | STATIC ssize_t |
@@ -257,11 +245,8 @@ xfs_file_splice_read( | |||
257 | size_t len, | 245 | size_t len, |
258 | unsigned int flags) | 246 | unsigned int flags) |
259 | { | 247 | { |
260 | vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode); | 248 | return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode), |
261 | ssize_t rval; | 249 | infilp, ppos, pipe, len, flags, 0, NULL); |
262 | |||
263 | VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, 0, NULL, rval); | ||
264 | return rval; | ||
265 | } | 250 | } |
266 | 251 | ||
267 | STATIC ssize_t | 252 | STATIC ssize_t |
@@ -272,11 +257,9 @@ xfs_file_splice_read_invis( | |||
272 | size_t len, | 257 | size_t len, |
273 | unsigned int flags) | 258 | unsigned int flags) |
274 | { | 259 | { |
275 | vnode_t *vp = vn_from_inode(infilp->f_dentry->d_inode); | 260 | return bhv_vop_splice_read(vn_from_inode(infilp->f_dentry->d_inode), |
276 | ssize_t rval; | 261 | infilp, ppos, pipe, len, flags, IO_INVIS, |
277 | 262 | NULL); | |
278 | VOP_SPLICE_READ(vp, infilp, ppos, pipe, len, flags, IO_INVIS, NULL, rval); | ||
279 | return rval; | ||
280 | } | 263 | } |
281 | 264 | ||
282 | STATIC ssize_t | 265 | STATIC ssize_t |
@@ -287,11 +270,8 @@ xfs_file_splice_write( | |||
287 | size_t len, | 270 | size_t len, |
288 | unsigned int flags) | 271 | unsigned int flags) |
289 | { | 272 | { |
290 | vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode); | 273 | return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode), |
291 | ssize_t rval; | 274 | pipe, outfilp, ppos, len, flags, 0, NULL); |
292 | |||
293 | VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, 0, NULL, rval); | ||
294 | return rval; | ||
295 | } | 275 | } |
296 | 276 | ||
297 | STATIC ssize_t | 277 | STATIC ssize_t |
@@ -302,11 +282,9 @@ xfs_file_splice_write_invis( | |||
302 | size_t len, | 282 | size_t len, |
303 | unsigned int flags) | 283 | unsigned int flags) |
304 | { | 284 | { |
305 | vnode_t *vp = vn_from_inode(outfilp->f_dentry->d_inode); | 285 | return bhv_vop_splice_write(vn_from_inode(outfilp->f_dentry->d_inode), |
306 | ssize_t rval; | 286 | pipe, outfilp, ppos, len, flags, IO_INVIS, |
307 | 287 | NULL); | |
308 | VOP_SPLICE_WRITE(vp, pipe, outfilp, ppos, len, flags, IO_INVIS, NULL, rval); | ||
309 | return rval; | ||
310 | } | 288 | } |
311 | 289 | ||
312 | STATIC int | 290 | STATIC int |
@@ -314,13 +292,17 @@ xfs_file_open( | |||
314 | struct inode *inode, | 292 | struct inode *inode, |
315 | struct file *filp) | 293 | struct file *filp) |
316 | { | 294 | { |
317 | vnode_t *vp = vn_from_inode(inode); | ||
318 | int error; | ||
319 | |||
320 | if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS) | 295 | if (!(filp->f_flags & O_LARGEFILE) && i_size_read(inode) > MAX_NON_LFS) |
321 | return -EFBIG; | 296 | return -EFBIG; |
322 | VOP_OPEN(vp, NULL, error); | 297 | return -bhv_vop_open(vn_from_inode(inode), NULL); |
323 | return -error; | 298 | } |
299 | |||
300 | STATIC int | ||
301 | xfs_file_close( | ||
302 | struct file *filp) | ||
303 | { | ||
304 | return -bhv_vop_close(vn_from_inode(filp->f_dentry->d_inode), 0, | ||
305 | file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL); | ||
324 | } | 306 | } |
325 | 307 | ||
326 | STATIC int | 308 | STATIC int |
@@ -328,12 +310,11 @@ xfs_file_release( | |||
328 | struct inode *inode, | 310 | struct inode *inode, |
329 | struct file *filp) | 311 | struct file *filp) |
330 | { | 312 | { |
331 | vnode_t *vp = vn_from_inode(inode); | 313 | bhv_vnode_t *vp = vn_from_inode(inode); |
332 | int error = 0; | ||
333 | 314 | ||
334 | if (vp) | 315 | if (vp) |
335 | VOP_RELEASE(vp, error); | 316 | return -bhv_vop_release(vp); |
336 | return -error; | 317 | return 0; |
337 | } | 318 | } |
338 | 319 | ||
339 | STATIC int | 320 | STATIC int |
@@ -342,15 +323,14 @@ xfs_file_fsync( | |||
342 | struct dentry *dentry, | 323 | struct dentry *dentry, |
343 | int datasync) | 324 | int datasync) |
344 | { | 325 | { |
345 | struct inode *inode = dentry->d_inode; | 326 | bhv_vnode_t *vp = vn_from_inode(dentry->d_inode); |
346 | vnode_t *vp = vn_from_inode(inode); | ||
347 | int error; | ||
348 | int flags = FSYNC_WAIT; | 327 | int flags = FSYNC_WAIT; |
349 | 328 | ||
350 | if (datasync) | 329 | if (datasync) |
351 | flags |= FSYNC_DATA; | 330 | flags |= FSYNC_DATA; |
352 | VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error); | 331 | if (VN_TRUNC(vp)) |
353 | return -error; | 332 | VUNTRUNCATE(vp); |
333 | return -bhv_vop_fsync(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1); | ||
354 | } | 334 | } |
355 | 335 | ||
356 | #ifdef CONFIG_XFS_DMAPI | 336 | #ifdef CONFIG_XFS_DMAPI |
@@ -361,16 +341,11 @@ xfs_vm_nopage( | |||
361 | int *type) | 341 | int *type) |
362 | { | 342 | { |
363 | struct inode *inode = area->vm_file->f_dentry->d_inode; | 343 | struct inode *inode = area->vm_file->f_dentry->d_inode; |
364 | vnode_t *vp = vn_from_inode(inode); | 344 | bhv_vnode_t *vp = vn_from_inode(inode); |
365 | xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); | ||
366 | int error; | ||
367 | 345 | ||
368 | ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI); | 346 | ASSERT_ALWAYS(vp->v_vfsp->vfs_flag & VFS_DMI); |
369 | 347 | if (XFS_SEND_MMAP(XFS_VFSTOM(vp->v_vfsp), area, 0)) | |
370 | error = XFS_SEND_MMAP(mp, area, 0); | ||
371 | if (error) | ||
372 | return NULL; | 348 | return NULL; |
373 | |||
374 | return filemap_nopage(area, address, type); | 349 | return filemap_nopage(area, address, type); |
375 | } | 350 | } |
376 | #endif /* CONFIG_XFS_DMAPI */ | 351 | #endif /* CONFIG_XFS_DMAPI */ |
@@ -382,7 +357,7 @@ xfs_file_readdir( | |||
382 | filldir_t filldir) | 357 | filldir_t filldir) |
383 | { | 358 | { |
384 | int error = 0; | 359 | int error = 0; |
385 | vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); | 360 | bhv_vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode); |
386 | uio_t uio; | 361 | uio_t uio; |
387 | iovec_t iov; | 362 | iovec_t iov; |
388 | int eof = 0; | 363 | int eof = 0; |
@@ -417,7 +392,7 @@ xfs_file_readdir( | |||
417 | 392 | ||
418 | start_offset = uio.uio_offset; | 393 | start_offset = uio.uio_offset; |
419 | 394 | ||
420 | VOP_READDIR(vp, &uio, NULL, &eof, error); | 395 | error = bhv_vop_readdir(vp, &uio, NULL, &eof); |
421 | if ((uio.uio_offset == start_offset) || error) { | 396 | if ((uio.uio_offset == start_offset) || error) { |
422 | size = 0; | 397 | size = 0; |
423 | break; | 398 | break; |
@@ -456,38 +431,28 @@ xfs_file_mmap( | |||
456 | struct file *filp, | 431 | struct file *filp, |
457 | struct vm_area_struct *vma) | 432 | struct vm_area_struct *vma) |
458 | { | 433 | { |
459 | struct inode *ip = filp->f_dentry->d_inode; | ||
460 | vnode_t *vp = vn_from_inode(ip); | ||
461 | vattr_t vattr; | ||
462 | int error; | ||
463 | |||
464 | vma->vm_ops = &xfs_file_vm_ops; | 434 | vma->vm_ops = &xfs_file_vm_ops; |
465 | 435 | ||
466 | #ifdef CONFIG_XFS_DMAPI | 436 | #ifdef CONFIG_XFS_DMAPI |
467 | if (vp->v_vfsp->vfs_flag & VFS_DMI) { | 437 | if (vn_from_inode(filp->f_dentry->d_inode)->v_vfsp->vfs_flag & VFS_DMI) |
468 | vma->vm_ops = &xfs_dmapi_file_vm_ops; | 438 | vma->vm_ops = &xfs_dmapi_file_vm_ops; |
469 | } | ||
470 | #endif /* CONFIG_XFS_DMAPI */ | 439 | #endif /* CONFIG_XFS_DMAPI */ |
471 | 440 | ||
472 | vattr.va_mask = XFS_AT_UPDATIME; | 441 | file_accessed(filp); |
473 | VOP_SETATTR(vp, &vattr, XFS_AT_UPDATIME, NULL, error); | ||
474 | if (likely(!error)) | ||
475 | __vn_revalidate(vp, &vattr); /* update flags */ | ||
476 | return 0; | 442 | return 0; |
477 | } | 443 | } |
478 | 444 | ||
479 | |||
480 | STATIC long | 445 | STATIC long |
481 | xfs_file_ioctl( | 446 | xfs_file_ioctl( |
482 | struct file *filp, | 447 | struct file *filp, |
483 | unsigned int cmd, | 448 | unsigned int cmd, |
484 | unsigned long arg) | 449 | unsigned long p) |
485 | { | 450 | { |
486 | int error; | 451 | int error; |
487 | struct inode *inode = filp->f_dentry->d_inode; | 452 | struct inode *inode = filp->f_dentry->d_inode; |
488 | vnode_t *vp = vn_from_inode(inode); | 453 | bhv_vnode_t *vp = vn_from_inode(inode); |
489 | 454 | ||
490 | VOP_IOCTL(vp, inode, filp, 0, cmd, (void __user *)arg, error); | 455 | error = bhv_vop_ioctl(vp, inode, filp, 0, cmd, (void __user *)p); |
491 | VMODIFY(vp); | 456 | VMODIFY(vp); |
492 | 457 | ||
493 | /* NOTE: some of the ioctl's return positive #'s as a | 458 | /* NOTE: some of the ioctl's return positive #'s as a |
@@ -503,13 +468,13 @@ STATIC long | |||
503 | xfs_file_ioctl_invis( | 468 | xfs_file_ioctl_invis( |
504 | struct file *filp, | 469 | struct file *filp, |
505 | unsigned int cmd, | 470 | unsigned int cmd, |
506 | unsigned long arg) | 471 | unsigned long p) |
507 | { | 472 | { |
508 | struct inode *inode = filp->f_dentry->d_inode; | ||
509 | vnode_t *vp = vn_from_inode(inode); | ||
510 | int error; | 473 | int error; |
474 | struct inode *inode = filp->f_dentry->d_inode; | ||
475 | bhv_vnode_t *vp = vn_from_inode(inode); | ||
511 | 476 | ||
512 | VOP_IOCTL(vp, inode, filp, IO_INVIS, cmd, (void __user *)arg, error); | 477 | error = bhv_vop_ioctl(vp, inode, filp, IO_INVIS, cmd, (void __user *)p); |
513 | VMODIFY(vp); | 478 | VMODIFY(vp); |
514 | 479 | ||
515 | /* NOTE: some of the ioctl's return positive #'s as a | 480 | /* NOTE: some of the ioctl's return positive #'s as a |
@@ -528,7 +493,7 @@ xfs_vm_mprotect( | |||
528 | struct vm_area_struct *vma, | 493 | struct vm_area_struct *vma, |
529 | unsigned int newflags) | 494 | unsigned int newflags) |
530 | { | 495 | { |
531 | vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode); | 496 | bhv_vnode_t *vp = vn_from_inode(vma->vm_file->f_dentry->d_inode); |
532 | int error = 0; | 497 | int error = 0; |
533 | 498 | ||
534 | if (vp->v_vfsp->vfs_flag & VFS_DMI) { | 499 | if (vp->v_vfsp->vfs_flag & VFS_DMI) { |
@@ -554,24 +519,19 @@ STATIC int | |||
554 | xfs_file_open_exec( | 519 | xfs_file_open_exec( |
555 | struct inode *inode) | 520 | struct inode *inode) |
556 | { | 521 | { |
557 | vnode_t *vp = vn_from_inode(inode); | 522 | bhv_vnode_t *vp = vn_from_inode(inode); |
558 | xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); | ||
559 | int error = 0; | ||
560 | xfs_inode_t *ip; | ||
561 | 523 | ||
562 | if (vp->v_vfsp->vfs_flag & VFS_DMI) { | 524 | if (unlikely(vp->v_vfsp->vfs_flag & VFS_DMI)) { |
563 | ip = xfs_vtoi(vp); | 525 | xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); |
564 | if (!ip) { | 526 | xfs_inode_t *ip = xfs_vtoi(vp); |
565 | error = -EINVAL; | 527 | |
566 | goto open_exec_out; | 528 | if (!ip) |
567 | } | 529 | return -EINVAL; |
568 | if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)) { | 530 | if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ)) |
569 | error = -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, | 531 | return -XFS_SEND_DATA(mp, DM_EVENT_READ, vp, |
570 | 0, 0, 0, NULL); | 532 | 0, 0, 0, NULL); |
571 | } | ||
572 | } | 533 | } |
573 | open_exec_out: | 534 | return 0; |
574 | return error; | ||
575 | } | 535 | } |
576 | #endif /* HAVE_FOP_OPEN_EXEC */ | 536 | #endif /* HAVE_FOP_OPEN_EXEC */ |
577 | 537 | ||
@@ -592,6 +552,7 @@ const struct file_operations xfs_file_operations = { | |||
592 | #endif | 552 | #endif |
593 | .mmap = xfs_file_mmap, | 553 | .mmap = xfs_file_mmap, |
594 | .open = xfs_file_open, | 554 | .open = xfs_file_open, |
555 | .flush = xfs_file_close, | ||
595 | .release = xfs_file_release, | 556 | .release = xfs_file_release, |
596 | .fsync = xfs_file_fsync, | 557 | .fsync = xfs_file_fsync, |
597 | #ifdef HAVE_FOP_OPEN_EXEC | 558 | #ifdef HAVE_FOP_OPEN_EXEC |
@@ -616,6 +577,7 @@ const struct file_operations xfs_invis_file_operations = { | |||
616 | #endif | 577 | #endif |
617 | .mmap = xfs_file_mmap, | 578 | .mmap = xfs_file_mmap, |
618 | .open = xfs_file_open, | 579 | .open = xfs_file_open, |
580 | .flush = xfs_file_close, | ||
619 | .release = xfs_file_release, | 581 | .release = xfs_file_release, |
620 | .fsync = xfs_file_fsync, | 582 | .fsync = xfs_file_fsync, |
621 | }; | 583 | }; |