diff options
author | Christoph Hellwig <hch@lst.de> | 2016-07-19 21:29:35 -0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2016-07-19 21:29:35 -0400 |
commit | 8f3e2058e1746dc3fb8145f8fbd5ee358cbc1a30 (patch) | |
tree | 29d669c13e40bc557ebf5ae50b220017a9f4b79a | |
parent | 1a695a905c18548062509178b98bc91e67510864 (diff) |
xfs: don't pass ioflags around in the ioctl path
Instead check the file pointer for the invisble I/O flag directly, and
use the chance to drop redundant arguments from the xfs_ioc_space
prototype.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
-rw-r--r-- | fs/xfs/xfs_ioctl.c | 22 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl.h | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_ioctl32.c | 6 |
3 files changed, 9 insertions, 22 deletions
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index dbca7375deef..6ab5a247075d 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c | |||
@@ -595,13 +595,12 @@ xfs_attrmulti_by_handle( | |||
595 | 595 | ||
596 | int | 596 | int |
597 | xfs_ioc_space( | 597 | xfs_ioc_space( |
598 | struct xfs_inode *ip, | ||
599 | struct inode *inode, | ||
600 | struct file *filp, | 598 | struct file *filp, |
601 | int ioflags, | ||
602 | unsigned int cmd, | 599 | unsigned int cmd, |
603 | xfs_flock64_t *bf) | 600 | xfs_flock64_t *bf) |
604 | { | 601 | { |
602 | struct inode *inode = file_inode(filp); | ||
603 | struct xfs_inode *ip = XFS_I(inode); | ||
605 | struct iattr iattr; | 604 | struct iattr iattr; |
606 | enum xfs_prealloc_flags flags = 0; | 605 | enum xfs_prealloc_flags flags = 0; |
607 | uint iolock = XFS_IOLOCK_EXCL; | 606 | uint iolock = XFS_IOLOCK_EXCL; |
@@ -626,7 +625,7 @@ xfs_ioc_space( | |||
626 | 625 | ||
627 | if (filp->f_flags & O_DSYNC) | 626 | if (filp->f_flags & O_DSYNC) |
628 | flags |= XFS_PREALLOC_SYNC; | 627 | flags |= XFS_PREALLOC_SYNC; |
629 | if (ioflags & XFS_IO_INVIS) | 628 | if (filp->f_mode & FMODE_NOCMTIME) |
630 | flags |= XFS_PREALLOC_INVISIBLE; | 629 | flags |= XFS_PREALLOC_INVISIBLE; |
631 | 630 | ||
632 | error = mnt_want_write_file(filp); | 631 | error = mnt_want_write_file(filp); |
@@ -1464,8 +1463,7 @@ xfs_getbmap_format(void **ap, struct getbmapx *bmv, int *full) | |||
1464 | 1463 | ||
1465 | STATIC int | 1464 | STATIC int |
1466 | xfs_ioc_getbmap( | 1465 | xfs_ioc_getbmap( |
1467 | struct xfs_inode *ip, | 1466 | struct file *file, |
1468 | int ioflags, | ||
1469 | unsigned int cmd, | 1467 | unsigned int cmd, |
1470 | void __user *arg) | 1468 | void __user *arg) |
1471 | { | 1469 | { |
@@ -1479,10 +1477,10 @@ xfs_ioc_getbmap( | |||
1479 | return -EINVAL; | 1477 | return -EINVAL; |
1480 | 1478 | ||
1481 | bmx.bmv_iflags = (cmd == XFS_IOC_GETBMAPA ? BMV_IF_ATTRFORK : 0); | 1479 | bmx.bmv_iflags = (cmd == XFS_IOC_GETBMAPA ? BMV_IF_ATTRFORK : 0); |
1482 | if (ioflags & XFS_IO_INVIS) | 1480 | if (file->f_mode & FMODE_NOCMTIME) |
1483 | bmx.bmv_iflags |= BMV_IF_NO_DMAPI_READ; | 1481 | bmx.bmv_iflags |= BMV_IF_NO_DMAPI_READ; |
1484 | 1482 | ||
1485 | error = xfs_getbmap(ip, &bmx, xfs_getbmap_format, | 1483 | error = xfs_getbmap(XFS_I(file_inode(file)), &bmx, xfs_getbmap_format, |
1486 | (__force struct getbmap *)arg+1); | 1484 | (__force struct getbmap *)arg+1); |
1487 | if (error) | 1485 | if (error) |
1488 | return error; | 1486 | return error; |
@@ -1619,12 +1617,8 @@ xfs_file_ioctl( | |||
1619 | struct xfs_inode *ip = XFS_I(inode); | 1617 | struct xfs_inode *ip = XFS_I(inode); |
1620 | struct xfs_mount *mp = ip->i_mount; | 1618 | struct xfs_mount *mp = ip->i_mount; |
1621 | void __user *arg = (void __user *)p; | 1619 | void __user *arg = (void __user *)p; |
1622 | int ioflags = 0; | ||
1623 | int error; | 1620 | int error; |
1624 | 1621 | ||
1625 | if (filp->f_mode & FMODE_NOCMTIME) | ||
1626 | ioflags |= XFS_IO_INVIS; | ||
1627 | |||
1628 | trace_xfs_file_ioctl(ip); | 1622 | trace_xfs_file_ioctl(ip); |
1629 | 1623 | ||
1630 | switch (cmd) { | 1624 | switch (cmd) { |
@@ -1643,7 +1637,7 @@ xfs_file_ioctl( | |||
1643 | 1637 | ||
1644 | if (copy_from_user(&bf, arg, sizeof(bf))) | 1638 | if (copy_from_user(&bf, arg, sizeof(bf))) |
1645 | return -EFAULT; | 1639 | return -EFAULT; |
1646 | return xfs_ioc_space(ip, inode, filp, ioflags, cmd, &bf); | 1640 | return xfs_ioc_space(filp, cmd, &bf); |
1647 | } | 1641 | } |
1648 | case XFS_IOC_DIOINFO: { | 1642 | case XFS_IOC_DIOINFO: { |
1649 | struct dioattr da; | 1643 | struct dioattr da; |
@@ -1702,7 +1696,7 @@ xfs_file_ioctl( | |||
1702 | 1696 | ||
1703 | case XFS_IOC_GETBMAP: | 1697 | case XFS_IOC_GETBMAP: |
1704 | case XFS_IOC_GETBMAPA: | 1698 | case XFS_IOC_GETBMAPA: |
1705 | return xfs_ioc_getbmap(ip, ioflags, cmd, arg); | 1699 | return xfs_ioc_getbmap(filp, cmd, arg); |
1706 | 1700 | ||
1707 | case XFS_IOC_GETBMAPX: | 1701 | case XFS_IOC_GETBMAPX: |
1708 | return xfs_ioc_getbmapx(ip, arg); | 1702 | return xfs_ioc_getbmapx(ip, arg); |
diff --git a/fs/xfs/xfs_ioctl.h b/fs/xfs/xfs_ioctl.h index 77c02c7900b6..8b52881bfd90 100644 --- a/fs/xfs/xfs_ioctl.h +++ b/fs/xfs/xfs_ioctl.h | |||
@@ -20,10 +20,7 @@ | |||
20 | 20 | ||
21 | extern int | 21 | extern int |
22 | xfs_ioc_space( | 22 | xfs_ioc_space( |
23 | struct xfs_inode *ip, | ||
24 | struct inode *inode, | ||
25 | struct file *filp, | 23 | struct file *filp, |
26 | int ioflags, | ||
27 | unsigned int cmd, | 24 | unsigned int cmd, |
28 | xfs_flock64_t *bf); | 25 | xfs_flock64_t *bf); |
29 | 26 | ||
diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index 1a05d8ae327d..321f57721b92 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c | |||
@@ -532,12 +532,8 @@ xfs_file_compat_ioctl( | |||
532 | struct xfs_inode *ip = XFS_I(inode); | 532 | struct xfs_inode *ip = XFS_I(inode); |
533 | struct xfs_mount *mp = ip->i_mount; | 533 | struct xfs_mount *mp = ip->i_mount; |
534 | void __user *arg = (void __user *)p; | 534 | void __user *arg = (void __user *)p; |
535 | int ioflags = 0; | ||
536 | int error; | 535 | int error; |
537 | 536 | ||
538 | if (filp->f_mode & FMODE_NOCMTIME) | ||
539 | ioflags |= XFS_IO_INVIS; | ||
540 | |||
541 | trace_xfs_file_compat_ioctl(ip); | 537 | trace_xfs_file_compat_ioctl(ip); |
542 | 538 | ||
543 | switch (cmd) { | 539 | switch (cmd) { |
@@ -589,7 +585,7 @@ xfs_file_compat_ioctl( | |||
589 | if (xfs_compat_flock64_copyin(&bf, arg)) | 585 | if (xfs_compat_flock64_copyin(&bf, arg)) |
590 | return -EFAULT; | 586 | return -EFAULT; |
591 | cmd = _NATIVE_IOC(cmd, struct xfs_flock64); | 587 | cmd = _NATIVE_IOC(cmd, struct xfs_flock64); |
592 | return xfs_ioc_space(ip, inode, filp, ioflags, cmd, &bf); | 588 | return xfs_ioc_space(filp, cmd, &bf); |
593 | } | 589 | } |
594 | case XFS_IOC_FSGEOMETRY_V1_32: | 590 | case XFS_IOC_FSGEOMETRY_V1_32: |
595 | return xfs_compat_ioc_fsgeometry_v1(mp, arg); | 591 | return xfs_compat_ioc_fsgeometry_v1(mp, arg); |