diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-12-09 04:47:33 -0500 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-12-10 21:14:41 -0500 |
commit | 4d4be482a4d78ca906f45e99fd9fdb91e907f5ad (patch) | |
tree | 52974b28fecd3c11fc0596504270ffee976f1b1a /fs/xfs/linux-2.6/xfs_ioctl.c | |
parent | 6d73cf133c5477f7038577bfeda603ce9946f8cb (diff) |
[XFS] add a FMODE flag to make XFS invisible I/O less hacky
XFS has a mode called invisble I/O that doesn't update any of the
timestamps. It's used for HSM-style applications and exposed through
the nasty open by handle ioctl.
Instead of doing directly assignment of file operations that set an
internal flag for it add a new FMODE_NOCMTIME flag that we can check
in the normal file operations.
(addition of the generic VFS flag has been ACKed by Al as an interims
solution)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_ioctl.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index c8f1e632ba94..0264c8719ffd 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -319,10 +319,11 @@ xfs_open_by_handle( | |||
319 | put_unused_fd(new_fd); | 319 | put_unused_fd(new_fd); |
320 | return -XFS_ERROR(-PTR_ERR(filp)); | 320 | return -XFS_ERROR(-PTR_ERR(filp)); |
321 | } | 321 | } |
322 | |||
322 | if (inode->i_mode & S_IFREG) { | 323 | if (inode->i_mode & S_IFREG) { |
323 | /* invisible operation should not change atime */ | 324 | /* invisible operation should not change atime */ |
324 | filp->f_flags |= O_NOATIME; | 325 | filp->f_flags |= O_NOATIME; |
325 | filp->f_op = &xfs_invis_file_operations; | 326 | filp->f_mode |= FMODE_NOCMTIME; |
326 | } | 327 | } |
327 | 328 | ||
328 | fd_install(new_fd, filp); | 329 | fd_install(new_fd, filp); |
@@ -1328,21 +1329,31 @@ xfs_ioc_getbmapx( | |||
1328 | return 0; | 1329 | return 0; |
1329 | } | 1330 | } |
1330 | 1331 | ||
1331 | int | 1332 | /* |
1332 | xfs_ioctl( | 1333 | * Note: some of the ioctl's return positive numbers as a |
1333 | xfs_inode_t *ip, | 1334 | * byte count indicating success, such as readlink_by_handle. |
1335 | * So we don't "sign flip" like most other routines. This means | ||
1336 | * true errors need to be returned as a negative value. | ||
1337 | */ | ||
1338 | long | ||
1339 | xfs_file_ioctl( | ||
1334 | struct file *filp, | 1340 | struct file *filp, |
1335 | int ioflags, | ||
1336 | unsigned int cmd, | 1341 | unsigned int cmd, |
1337 | void __user *arg) | 1342 | unsigned long p) |
1338 | { | 1343 | { |
1339 | struct inode *inode = filp->f_path.dentry->d_inode; | 1344 | struct inode *inode = filp->f_path.dentry->d_inode; |
1340 | xfs_mount_t *mp = ip->i_mount; | 1345 | struct xfs_inode *ip = XFS_I(inode); |
1346 | struct xfs_mount *mp = ip->i_mount; | ||
1347 | void __user *arg = (void __user *)p; | ||
1348 | int ioflags = 0; | ||
1341 | int error; | 1349 | int error; |
1342 | 1350 | ||
1343 | xfs_itrace_entry(XFS_I(inode)); | 1351 | if (filp->f_mode & FMODE_NOCMTIME) |
1344 | switch (cmd) { | 1352 | ioflags |= IO_INVIS; |
1345 | 1353 | ||
1354 | xfs_itrace_entry(ip); | ||
1355 | |||
1356 | switch (cmd) { | ||
1346 | case XFS_IOC_ALLOCSP: | 1357 | case XFS_IOC_ALLOCSP: |
1347 | case XFS_IOC_FREESP: | 1358 | case XFS_IOC_FREESP: |
1348 | case XFS_IOC_RESVSP: | 1359 | case XFS_IOC_RESVSP: |