aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_vfsops.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_vfsops.c')
-rw-r--r--fs/xfs/xfs_vfsops.c430
1 files changed, 0 insertions, 430 deletions
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index aa310875c88c..b8e16a6952be 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -1461,433 +1461,3 @@ xfs_vget(
1461 return 0; 1461 return 0;
1462} 1462}
1463 1463
1464
1465#define MNTOPT_LOGBUFS "logbufs" /* number of XFS log buffers */
1466#define MNTOPT_LOGBSIZE "logbsize" /* size of XFS log buffers */
1467#define MNTOPT_LOGDEV "logdev" /* log device */
1468#define MNTOPT_RTDEV "rtdev" /* realtime I/O device */
1469#define MNTOPT_BIOSIZE "biosize" /* log2 of preferred buffered io size */
1470#define MNTOPT_WSYNC "wsync" /* safe-mode nfs compatible mount */
1471#define MNTOPT_INO64 "ino64" /* force inodes into 64-bit range */
1472#define MNTOPT_NOALIGN "noalign" /* turn off stripe alignment */
1473#define MNTOPT_SWALLOC "swalloc" /* turn on stripe width allocation */
1474#define MNTOPT_SUNIT "sunit" /* data volume stripe unit */
1475#define MNTOPT_SWIDTH "swidth" /* data volume stripe width */
1476#define MNTOPT_NOUUID "nouuid" /* ignore filesystem UUID */
1477#define MNTOPT_MTPT "mtpt" /* filesystem mount point */
1478#define MNTOPT_GRPID "grpid" /* group-ID from parent directory */
1479#define MNTOPT_NOGRPID "nogrpid" /* group-ID from current process */
1480#define MNTOPT_BSDGROUPS "bsdgroups" /* group-ID from parent directory */
1481#define MNTOPT_SYSVGROUPS "sysvgroups" /* group-ID from current process */
1482#define MNTOPT_ALLOCSIZE "allocsize" /* preferred allocation size */
1483#define MNTOPT_NORECOVERY "norecovery" /* don't run XFS recovery */
1484#define MNTOPT_BARRIER "barrier" /* use writer barriers for log write and
1485 * unwritten extent conversion */
1486#define MNTOPT_NOBARRIER "nobarrier" /* .. disable */
1487#define MNTOPT_OSYNCISOSYNC "osyncisosync" /* o_sync is REALLY o_sync */
1488#define MNTOPT_64BITINODE "inode64" /* inodes can be allocated anywhere */
1489#define MNTOPT_IKEEP "ikeep" /* do not free empty inode clusters */
1490#define MNTOPT_NOIKEEP "noikeep" /* free empty inode clusters */
1491#define MNTOPT_LARGEIO "largeio" /* report large I/O sizes in stat() */
1492#define MNTOPT_NOLARGEIO "nolargeio" /* do not report large I/O sizes
1493 * in stat(). */
1494#define MNTOPT_ATTR2 "attr2" /* do use attr2 attribute format */
1495#define MNTOPT_NOATTR2 "noattr2" /* do not use attr2 attribute format */
1496#define MNTOPT_FILESTREAM "filestreams" /* use filestreams allocator */
1497#define MNTOPT_QUOTA "quota" /* disk quotas (user) */
1498#define MNTOPT_NOQUOTA "noquota" /* no quotas */
1499#define MNTOPT_USRQUOTA "usrquota" /* user quota enabled */
1500#define MNTOPT_GRPQUOTA "grpquota" /* group quota enabled */
1501#define MNTOPT_PRJQUOTA "prjquota" /* project quota enabled */
1502#define MNTOPT_UQUOTA "uquota" /* user quota (IRIX variant) */
1503#define MNTOPT_GQUOTA "gquota" /* group quota (IRIX variant) */
1504#define MNTOPT_PQUOTA "pquota" /* project quota (IRIX variant) */
1505#define MNTOPT_UQUOTANOENF "uqnoenforce"/* user quota limit enforcement */
1506#define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */
1507#define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */
1508#define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */
1509#define MNTOPT_DMAPI "dmapi" /* DMI enabled (DMAPI / XDSM) */
1510#define MNTOPT_XDSM "xdsm" /* DMI enabled (DMAPI / XDSM) */
1511#define MNTOPT_DMI "dmi" /* DMI enabled (DMAPI / XDSM) */
1512
1513STATIC unsigned long
1514suffix_strtoul(char *s, char **endp, unsigned int base)
1515{
1516 int last, shift_left_factor = 0;
1517 char *value = s;
1518
1519 last = strlen(value) - 1;
1520 if (value[last] == 'K' || value[last] == 'k') {
1521 shift_left_factor = 10;
1522 value[last] = '\0';
1523 }
1524 if (value[last] == 'M' || value[last] == 'm') {
1525 shift_left_factor = 20;
1526 value[last] = '\0';
1527 }
1528 if (value[last] == 'G' || value[last] == 'g') {
1529 shift_left_factor = 30;
1530 value[last] = '\0';
1531 }
1532
1533 return simple_strtoul((const char *)s, endp, base) << shift_left_factor;
1534}
1535
1536int
1537xfs_parseargs(
1538 struct xfs_mount *mp,
1539 char *options,
1540 struct xfs_mount_args *args,
1541 int update)
1542{
1543 char *this_char, *value, *eov;
1544 int dsunit, dswidth, vol_dsunit, vol_dswidth;
1545 int iosize;
1546 int ikeep = 0;
1547
1548 args->flags |= XFSMNT_BARRIER;
1549 args->flags2 |= XFSMNT2_COMPAT_IOSIZE;
1550
1551 if (!options)
1552 goto done;
1553
1554 iosize = dsunit = dswidth = vol_dsunit = vol_dswidth = 0;
1555
1556 while ((this_char = strsep(&options, ",")) != NULL) {
1557 if (!*this_char)
1558 continue;
1559 if ((value = strchr(this_char, '=')) != NULL)
1560 *value++ = 0;
1561
1562 if (!strcmp(this_char, MNTOPT_LOGBUFS)) {
1563 if (!value || !*value) {
1564 cmn_err(CE_WARN,
1565 "XFS: %s option requires an argument",
1566 this_char);
1567 return EINVAL;
1568 }
1569 args->logbufs = simple_strtoul(value, &eov, 10);
1570 } else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
1571 if (!value || !*value) {
1572 cmn_err(CE_WARN,
1573 "XFS: %s option requires an argument",
1574 this_char);
1575 return EINVAL;
1576 }
1577 args->logbufsize = suffix_strtoul(value, &eov, 10);
1578 } else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
1579 if (!value || !*value) {
1580 cmn_err(CE_WARN,
1581 "XFS: %s option requires an argument",
1582 this_char);
1583 return EINVAL;
1584 }
1585 strncpy(args->logname, value, MAXNAMELEN);
1586 } else if (!strcmp(this_char, MNTOPT_MTPT)) {
1587 if (!value || !*value) {
1588 cmn_err(CE_WARN,
1589 "XFS: %s option requires an argument",
1590 this_char);
1591 return EINVAL;
1592 }
1593 strncpy(args->mtpt, value, MAXNAMELEN);
1594 } else if (!strcmp(this_char, MNTOPT_RTDEV)) {
1595 if (!value || !*value) {
1596 cmn_err(CE_WARN,
1597 "XFS: %s option requires an argument",
1598 this_char);
1599 return EINVAL;
1600 }
1601 strncpy(args->rtname, value, MAXNAMELEN);
1602 } else if (!strcmp(this_char, MNTOPT_BIOSIZE)) {
1603 if (!value || !*value) {
1604 cmn_err(CE_WARN,
1605 "XFS: %s option requires an argument",
1606 this_char);
1607 return EINVAL;
1608 }
1609 iosize = simple_strtoul(value, &eov, 10);
1610 args->flags |= XFSMNT_IOSIZE;
1611 args->iosizelog = (uint8_t) iosize;
1612 } else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
1613 if (!value || !*value) {
1614 cmn_err(CE_WARN,
1615 "XFS: %s option requires an argument",
1616 this_char);
1617 return EINVAL;
1618 }
1619 iosize = suffix_strtoul(value, &eov, 10);
1620 args->flags |= XFSMNT_IOSIZE;
1621 args->iosizelog = ffs(iosize) - 1;
1622 } else if (!strcmp(this_char, MNTOPT_GRPID) ||
1623 !strcmp(this_char, MNTOPT_BSDGROUPS)) {
1624 mp->m_flags |= XFS_MOUNT_GRPID;
1625 } else if (!strcmp(this_char, MNTOPT_NOGRPID) ||
1626 !strcmp(this_char, MNTOPT_SYSVGROUPS)) {
1627 mp->m_flags &= ~XFS_MOUNT_GRPID;
1628 } else if (!strcmp(this_char, MNTOPT_WSYNC)) {
1629 args->flags |= XFSMNT_WSYNC;
1630 } else if (!strcmp(this_char, MNTOPT_OSYNCISOSYNC)) {
1631 args->flags |= XFSMNT_OSYNCISOSYNC;
1632 } else if (!strcmp(this_char, MNTOPT_NORECOVERY)) {
1633 args->flags |= XFSMNT_NORECOVERY;
1634 } else if (!strcmp(this_char, MNTOPT_INO64)) {
1635 args->flags |= XFSMNT_INO64;
1636#if !XFS_BIG_INUMS
1637 cmn_err(CE_WARN,
1638 "XFS: %s option not allowed on this system",
1639 this_char);
1640 return EINVAL;
1641#endif
1642 } else if (!strcmp(this_char, MNTOPT_NOALIGN)) {
1643 args->flags |= XFSMNT_NOALIGN;
1644 } else if (!strcmp(this_char, MNTOPT_SWALLOC)) {
1645 args->flags |= XFSMNT_SWALLOC;
1646 } else if (!strcmp(this_char, MNTOPT_SUNIT)) {
1647 if (!value || !*value) {
1648 cmn_err(CE_WARN,
1649 "XFS: %s option requires an argument",
1650 this_char);
1651 return EINVAL;
1652 }
1653 dsunit = simple_strtoul(value, &eov, 10);
1654 } else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
1655 if (!value || !*value) {
1656 cmn_err(CE_WARN,
1657 "XFS: %s option requires an argument",
1658 this_char);
1659 return EINVAL;
1660 }
1661 dswidth = simple_strtoul(value, &eov, 10);
1662 } else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
1663 args->flags &= ~XFSMNT_32BITINODES;
1664#if !XFS_BIG_INUMS
1665 cmn_err(CE_WARN,
1666 "XFS: %s option not allowed on this system",
1667 this_char);
1668 return EINVAL;
1669#endif
1670 } else if (!strcmp(this_char, MNTOPT_NOUUID)) {
1671 args->flags |= XFSMNT_NOUUID;
1672 } else if (!strcmp(this_char, MNTOPT_BARRIER)) {
1673 args->flags |= XFSMNT_BARRIER;
1674 } else if (!strcmp(this_char, MNTOPT_NOBARRIER)) {
1675 args->flags &= ~XFSMNT_BARRIER;
1676 } else if (!strcmp(this_char, MNTOPT_IKEEP)) {
1677 ikeep = 1;
1678 args->flags &= ~XFSMNT_IDELETE;
1679 } else if (!strcmp(this_char, MNTOPT_NOIKEEP)) {
1680 args->flags |= XFSMNT_IDELETE;
1681 } else if (!strcmp(this_char, MNTOPT_LARGEIO)) {
1682 args->flags2 &= ~XFSMNT2_COMPAT_IOSIZE;
1683 } else if (!strcmp(this_char, MNTOPT_NOLARGEIO)) {
1684 args->flags2 |= XFSMNT2_COMPAT_IOSIZE;
1685 } else if (!strcmp(this_char, MNTOPT_ATTR2)) {
1686 args->flags |= XFSMNT_ATTR2;
1687 } else if (!strcmp(this_char, MNTOPT_NOATTR2)) {
1688 args->flags &= ~XFSMNT_ATTR2;
1689 } else if (!strcmp(this_char, MNTOPT_FILESTREAM)) {
1690 args->flags2 |= XFSMNT2_FILESTREAMS;
1691 } else if (!strcmp(this_char, MNTOPT_NOQUOTA)) {
1692 args->flags &= ~(XFSMNT_UQUOTAENF|XFSMNT_UQUOTA);
1693 args->flags &= ~(XFSMNT_GQUOTAENF|XFSMNT_GQUOTA);
1694 } else if (!strcmp(this_char, MNTOPT_QUOTA) ||
1695 !strcmp(this_char, MNTOPT_UQUOTA) ||
1696 !strcmp(this_char, MNTOPT_USRQUOTA)) {
1697 args->flags |= XFSMNT_UQUOTA | XFSMNT_UQUOTAENF;
1698 } else if (!strcmp(this_char, MNTOPT_QUOTANOENF) ||
1699 !strcmp(this_char, MNTOPT_UQUOTANOENF)) {
1700 args->flags |= XFSMNT_UQUOTA;
1701 args->flags &= ~XFSMNT_UQUOTAENF;
1702 } else if (!strcmp(this_char, MNTOPT_PQUOTA) ||
1703 !strcmp(this_char, MNTOPT_PRJQUOTA)) {
1704 args->flags |= XFSMNT_PQUOTA | XFSMNT_PQUOTAENF;
1705 } else if (!strcmp(this_char, MNTOPT_PQUOTANOENF)) {
1706 args->flags |= XFSMNT_PQUOTA;
1707 args->flags &= ~XFSMNT_PQUOTAENF;
1708 } else if (!strcmp(this_char, MNTOPT_GQUOTA) ||
1709 !strcmp(this_char, MNTOPT_GRPQUOTA)) {
1710 args->flags |= XFSMNT_GQUOTA | XFSMNT_GQUOTAENF;
1711 } else if (!strcmp(this_char, MNTOPT_GQUOTANOENF)) {
1712 args->flags |= XFSMNT_GQUOTA;
1713 args->flags &= ~XFSMNT_GQUOTAENF;
1714 } else if (!strcmp(this_char, MNTOPT_DMAPI)) {
1715 args->flags |= XFSMNT_DMAPI;
1716 } else if (!strcmp(this_char, MNTOPT_XDSM)) {
1717 args->flags |= XFSMNT_DMAPI;
1718 } else if (!strcmp(this_char, MNTOPT_DMI)) {
1719 args->flags |= XFSMNT_DMAPI;
1720 } else if (!strcmp(this_char, "ihashsize")) {
1721 cmn_err(CE_WARN,
1722 "XFS: ihashsize no longer used, option is deprecated.");
1723 } else if (!strcmp(this_char, "osyncisdsync")) {
1724 /* no-op, this is now the default */
1725 cmn_err(CE_WARN,
1726 "XFS: osyncisdsync is now the default, option is deprecated.");
1727 } else if (!strcmp(this_char, "irixsgid")) {
1728 cmn_err(CE_WARN,
1729 "XFS: irixsgid is now a sysctl(2) variable, option is deprecated.");
1730 } else {
1731 cmn_err(CE_WARN,
1732 "XFS: unknown mount option [%s].", this_char);
1733 return EINVAL;
1734 }
1735 }
1736
1737 if (args->flags & XFSMNT_NORECOVERY) {
1738 if ((mp->m_flags & XFS_MOUNT_RDONLY) == 0) {
1739 cmn_err(CE_WARN,
1740 "XFS: no-recovery mounts must be read-only.");
1741 return EINVAL;
1742 }
1743 }
1744
1745 if ((args->flags & XFSMNT_NOALIGN) && (dsunit || dswidth)) {
1746 cmn_err(CE_WARN,
1747 "XFS: sunit and swidth options incompatible with the noalign option");
1748 return EINVAL;
1749 }
1750
1751 if ((args->flags & XFSMNT_GQUOTA) && (args->flags & XFSMNT_PQUOTA)) {
1752 cmn_err(CE_WARN,
1753 "XFS: cannot mount with both project and group quota");
1754 return EINVAL;
1755 }
1756
1757 if ((args->flags & XFSMNT_DMAPI) && *args->mtpt == '\0') {
1758 printk("XFS: %s option needs the mount point option as well\n",
1759 MNTOPT_DMAPI);
1760 return EINVAL;
1761 }
1762
1763 if ((dsunit && !dswidth) || (!dsunit && dswidth)) {
1764 cmn_err(CE_WARN,
1765 "XFS: sunit and swidth must be specified together");
1766 return EINVAL;
1767 }
1768
1769 if (dsunit && (dswidth % dsunit != 0)) {
1770 cmn_err(CE_WARN,
1771 "XFS: stripe width (%d) must be a multiple of the stripe unit (%d)",
1772 dswidth, dsunit);
1773 return EINVAL;
1774 }
1775
1776 /*
1777 * Applications using DMI filesystems often expect the
1778 * inode generation number to be monotonically increasing.
1779 * If we delete inode chunks we break this assumption, so
1780 * keep unused inode chunks on disk for DMI filesystems
1781 * until we come up with a better solution.
1782 * Note that if "ikeep" or "noikeep" mount options are
1783 * supplied, then they are honored.
1784 */
1785 if (!(args->flags & XFSMNT_DMAPI) && !ikeep)
1786 args->flags |= XFSMNT_IDELETE;
1787
1788 if ((args->flags & XFSMNT_NOALIGN) != XFSMNT_NOALIGN) {
1789 if (dsunit) {
1790 args->sunit = dsunit;
1791 args->flags |= XFSMNT_RETERR;
1792 } else {
1793 args->sunit = vol_dsunit;
1794 }
1795 dswidth ? (args->swidth = dswidth) :
1796 (args->swidth = vol_dswidth);
1797 } else {
1798 args->sunit = args->swidth = 0;
1799 }
1800
1801done:
1802 if (args->flags & XFSMNT_32BITINODES)
1803 mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
1804 if (args->flags2)
1805 args->flags |= XFSMNT_FLAGS2;
1806 return 0;
1807}
1808
1809struct proc_xfs_info {
1810 int flag;
1811 char *str;
1812};
1813
1814int
1815xfs_showargs(
1816 struct xfs_mount *mp,
1817 struct seq_file *m)
1818{
1819 static struct proc_xfs_info xfs_info_set[] = {
1820 /* the few simple ones we can get from the mount struct */
1821 { XFS_MOUNT_WSYNC, "," MNTOPT_WSYNC },
1822 { XFS_MOUNT_INO64, "," MNTOPT_INO64 },
1823 { XFS_MOUNT_NOALIGN, "," MNTOPT_NOALIGN },
1824 { XFS_MOUNT_SWALLOC, "," MNTOPT_SWALLOC },
1825 { XFS_MOUNT_NOUUID, "," MNTOPT_NOUUID },
1826 { XFS_MOUNT_NORECOVERY, "," MNTOPT_NORECOVERY },
1827 { XFS_MOUNT_OSYNCISOSYNC, "," MNTOPT_OSYNCISOSYNC },
1828 { XFS_MOUNT_ATTR2, "," MNTOPT_ATTR2 },
1829 { XFS_MOUNT_FILESTREAMS, "," MNTOPT_FILESTREAM },
1830 { XFS_MOUNT_DMAPI, "," MNTOPT_DMAPI },
1831 { XFS_MOUNT_GRPID, "," MNTOPT_GRPID },
1832 { 0, NULL }
1833 };
1834 static struct proc_xfs_info xfs_info_unset[] = {
1835 /* the few simple ones we can get from the mount struct */
1836 { XFS_MOUNT_IDELETE, "," MNTOPT_IKEEP },
1837 { XFS_MOUNT_COMPAT_IOSIZE, "," MNTOPT_LARGEIO },
1838 { XFS_MOUNT_BARRIER, "," MNTOPT_NOBARRIER },
1839 { XFS_MOUNT_SMALL_INUMS, "," MNTOPT_64BITINODE },
1840 { 0, NULL }
1841 };
1842 struct proc_xfs_info *xfs_infop;
1843
1844 for (xfs_infop = xfs_info_set; xfs_infop->flag; xfs_infop++) {
1845 if (mp->m_flags & xfs_infop->flag)
1846 seq_puts(m, xfs_infop->str);
1847 }
1848 for (xfs_infop = xfs_info_unset; xfs_infop->flag; xfs_infop++) {
1849 if (!(mp->m_flags & xfs_infop->flag))
1850 seq_puts(m, xfs_infop->str);
1851 }
1852
1853 if (mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)
1854 seq_printf(m, "," MNTOPT_ALLOCSIZE "=%dk",
1855 (int)(1 << mp->m_writeio_log) >> 10);
1856
1857 if (mp->m_logbufs > 0)
1858 seq_printf(m, "," MNTOPT_LOGBUFS "=%d", mp->m_logbufs);
1859 if (mp->m_logbsize > 0)
1860 seq_printf(m, "," MNTOPT_LOGBSIZE "=%dk", mp->m_logbsize >> 10);
1861
1862 if (mp->m_logname)
1863 seq_printf(m, "," MNTOPT_LOGDEV "=%s", mp->m_logname);
1864 if (mp->m_rtname)
1865 seq_printf(m, "," MNTOPT_RTDEV "=%s", mp->m_rtname);
1866
1867 if (mp->m_dalign > 0)
1868 seq_printf(m, "," MNTOPT_SUNIT "=%d",
1869 (int)XFS_FSB_TO_BB(mp, mp->m_dalign));
1870 if (mp->m_swidth > 0)
1871 seq_printf(m, "," MNTOPT_SWIDTH "=%d",
1872 (int)XFS_FSB_TO_BB(mp, mp->m_swidth));
1873
1874 if (mp->m_qflags & (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD))
1875 seq_puts(m, "," MNTOPT_USRQUOTA);
1876 else if (mp->m_qflags & XFS_UQUOTA_ACCT)
1877 seq_puts(m, "," MNTOPT_UQUOTANOENF);
1878
1879 if (mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))
1880 seq_puts(m, "," MNTOPT_PRJQUOTA);
1881 else if (mp->m_qflags & XFS_PQUOTA_ACCT)
1882 seq_puts(m, "," MNTOPT_PQUOTANOENF);
1883
1884 if (mp->m_qflags & (XFS_GQUOTA_ACCT|XFS_OQUOTA_ENFD))
1885 seq_puts(m, "," MNTOPT_GRPQUOTA);
1886 else if (mp->m_qflags & XFS_GQUOTA_ACCT)
1887 seq_puts(m, "," MNTOPT_GQUOTANOENF);
1888
1889 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
1890 seq_puts(m, "," MNTOPT_NOQUOTA);
1891
1892 return 0;
1893}