Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge rsync://oss.sgi.com/git/xfs-2.6

+959 -1109
+77 -76
fs/xfs/linux-2.6/xfs_buf.c
··· 61 61 * File wide globals 62 62 */ 63 63 64 - STATIC kmem_cache_t *pagebuf_cache; 64 + STATIC kmem_cache_t *pagebuf_zone; 65 65 STATIC kmem_shaker_t pagebuf_shake; 66 - STATIC int pagebuf_daemon_wakeup(int, unsigned int); 66 + STATIC int xfsbufd_wakeup(int, unsigned int); 67 67 STATIC void pagebuf_delwri_queue(xfs_buf_t *, int); 68 - STATIC struct workqueue_struct *pagebuf_logio_workqueue; 69 - STATIC struct workqueue_struct *pagebuf_dataio_workqueue; 68 + 69 + STATIC struct workqueue_struct *xfslogd_workqueue; 70 + STATIC struct workqueue_struct *xfsdatad_workqueue; 70 71 71 72 /* 72 73 * Pagebuf debugging ··· 124 123 125 124 126 125 #define pagebuf_allocate(flags) \ 127 - kmem_zone_alloc(pagebuf_cache, pb_to_km(flags)) 126 + kmem_zone_alloc(pagebuf_zone, pb_to_km(flags)) 128 127 #define pagebuf_deallocate(pb) \ 129 - kmem_zone_free(pagebuf_cache, (pb)); 128 + kmem_zone_free(pagebuf_zone, (pb)); 130 129 131 130 /* 132 131 * Page Region interfaces. ··· 426 425 __FUNCTION__, gfp_mask); 427 426 428 427 XFS_STATS_INC(pb_page_retries); 429 - pagebuf_daemon_wakeup(0, gfp_mask); 428 + xfsbufd_wakeup(0, gfp_mask); 430 429 blk_congestion_wait(WRITE, HZ/50); 431 430 goto retry; 432 431 } ··· 1137 1136 if ((pb->pb_iodone) || (pb->pb_flags & PBF_ASYNC)) { 1138 1137 if (schedule) { 1139 1138 INIT_WORK(&pb->pb_iodone_work, pagebuf_iodone_work, pb); 1140 - queue_work(dataio ? pagebuf_dataio_workqueue : 1141 - pagebuf_logio_workqueue, &pb->pb_iodone_work); 1139 + queue_work(dataio ? xfsdatad_workqueue : 1140 + xfslogd_workqueue, &pb->pb_iodone_work); 1142 1141 } else { 1143 1142 pagebuf_iodone_work(pb); 1144 1143 } ··· 1563 1562 kmem_free(btp, sizeof(*btp)); 1564 1563 } 1565 1564 1566 - void 1567 - xfs_incore_relse( 1568 - xfs_buftarg_t *btp, 1569 - int delwri_only, 1570 - int wait) 1571 - { 1572 - invalidate_bdev(btp->pbr_bdev, 1); 1573 - truncate_inode_pages(btp->pbr_mapping, 0LL); 1574 - } 1575 - 1576 1565 STATIC int 1577 1566 xfs_setsize_buftarg_flags( 1578 1567 xfs_buftarg_t *btp, ··· 1733 1742 } 1734 1743 1735 1744 /* Defines for pagebuf daemon */ 1736 - STATIC DECLARE_COMPLETION(pagebuf_daemon_done); 1737 - STATIC struct task_struct *pagebuf_daemon_task; 1738 - STATIC int pagebuf_daemon_active; 1739 - STATIC int force_flush; 1740 - STATIC int force_sleep; 1745 + STATIC DECLARE_COMPLETION(xfsbufd_done); 1746 + STATIC struct task_struct *xfsbufd_task; 1747 + STATIC int xfsbufd_active; 1748 + STATIC int xfsbufd_force_flush; 1749 + STATIC int xfsbufd_force_sleep; 1741 1750 1742 1751 STATIC int 1743 - pagebuf_daemon_wakeup( 1752 + xfsbufd_wakeup( 1744 1753 int priority, 1745 1754 unsigned int mask) 1746 1755 { 1747 - if (force_sleep) 1756 + if (xfsbufd_force_sleep) 1748 1757 return 0; 1749 - force_flush = 1; 1758 + xfsbufd_force_flush = 1; 1750 1759 barrier(); 1751 - wake_up_process(pagebuf_daemon_task); 1760 + wake_up_process(xfsbufd_task); 1752 1761 return 0; 1753 1762 } 1754 1763 1755 1764 STATIC int 1756 - pagebuf_daemon( 1765 + xfsbufd( 1757 1766 void *data) 1758 1767 { 1759 1768 struct list_head tmp; ··· 1765 1774 daemonize("xfsbufd"); 1766 1775 current->flags |= PF_MEMALLOC; 1767 1776 1768 - pagebuf_daemon_task = current; 1769 - pagebuf_daemon_active = 1; 1777 + xfsbufd_task = current; 1778 + xfsbufd_active = 1; 1770 1779 barrier(); 1771 1780 1772 1781 INIT_LIST_HEAD(&tmp); 1773 1782 do { 1774 1783 if (unlikely(current->flags & PF_FREEZE)) { 1775 - force_sleep = 1; 1784 + xfsbufd_force_sleep = 1; 1776 1785 refrigerator(PF_FREEZE); 1777 1786 } else { 1778 - force_sleep = 0; 1787 + xfsbufd_force_sleep = 0; 1779 1788 } 1780 1789 1781 1790 set_current_state(TASK_INTERRUPTIBLE); ··· 1788 1797 ASSERT(pb->pb_flags & PBF_DELWRI); 1789 1798 1790 1799 if (!pagebuf_ispin(pb) && !pagebuf_cond_lock(pb)) { 1791 - if (!force_flush && 1800 + if (!xfsbufd_force_flush && 1792 1801 time_before(jiffies, 1793 1802 pb->pb_queuetime + age)) { 1794 1803 pagebuf_unlock(pb); ··· 1815 1824 if (as_list_len > 0) 1816 1825 purge_addresses(); 1817 1826 1818 - force_flush = 0; 1819 - } while (pagebuf_daemon_active); 1827 + xfsbufd_force_flush = 0; 1828 + } while (xfsbufd_active); 1820 1829 1821 - complete_and_exit(&pagebuf_daemon_done, 0); 1830 + complete_and_exit(&xfsbufd_done, 0); 1822 1831 } 1823 1832 1824 1833 /* ··· 1835 1844 xfs_buf_t *pb, *n; 1836 1845 int pincount = 0; 1837 1846 1838 - pagebuf_runall_queues(pagebuf_dataio_workqueue); 1839 - pagebuf_runall_queues(pagebuf_logio_workqueue); 1847 + pagebuf_runall_queues(xfsdatad_workqueue); 1848 + pagebuf_runall_queues(xfslogd_workqueue); 1840 1849 1841 1850 INIT_LIST_HEAD(&tmp); 1842 1851 spin_lock(&pbd_delwrite_lock); ··· 1889 1898 } 1890 1899 1891 1900 STATIC int 1892 - pagebuf_daemon_start(void) 1901 + xfs_buf_daemons_start(void) 1893 1902 { 1894 - int rval; 1903 + int error = -ENOMEM; 1895 1904 1896 - pagebuf_logio_workqueue = create_workqueue("xfslogd"); 1897 - if (!pagebuf_logio_workqueue) 1898 - return -ENOMEM; 1905 + xfslogd_workqueue = create_workqueue("xfslogd"); 1906 + if (!xfslogd_workqueue) 1907 + goto out; 1899 1908 1900 - pagebuf_dataio_workqueue = create_workqueue("xfsdatad"); 1901 - if (!pagebuf_dataio_workqueue) { 1902 - destroy_workqueue(pagebuf_logio_workqueue); 1903 - return -ENOMEM; 1904 - } 1909 + xfsdatad_workqueue = create_workqueue("xfsdatad"); 1910 + if (!xfsdatad_workqueue) 1911 + goto out_destroy_xfslogd_workqueue; 1905 1912 1906 - rval = kernel_thread(pagebuf_daemon, NULL, CLONE_FS|CLONE_FILES); 1907 - if (rval < 0) { 1908 - destroy_workqueue(pagebuf_logio_workqueue); 1909 - destroy_workqueue(pagebuf_dataio_workqueue); 1910 - } 1913 + error = kernel_thread(xfsbufd, NULL, CLONE_FS|CLONE_FILES); 1914 + if (error < 0) 1915 + goto out_destroy_xfsdatad_workqueue; 1916 + return 0; 1911 1917 1912 - return rval; 1918 + out_destroy_xfsdatad_workqueue: 1919 + destroy_workqueue(xfsdatad_workqueue); 1920 + out_destroy_xfslogd_workqueue: 1921 + destroy_workqueue(xfslogd_workqueue); 1922 + out: 1923 + return error; 1913 1924 } 1914 1925 1915 1926 /* 1916 - * pagebuf_daemon_stop 1917 - * 1918 1927 * Note: do not mark as __exit, it is called from pagebuf_terminate. 1919 1928 */ 1920 1929 STATIC void 1921 - pagebuf_daemon_stop(void) 1930 + xfs_buf_daemons_stop(void) 1922 1931 { 1923 - pagebuf_daemon_active = 0; 1932 + xfsbufd_active = 0; 1924 1933 barrier(); 1925 - wait_for_completion(&pagebuf_daemon_done); 1934 + wait_for_completion(&xfsbufd_done); 1926 1935 1927 - destroy_workqueue(pagebuf_logio_workqueue); 1928 - destroy_workqueue(pagebuf_dataio_workqueue); 1936 + destroy_workqueue(xfslogd_workqueue); 1937 + destroy_workqueue(xfsdatad_workqueue); 1929 1938 } 1930 1939 1931 1940 /* ··· 1935 1944 int __init 1936 1945 pagebuf_init(void) 1937 1946 { 1938 - pagebuf_cache = kmem_cache_create("xfs_buf_t", sizeof(xfs_buf_t), 0, 1939 - SLAB_HWCACHE_ALIGN, NULL, NULL); 1940 - if (pagebuf_cache == NULL) { 1941 - printk("XFS: couldn't init xfs_buf_t cache\n"); 1942 - pagebuf_terminate(); 1943 - return -ENOMEM; 1944 - } 1947 + int error = -ENOMEM; 1948 + 1949 + pagebuf_zone = kmem_zone_init(sizeof(xfs_buf_t), "xfs_buf"); 1950 + if (!pagebuf_zone) 1951 + goto out; 1945 1952 1946 1953 #ifdef PAGEBUF_TRACE 1947 1954 pagebuf_trace_buf = ktrace_alloc(PAGEBUF_TRACE_SIZE, KM_SLEEP); 1948 1955 #endif 1949 1956 1950 - pagebuf_daemon_start(); 1957 + error = xfs_buf_daemons_start(); 1958 + if (error) 1959 + goto out_free_buf_zone; 1951 1960 1952 - pagebuf_shake = kmem_shake_register(pagebuf_daemon_wakeup); 1953 - if (pagebuf_shake == NULL) { 1954 - pagebuf_terminate(); 1955 - return -ENOMEM; 1961 + pagebuf_shake = kmem_shake_register(xfsbufd_wakeup); 1962 + if (!pagebuf_shake) { 1963 + error = -ENOMEM; 1964 + goto out_stop_daemons; 1956 1965 } 1957 1966 1958 1967 return 0; 1968 + 1969 + out_stop_daemons: 1970 + xfs_buf_daemons_stop(); 1971 + out_free_buf_zone: 1972 + #ifdef PAGEBUF_TRACE 1973 + ktrace_free(pagebuf_trace_buf); 1974 + #endif 1975 + kmem_zone_destroy(pagebuf_zone); 1976 + out: 1977 + return error; 1959 1978 } 1960 1979 1961 1980 ··· 1977 1976 void 1978 1977 pagebuf_terminate(void) 1979 1978 { 1980 - pagebuf_daemon_stop(); 1979 + xfs_buf_daemons_stop(); 1981 1980 1982 1981 #ifdef PAGEBUF_TRACE 1983 1982 ktrace_free(pagebuf_trace_buf); 1984 1983 #endif 1985 1984 1986 - kmem_zone_destroy(pagebuf_cache); 1985 + kmem_zone_destroy(pagebuf_zone); 1987 1986 kmem_shake_deregister(pagebuf_shake); 1988 1987 }
-1
fs/xfs/linux-2.6/xfs_buf.h
··· 576 576 extern void xfs_free_buftarg(xfs_buftarg_t *, int); 577 577 extern void xfs_wait_buftarg(xfs_buftarg_t *); 578 578 extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int); 579 - extern void xfs_incore_relse(xfs_buftarg_t *, int, int); 580 579 extern int xfs_flush_buftarg(xfs_buftarg_t *, int); 581 580 582 581 #define xfs_getsize_buftarg(buftarg) \
+24 -3
fs/xfs/linux-2.6/xfs_file.c
··· 57 57 #include <linux/smp_lock.h> 58 58 59 59 static struct vm_operations_struct linvfs_file_vm_ops; 60 - 60 + #ifdef CONFIG_XFS_DMAPI 61 + static struct vm_operations_struct linvfs_dmapi_file_vm_ops; 62 + #endif 61 63 62 64 STATIC inline ssize_t 63 65 __linvfs_read( ··· 390 388 return -error; 391 389 } 392 390 391 + #ifdef CONFIG_XFS_DMAPI 392 + STATIC void 393 + linvfs_mmap_close( 394 + struct vm_area_struct *vma) 395 + { 396 + xfs_dm_mm_put(vma); 397 + } 398 + #endif /* CONFIG_XFS_DMAPI */ 393 399 394 400 STATIC int 395 401 linvfs_file_mmap( ··· 409 399 vattr_t va = { .va_mask = XFS_AT_UPDATIME }; 410 400 int error; 411 401 402 + vma->vm_ops = &linvfs_file_vm_ops; 403 + 412 404 if (vp->v_vfsp->vfs_flag & VFS_DMI) { 413 405 xfs_mount_t *mp = XFS_VFSTOM(vp->v_vfsp); 414 406 415 407 error = -XFS_SEND_MMAP(mp, vma, 0); 416 408 if (error) 417 409 return error; 410 + #ifdef CONFIG_XFS_DMAPI 411 + vma->vm_ops = &linvfs_dmapi_file_vm_ops; 412 + #endif 418 413 } 419 - 420 - vma->vm_ops = &linvfs_file_vm_ops; 421 414 422 415 VOP_SETATTR(vp, &va, XFS_AT_UPDATIME, NULL, error); 423 416 if (!error) ··· 622 609 static struct vm_operations_struct linvfs_file_vm_ops = { 623 610 .nopage = filemap_nopage, 624 611 .populate = filemap_populate, 612 + }; 613 + 614 + #ifdef CONFIG_XFS_DMAPI 615 + static struct vm_operations_struct linvfs_dmapi_file_vm_ops = { 616 + .close = linvfs_mmap_close, 617 + .nopage = filemap_nopage, 618 + .populate = filemap_populate, 625 619 #ifdef HAVE_VMOP_MPROTECT 626 620 .mprotect = linvfs_mprotect, 627 621 #endif 628 622 }; 623 + #endif /* CONFIG_XFS_DMAPI */
+8 -3
fs/xfs/linux-2.6/xfs_ioctl.c
··· 1174 1174 1175 1175 switch (cmd) { 1176 1176 case XFS_IOC_FSGETXATTR: { 1177 - va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_NEXTENTS; 1177 + va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \ 1178 + XFS_AT_NEXTENTS | XFS_AT_PROJID; 1178 1179 VOP_GETATTR(vp, &va, 0, NULL, error); 1179 1180 if (error) 1180 1181 return -error; ··· 1183 1182 fa.fsx_xflags = va.va_xflags; 1184 1183 fa.fsx_extsize = va.va_extsize; 1185 1184 fa.fsx_nextents = va.va_nextents; 1185 + fa.fsx_projid = va.va_projid; 1186 1186 1187 1187 if (copy_to_user(arg, &fa, sizeof(fa))) 1188 1188 return -XFS_ERROR(EFAULT); ··· 1198 1196 if (filp->f_flags & (O_NDELAY|O_NONBLOCK)) 1199 1197 attr_flags |= ATTR_NONBLOCK; 1200 1198 1201 - va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE; 1199 + va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | XFS_AT_PROJID; 1202 1200 va.va_xflags = fa.fsx_xflags; 1203 1201 va.va_extsize = fa.fsx_extsize; 1202 + va.va_projid = fa.fsx_projid; 1204 1203 1205 1204 VOP_SETATTR(vp, &va, attr_flags, NULL, error); 1206 1205 if (!error) ··· 1210 1207 } 1211 1208 1212 1209 case XFS_IOC_FSGETXATTRA: { 1213 - va.va_mask = XFS_AT_XFLAGS|XFS_AT_EXTSIZE|XFS_AT_ANEXTENTS; 1210 + va.va_mask = XFS_AT_XFLAGS | XFS_AT_EXTSIZE | \ 1211 + XFS_AT_ANEXTENTS | XFS_AT_PROJID; 1214 1212 VOP_GETATTR(vp, &va, 0, NULL, error); 1215 1213 if (error) 1216 1214 return -error; ··· 1219 1215 fa.fsx_xflags = va.va_xflags; 1220 1216 fa.fsx_extsize = va.va_extsize; 1221 1217 fa.fsx_nextents = va.va_anextents; 1218 + fa.fsx_projid = va.va_projid; 1222 1219 1223 1220 if (copy_to_user(arg, &fa, sizeof(fa))) 1224 1221 return -XFS_ERROR(EFAULT);
+4 -2
fs/xfs/linux-2.6/xfs_linux.h
··· 230 230 * field (see the QCMD macro in quota.h). These macros help keep the 231 231 * code portable - they are not visible from the syscall interface. 232 232 */ 233 - #define Q_XSETGQLIM XQM_CMD(0x8) /* set groups disk limits */ 234 - #define Q_XGETGQUOTA XQM_CMD(0x9) /* get groups disk limits */ 233 + #define Q_XSETGQLIM XQM_CMD(8) /* set groups disk limits */ 234 + #define Q_XGETGQUOTA XQM_CMD(9) /* get groups disk limits */ 235 + #define Q_XSETPQLIM XQM_CMD(10) /* set projects disk limits */ 236 + #define Q_XGETPQUOTA XQM_CMD(11) /* get projects disk limits */ 235 237 236 238 /* IRIX uses a dynamic sizing algorithm (ndquot = 200 + numprocs*2) */ 237 239 /* we may well need to fine-tune this if it ever becomes an issue. */
+8 -26
fs/xfs/linux-2.6/xfs_lrw.c
··· 209 209 return (-status); 210 210 } 211 211 212 - /* 213 - * xfs_inval_cached_pages 214 - * 215 - * This routine is responsible for keeping direct I/O and buffered I/O 216 - * somewhat coherent. From here we make sure that we're at least 217 - * temporarily holding the inode I/O lock exclusively and then call 218 - * the page cache to flush and invalidate any cached pages. If there 219 - * are no cached pages this routine will be very quick. 220 - */ 221 - void 222 - xfs_inval_cached_pages( 223 - vnode_t *vp, 224 - xfs_iocore_t *io, 225 - xfs_off_t offset, 226 - int write, 227 - int relock) 228 - { 229 - if (VN_CACHED(vp)) { 230 - xfs_inval_cached_trace(io, offset, -1, ctooff(offtoct(offset)), -1); 231 - VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(offset)), -1, FI_REMAPF_LOCKED); 232 - } 233 - 234 - } 235 - 236 212 ssize_t /* bytes read, or (-) error */ 237 213 xfs_read( 238 214 bhv_desc_t *bdp, ··· 280 304 if (DM_EVENT_ENABLED(vp->v_vfsp, ip, DM_EVENT_READ) && 281 305 !(ioflags & IO_INVIS)) { 282 306 vrwlock_t locktype = VRWLOCK_READ; 307 + int dmflags = FILP_DELAY_FLAG(file) | DM_SEM_FLAG_RD(ioflags); 283 308 284 309 ret = -XFS_SEND_DATA(mp, DM_EVENT_READ, 285 310 BHV_TO_VNODE(bdp), *offset, size, 286 - FILP_DELAY_FLAG(file), &locktype); 311 + dmflags, &locktype); 287 312 if (ret) { 288 313 xfs_iunlock(ip, XFS_IOLOCK_SHARED); 289 314 goto unlock_isem; ··· 844 867 !(ioflags & IO_INVIS)) { 845 868 846 869 xfs_rwunlock(bdp, locktype); 870 + if (need_isem) 871 + up(&inode->i_sem); 847 872 error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp, 848 873 DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL, 849 874 0, 0, 0); /* Delay flag intentionally unused */ 850 875 if (error) 851 - goto out_unlock_isem; 876 + goto out_nounlocks; 877 + if (need_isem) 878 + down(&inode->i_sem); 852 879 xfs_rwlock(bdp, locktype); 853 880 pos = xip->i_d.di_size; 854 881 ret = 0; ··· 967 986 out_unlock_isem: 968 987 if (need_isem) 969 988 up(&inode->i_sem); 989 + out_nounlocks: 970 990 return -error; 971 991 } 972 992
-2
fs/xfs/linux-2.6/xfs_lrw.h
··· 94 94 95 95 extern int xfs_zero_eof(struct vnode *, struct xfs_iocore *, xfs_off_t, 96 96 xfs_fsize_t, xfs_fsize_t); 97 - extern void xfs_inval_cached_pages(struct vnode *, struct xfs_iocore *, 98 - xfs_off_t, int, int); 99 97 extern ssize_t xfs_read(struct bhv_desc *, struct kiocb *, 100 98 const struct iovec *, unsigned int, 101 99 loff_t *, int, struct cred *);
+8 -4
fs/xfs/linux-2.6/xfs_super.c
··· 590 590 int error; 591 591 int flags = SYNC_FSDATA; 592 592 593 - if (wait) 594 - flags |= SYNC_WAIT; 593 + if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) 594 + flags = SYNC_QUIESCE; 595 + else 596 + flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); 595 597 596 598 VFS_SYNC(vfsp, flags, NULL, error); 597 599 sb->s_dirt = 0; ··· 703 701 struct vfs *vfsp = LINVFS_GET_VFS(sb); 704 702 int error, getmode; 705 703 706 - getmode = (type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETQUOTA; 704 + getmode = (type == USRQUOTA) ? Q_XGETQUOTA : 705 + ((type == GRPQUOTA) ? Q_XGETGQUOTA : Q_XGETPQUOTA); 707 706 VFS_QUOTACTL(vfsp, getmode, id, (caddr_t)fdq, error); 708 707 return -error; 709 708 } ··· 719 716 struct vfs *vfsp = LINVFS_GET_VFS(sb); 720 717 int error, setmode; 721 718 722 - setmode = (type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETQLIM; 719 + setmode = (type == USRQUOTA) ? Q_XSETQLIM : 720 + ((type == GRPQUOTA) ? Q_XSETGQLIM : Q_XSETPQLIM); 723 721 VFS_QUOTACTL(vfsp, setmode, id, (caddr_t)fdq, error); 724 722 return -error; 725 723 }
+1
fs/xfs/linux-2.6/xfs_vfs.h
··· 107 107 #define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */ 108 108 #define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */ 109 109 #define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */ 110 + #define SYNC_QUIESCE 0x0100 /* quiesce fileystem for a snapshot */ 110 111 111 112 typedef int (*vfs_mount_t)(bhv_desc_t *, 112 113 struct xfs_mount_args *, struct cred *);
+2 -2
fs/xfs/linux-2.6/xfs_vnode.c
··· 411 411 /* 0 */ (void *)(__psint_t)(vk), \ 412 412 /* 1 */ (void *)(s), \ 413 413 /* 2 */ (void *)(__psint_t) line, \ 414 - /* 3 */ (void *)(vn_count(vp)), \ 414 + /* 3 */ (void *)(__psint_t)(vn_count(vp)), \ 415 415 /* 4 */ (void *)(ra), \ 416 416 /* 5 */ (void *)(__psunsigned_t)(vp)->v_flag, \ 417 417 /* 6 */ (void *)(__psint_t)current_cpu(), \ 418 418 /* 7 */ (void *)(__psint_t)current_pid(), \ 419 419 /* 8 */ (void *)__return_address, \ 420 - /* 9 */ 0, 0, 0, 0, 0, 0, 0) 420 + /* 9 */ NULL, NULL, NULL, NULL, NULL, NULL, NULL) 421 421 422 422 /* 423 423 * Vnode tracing code.
+1 -1
fs/xfs/linux-2.6/xfs_vnode.h
··· 426 426 u_long va_extsize; /* file extent size */ 427 427 u_long va_nextents; /* number of extents in file */ 428 428 u_long va_anextents; /* number of attr extents in file */ 429 - int va_projid; /* project id */ 429 + prid_t va_projid; /* project id */ 430 430 } vattr_t; 431 431 432 432 /*
+26 -79
fs/xfs/quota/xfs_dquot.c
··· 101 101 * is the d_id field. The idea is to fill in the entire q_core 102 102 * when we read in the on disk dquot. 103 103 */ 104 - xfs_dquot_t * 104 + STATIC xfs_dquot_t * 105 105 xfs_qm_dqinit( 106 106 xfs_mount_t *mp, 107 107 xfs_dqid_t id, ··· 286 286 * We also return 0 as the values of the timers in Q_GETQUOTA calls, when 287 287 * enforcement's off. 288 288 * In contrast, warnings are a little different in that they don't 289 - * 'automatically' get started when limits get exceeded. 289 + * 'automatically' get started when limits get exceeded. They do 290 + * get reset to zero, however, when we find the count to be under 291 + * the soft limit (they are only ever set non-zero via userspace). 290 292 */ 291 293 void 292 294 xfs_qm_adjust_dqtimers( ··· 317 315 INT_GET(d->d_blk_hardlimit, ARCH_CONVERT)))) { 318 316 INT_SET(d->d_btimer, ARCH_CONVERT, 319 317 get_seconds() + XFS_QI_BTIMELIMIT(mp)); 318 + } else { 319 + d->d_bwarns = 0; 320 320 } 321 321 } else { 322 322 if ((!d->d_blk_softlimit || ··· 340 336 INT_GET(d->d_ino_hardlimit, ARCH_CONVERT)))) { 341 337 INT_SET(d->d_itimer, ARCH_CONVERT, 342 338 get_seconds() + XFS_QI_ITIMELIMIT(mp)); 339 + } else { 340 + d->d_iwarns = 0; 343 341 } 344 342 } else { 345 343 if ((!d->d_ino_softlimit || ··· 363 357 INT_GET(d->d_rtb_hardlimit, ARCH_CONVERT)))) { 364 358 INT_SET(d->d_rtbtimer, ARCH_CONVERT, 365 359 get_seconds() + XFS_QI_RTBTIMELIMIT(mp)); 360 + } else { 361 + d->d_rtbwarns = 0; 366 362 } 367 363 } else { 368 364 if ((!d->d_rtb_softlimit || ··· 377 369 } 378 370 } 379 371 } 380 - 381 - /* 382 - * Increment or reset warnings of a given dquot. 383 - */ 384 - int 385 - xfs_qm_dqwarn( 386 - xfs_disk_dquot_t *d, 387 - uint flags) 388 - { 389 - int warned; 390 - 391 - /* 392 - * root's limits are not real limits. 393 - */ 394 - if (!d->d_id) 395 - return (0); 396 - 397 - warned = 0; 398 - if (INT_GET(d->d_blk_softlimit, ARCH_CONVERT) && 399 - (INT_GET(d->d_bcount, ARCH_CONVERT) >= 400 - INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) { 401 - if (flags & XFS_QMOPT_DOWARN) { 402 - INT_MOD(d->d_bwarns, ARCH_CONVERT, +1); 403 - warned++; 404 - } 405 - } else { 406 - if (!d->d_blk_softlimit || 407 - (INT_GET(d->d_bcount, ARCH_CONVERT) < 408 - INT_GET(d->d_blk_softlimit, ARCH_CONVERT))) { 409 - d->d_bwarns = 0; 410 - } 411 - } 412 - 413 - if (INT_GET(d->d_ino_softlimit, ARCH_CONVERT) > 0 && 414 - (INT_GET(d->d_icount, ARCH_CONVERT) >= 415 - INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) { 416 - if (flags & XFS_QMOPT_DOWARN) { 417 - INT_MOD(d->d_iwarns, ARCH_CONVERT, +1); 418 - warned++; 419 - } 420 - } else { 421 - if (!d->d_ino_softlimit || 422 - (INT_GET(d->d_icount, ARCH_CONVERT) < 423 - INT_GET(d->d_ino_softlimit, ARCH_CONVERT))) { 424 - d->d_iwarns = 0; 425 - } 426 - } 427 - #ifdef QUOTADEBUG 428 - if (INT_GET(d->d_iwarns, ARCH_CONVERT)) 429 - cmn_err(CE_DEBUG, 430 - "--------@@Inode warnings running : %Lu >= %Lu", 431 - INT_GET(d->d_icount, ARCH_CONVERT), 432 - INT_GET(d->d_ino_softlimit, ARCH_CONVERT)); 433 - if (INT_GET(d->d_bwarns, ARCH_CONVERT)) 434 - cmn_err(CE_DEBUG, 435 - "--------@@Blks warnings running : %Lu >= %Lu", 436 - INT_GET(d->d_bcount, ARCH_CONVERT), 437 - INT_GET(d->d_blk_softlimit, ARCH_CONVERT)); 438 - #endif 439 - return (warned); 440 - } 441 - 442 372 443 373 /* 444 374 * initialize a buffer full of dquots and log the whole thing ··· 407 461 for (i = 0; i < XFS_QM_DQPERBLK(mp); i++, d++, curid++) 408 462 xfs_qm_dqinit_core(curid, type, d); 409 463 xfs_trans_dquot_buf(tp, bp, 410 - type & XFS_DQ_USER ? 411 - XFS_BLI_UDQUOT_BUF : 412 - XFS_BLI_GDQUOT_BUF); 464 + (type & XFS_DQ_USER ? XFS_BLI_UDQUOT_BUF : 465 + ((type & XFS_DQ_PROJ) ? XFS_BLI_PDQUOT_BUF : 466 + XFS_BLI_GDQUOT_BUF))); 413 467 xfs_trans_log_buf(tp, bp, 0, BBTOB(XFS_QI_DQCHUNKLEN(mp)) - 1); 414 468 } 415 469 ··· 490 544 * the entire thing. 491 545 */ 492 546 xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT), 493 - dqp->dq_flags & (XFS_DQ_USER|XFS_DQ_GROUP), 494 - bp); 547 + dqp->dq_flags & XFS_DQ_ALLTYPES, bp); 495 548 496 549 if ((error = xfs_bmap_finish(&tp, &flist, firstblock, &committed))) { 497 550 goto error1; ··· 620 675 /* 621 676 * A simple sanity check in case we got a corrupted dquot... 622 677 */ 623 - if (xfs_qm_dqcheck(ddq, id, 624 - dqp->dq_flags & (XFS_DQ_USER|XFS_DQ_GROUP), 678 + if (xfs_qm_dqcheck(ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES, 625 679 flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN), 626 680 "dqtobp")) { 627 681 if (!(flags & XFS_QMOPT_DQREPAIR)) { ··· 897 953 xfs_qm_dqget( 898 954 xfs_mount_t *mp, 899 955 xfs_inode_t *ip, /* locked inode (optional) */ 900 - xfs_dqid_t id, /* gid or uid, depending on type */ 901 - uint type, /* UDQUOT or GDQUOT */ 956 + xfs_dqid_t id, /* uid/projid/gid depending on type */ 957 + uint type, /* XFS_DQ_USER/XFS_DQ_PROJ/XFS_DQ_GROUP */ 902 958 uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */ 903 959 xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */ 904 960 { ··· 909 965 910 966 ASSERT(XFS_IS_QUOTA_RUNNING(mp)); 911 967 if ((! XFS_IS_UQUOTA_ON(mp) && type == XFS_DQ_USER) || 968 + (! XFS_IS_PQUOTA_ON(mp) && type == XFS_DQ_PROJ) || 912 969 (! XFS_IS_GQUOTA_ON(mp) && type == XFS_DQ_GROUP)) { 913 970 return (ESRCH); 914 971 } ··· 928 983 again: 929 984 930 985 #ifdef DEBUG 931 - ASSERT(type == XFS_DQ_USER || type == XFS_DQ_GROUP); 986 + ASSERT(type == XFS_DQ_USER || 987 + type == XFS_DQ_PROJ || 988 + type == XFS_DQ_GROUP); 932 989 if (ip) { 933 990 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip)); 934 991 if (type == XFS_DQ_USER) ··· 1253 1306 return (error); 1254 1307 } 1255 1308 1256 - if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT), 0, XFS_QMOPT_DOWARN, 1257 - "dqflush (incore copy)")) { 1309 + if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT), 1310 + 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) { 1258 1311 xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE); 1259 1312 return XFS_ERROR(EIO); 1260 1313 } ··· 1406 1459 { 1407 1460 if (d1 && d2) { 1408 1461 ASSERT(d1 != d2); 1409 - if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) > INT_GET(d2->q_core.d_id, ARCH_CONVERT)) { 1462 + if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) > 1463 + INT_GET(d2->q_core.d_id, ARCH_CONVERT)) { 1410 1464 xfs_dqlock(d2); 1411 1465 xfs_dqlock(d1); 1412 1466 } else { ··· 1530 1582 cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------"); 1531 1583 cmn_err(CE_DEBUG, "---- dquotID = %d", 1532 1584 (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); 1533 - cmn_err(CE_DEBUG, "---- type = %s", 1534 - XFS_QM_ISUDQ(dqp) ? "USR" : "GRP"); 1585 + cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp)); 1535 1586 cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount); 1536 1587 cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno); 1537 1588 cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset);
+12 -18
fs/xfs/quota/xfs_dquot.h
··· 114 114 #define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++) 115 115 116 116 /* 117 - * Quota Accounting flags 117 + * Quota Accounting/Enforcement flags 118 118 */ 119 - #define XFS_ALL_QUOTA_ACCT (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT) 120 - #define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_GQUOTA_ENFD) 121 - #define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_GQUOTA_CHKD) 122 - #define XFS_ALL_QUOTA_ACTV (XFS_UQUOTA_ACTIVE | XFS_GQUOTA_ACTIVE) 123 - #define XFS_ALL_QUOTA_ACCT_ENFD (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ 124 - XFS_GQUOTA_ACCT|XFS_GQUOTA_ENFD) 119 + #define XFS_ALL_QUOTA_ACCT \ 120 + (XFS_UQUOTA_ACCT | XFS_GQUOTA_ACCT | XFS_PQUOTA_ACCT) 121 + #define XFS_ALL_QUOTA_ENFD (XFS_UQUOTA_ENFD | XFS_OQUOTA_ENFD) 122 + #define XFS_ALL_QUOTA_CHKD (XFS_UQUOTA_CHKD | XFS_OQUOTA_CHKD) 125 123 126 - #define XFS_IS_QUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) 127 - #define XFS_IS_UQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT) 128 - #define XFS_IS_GQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT) 129 - 130 - /* 131 - * Quota Limit Enforcement flags 132 - */ 124 + #define XFS_IS_QUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ACCT) 133 125 #define XFS_IS_QUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_ALL_QUOTA_ENFD) 134 - #define XFS_IS_UQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_UQUOTA_ENFD) 135 - #define XFS_IS_GQUOTA_ENFORCED(mp) ((mp)->m_qflags & XFS_GQUOTA_ENFD) 126 + #define XFS_IS_UQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_UQUOTA_ACCT) 127 + #define XFS_IS_PQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_PQUOTA_ACCT) 128 + #define XFS_IS_GQUOTA_RUNNING(mp) ((mp)->m_qflags & XFS_GQUOTA_ACCT) 136 129 137 130 #ifdef DEBUG 138 131 static inline int ··· 160 167 #define XFS_DQ_IS_ON_FREELIST(dqp) ((dqp)->dq_flnext != (dqp)) 161 168 #define XFS_DQ_IS_DIRTY(dqp) ((dqp)->dq_flags & XFS_DQ_DIRTY) 162 169 #define XFS_QM_ISUDQ(dqp) ((dqp)->dq_flags & XFS_DQ_USER) 170 + #define XFS_QM_ISPDQ(dqp) ((dqp)->dq_flags & XFS_DQ_PROJ) 171 + #define XFS_QM_ISGDQ(dqp) ((dqp)->dq_flags & XFS_DQ_GROUP) 163 172 #define XFS_DQ_TO_QINF(dqp) ((dqp)->q_mount->m_quotainfo) 164 173 #define XFS_DQ_TO_QIP(dqp) (XFS_QM_ISUDQ(dqp) ? \ 165 174 XFS_DQ_TO_QINF(dqp)->qi_uquotaip : \ ··· 169 174 170 175 #define XFS_IS_THIS_QUOTA_OFF(d) (! (XFS_QM_ISUDQ(d) ? \ 171 176 (XFS_IS_UQUOTA_ON((d)->q_mount)) : \ 172 - (XFS_IS_GQUOTA_ON((d)->q_mount)))) 177 + (XFS_IS_OQUOTA_ON((d)->q_mount)))) 173 178 174 179 #ifdef XFS_DQUOT_TRACE 175 180 /* ··· 206 211 xfs_disk_dquot_t *); 207 212 extern void xfs_qm_adjust_dqlimits(xfs_mount_t *, 208 213 xfs_disk_dquot_t *); 209 - extern int xfs_qm_dqwarn(xfs_disk_dquot_t *, uint); 210 214 extern int xfs_qm_dqget(xfs_mount_t *, xfs_inode_t *, 211 215 xfs_dqid_t, uint, uint, xfs_dquot_t **); 212 216 extern void xfs_qm_dqput(xfs_dquot_t *);
+3 -3
fs/xfs/quota/xfs_dquot_item.c
··· 428 428 /* 429 429 * This is the ops vector for dquots 430 430 */ 431 - struct xfs_item_ops xfs_dquot_item_ops = { 431 + STATIC struct xfs_item_ops xfs_dquot_item_ops = { 432 432 .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_dquot_logitem_size, 433 433 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 434 434 xfs_qm_dquot_logitem_format, ··· 646 646 return; 647 647 } 648 648 649 - struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { 649 + STATIC struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { 650 650 .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_size, 651 651 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 652 652 xfs_qm_qoff_logitem_format, ··· 669 669 /* 670 670 * This is the ops vector shared by all quotaoff-start log items. 671 671 */ 672 - struct xfs_item_ops xfs_qm_qoff_logitem_ops = { 672 + STATIC struct xfs_item_ops xfs_qm_qoff_logitem_ops = { 673 673 .iop_size = (uint(*)(xfs_log_item_t*))xfs_qm_qoff_logitem_size, 674 674 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 675 675 xfs_qm_qoff_logitem_format,
+130 -72
fs/xfs/quota/xfs_qm.c
··· 81 81 82 82 kmem_zone_t *qm_dqzone; 83 83 kmem_zone_t *qm_dqtrxzone; 84 - kmem_shaker_t xfs_qm_shaker; 84 + STATIC kmem_shaker_t xfs_qm_shaker; 85 85 86 86 STATIC void xfs_qm_list_init(xfs_dqlist_t *, char *, int); 87 87 STATIC void xfs_qm_list_destroy(xfs_dqlist_t *); 88 88 89 + STATIC void xfs_qm_freelist_init(xfs_frlist_t *); 90 + STATIC void xfs_qm_freelist_destroy(xfs_frlist_t *); 91 + STATIC int xfs_qm_mplist_nowait(xfs_mount_t *); 92 + STATIC int xfs_qm_dqhashlock_nowait(xfs_dquot_t *); 93 + 89 94 STATIC int xfs_qm_init_quotainos(xfs_mount_t *); 95 + STATIC int xfs_qm_init_quotainfo(xfs_mount_t *); 90 96 STATIC int xfs_qm_shake(int, unsigned int); 91 97 92 98 #ifdef DEBUG ··· 190 184 /* 191 185 * Destroy the global quota manager when its reference count goes to zero. 192 186 */ 193 - void 187 + STATIC void 194 188 xfs_qm_destroy( 195 189 struct xfs_qm *xqm) 196 190 { ··· 310 304 uint flags) 311 305 { 312 306 /* 313 - * User or group quotas has to be on. 307 + * User, projects or group quotas has to be on. 314 308 */ 315 - ASSERT(flags & (XFSMNT_UQUOTA | XFSMNT_GQUOTA)); 309 + ASSERT(flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA)); 316 310 317 311 /* 318 312 * Initialize the flags in the mount structure. From this point ··· 330 324 if (flags & XFSMNT_GQUOTA) { 331 325 mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE); 332 326 if (flags & XFSMNT_GQUOTAENF) 333 - mp->m_qflags |= XFS_GQUOTA_ENFD; 327 + mp->m_qflags |= XFS_OQUOTA_ENFD; 328 + } else if (flags & XFSMNT_PQUOTA) { 329 + mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE); 330 + if (flags & XFSMNT_PQUOTAENF) 331 + mp->m_qflags |= XFS_OQUOTA_ENFD; 334 332 } 335 333 } 336 334 ··· 367 357 368 358 /* 369 359 * If a file system had quotas running earlier, but decided to 370 - * mount without -o quota/uquota/gquota options, revoke the 360 + * mount without -o uquota/pquota/gquota options, revoke the 371 361 * quotachecked license, and bail out. 372 362 */ 373 363 if (! XFS_IS_QUOTA_ON(mp) && 374 - (mp->m_sb.sb_qflags & (XFS_UQUOTA_ACCT|XFS_GQUOTA_ACCT))) { 364 + (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT)) { 375 365 mp->m_qflags = 0; 376 366 goto write_changes; 377 367 } ··· 519 509 * Flush all dquots of the given file system to disk. The dquots are 520 510 * _not_ purged from memory here, just their data written to disk. 521 511 */ 522 - int 512 + STATIC int 523 513 xfs_qm_dqflush_all( 524 514 xfs_mount_t *mp, 525 515 int flags) ··· 623 613 STATIC int 624 614 xfs_qm_dqpurge_int( 625 615 xfs_mount_t *mp, 626 - uint flags) /* QUOTAOFF/UMOUNTING/UQUOTA/GQUOTA */ 616 + uint flags) /* QUOTAOFF/UMOUNTING/UQUOTA/PQUOTA/GQUOTA */ 627 617 { 628 618 xfs_dquot_t *dqp; 629 619 uint dqtype; ··· 635 625 return (0); 636 626 637 627 dqtype = (flags & XFS_QMOPT_UQUOTA) ? XFS_DQ_USER : 0; 628 + dqtype |= (flags & XFS_QMOPT_PQUOTA) ? XFS_DQ_PROJ : 0; 638 629 dqtype |= (flags & XFS_QMOPT_GQUOTA) ? XFS_DQ_GROUP : 0; 639 630 640 631 xfs_qm_mplist_lock(mp); ··· 745 734 746 735 /* 747 736 * udqhint is the i_udquot field in inode, and is non-NULL only 748 - * when the type arg is XFS_DQ_GROUP. Its purpose is to save a 737 + * when the type arg is group/project. Its purpose is to save a 749 738 * lookup by dqid (xfs_qm_dqget) by caching a group dquot inside 750 739 * the user dquot. 751 740 */ 752 - ASSERT(!udqhint || type == XFS_DQ_GROUP); 741 + ASSERT(!udqhint || type == XFS_DQ_GROUP || type == XFS_DQ_PROJ); 753 742 if (udqhint && !dolock) 754 743 xfs_dqlock(udqhint); 755 744 ··· 908 897 909 898 910 899 /* 911 - * Given a locked inode, attach dquot(s) to it, taking UQUOTAON / GQUOTAON 912 - * in to account. 900 + * Given a locked inode, attach dquot(s) to it, taking U/G/P-QUOTAON 901 + * into account. 913 902 * If XFS_QMOPT_DQALLOC, the dquot(s) will be allocated if needed. 914 903 * If XFS_QMOPT_DQLOCK, the dquot(s) will be returned locked. This option pretty 915 904 * much made this code a complete mess, but it has been pretty useful. ··· 948 937 nquotas++; 949 938 } 950 939 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip)); 951 - if (XFS_IS_GQUOTA_ON(mp)) { 952 - error = xfs_qm_dqattach_one(ip, ip->i_d.di_gid, XFS_DQ_GROUP, 940 + if (XFS_IS_OQUOTA_ON(mp)) { 941 + error = XFS_IS_GQUOTA_ON(mp) ? 942 + xfs_qm_dqattach_one(ip, ip->i_d.di_gid, XFS_DQ_GROUP, 943 + flags & XFS_QMOPT_DQALLOC, 944 + flags & XFS_QMOPT_DQLOCK, 945 + ip->i_udquot, &ip->i_gdquot) : 946 + xfs_qm_dqattach_one(ip, ip->i_d.di_projid, XFS_DQ_PROJ, 953 947 flags & XFS_QMOPT_DQALLOC, 954 948 flags & XFS_QMOPT_DQLOCK, 955 949 ip->i_udquot, &ip->i_gdquot); ··· 1005 989 } 1006 990 if (XFS_IS_UQUOTA_ON(mp)) 1007 991 ASSERT(ip->i_udquot); 1008 - if (XFS_IS_GQUOTA_ON(mp)) 992 + if (XFS_IS_OQUOTA_ON(mp)) 1009 993 ASSERT(ip->i_gdquot); 1010 994 } 1011 995 #endif ··· 1034 1018 1035 1019 ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_uquotino); 1036 1020 ASSERT(ip->i_ino != ip->i_mount->m_sb.sb_gquotino); 1037 - if (ip->i_udquot) 1038 - xfs_dqtrace_entry_ino(ip->i_udquot, "DQDETTACH", ip); 1039 1021 if (ip->i_udquot) { 1022 + xfs_dqtrace_entry_ino(ip->i_udquot, "DQDETTACH", ip); 1040 1023 xfs_qm_dqrele(ip->i_udquot); 1041 1024 ip->i_udquot = NULL; 1042 1025 } 1043 1026 if (ip->i_gdquot) { 1027 + xfs_dqtrace_entry_ino(ip->i_gdquot, "DQDETTACH", ip); 1044 1028 xfs_qm_dqrele(ip->i_gdquot); 1045 1029 ip->i_gdquot = NULL; 1046 1030 } ··· 1165 1149 * This initializes all the quota information that's kept in the 1166 1150 * mount structure 1167 1151 */ 1168 - int 1152 + STATIC int 1169 1153 xfs_qm_init_quotainfo( 1170 1154 xfs_mount_t *mp) 1171 1155 { ··· 1218 1202 * and group quotas, at least not at this point. 1219 1203 */ 1220 1204 error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)0, 1221 - (XFS_IS_UQUOTA_RUNNING(mp)) ? 1222 - XFS_DQ_USER : XFS_DQ_GROUP, 1205 + XFS_IS_UQUOTA_RUNNING(mp) ? XFS_DQ_USER : 1206 + (XFS_IS_GQUOTA_RUNNING(mp) ? XFS_DQ_GROUP : 1207 + XFS_DQ_PROJ), 1223 1208 XFS_QMOPT_DQSUSER|XFS_QMOPT_DOWARN, 1224 1209 &dqp); 1225 1210 if (! error) { ··· 1251 1234 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) ? 1252 1235 INT_GET(ddqp->d_iwarns, ARCH_CONVERT) : 1253 1236 XFS_QM_IWARNLIMIT; 1237 + qinf->qi_rtbwarnlimit = 1238 + INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) ? 1239 + INT_GET(ddqp->d_rtbwarns, ARCH_CONVERT) : 1240 + XFS_QM_RTBWARNLIMIT; 1254 1241 qinf->qi_bhardlimit = 1255 1242 INT_GET(ddqp->d_blk_hardlimit, ARCH_CONVERT); 1256 1243 qinf->qi_bsoftlimit = ··· 1280 1259 qinf->qi_rtbtimelimit = XFS_QM_RTBTIMELIMIT; 1281 1260 qinf->qi_bwarnlimit = XFS_QM_BWARNLIMIT; 1282 1261 qinf->qi_iwarnlimit = XFS_QM_IWARNLIMIT; 1262 + qinf->qi_rtbwarnlimit = XFS_QM_RTBWARNLIMIT; 1283 1263 } 1284 1264 1285 1265 return (0); ··· 1388 1366 ASSERT(udqp); 1389 1367 } 1390 1368 1391 - if (XFS_IS_GQUOTA_ON(mp)) { 1369 + if (XFS_IS_OQUOTA_ON(mp)) { 1392 1370 ASSERT(ip->i_gdquot == NULL); 1393 1371 if (udqp) 1394 1372 xfs_dqunlock(udqp); 1395 - if ((error = xfs_qm_dqget(mp, ip, ip->i_d.di_gid, XFS_DQ_GROUP, 1396 - XFS_QMOPT_DQALLOC|XFS_QMOPT_DOWARN, 1397 - &gdqp))) { 1373 + error = XFS_IS_GQUOTA_ON(mp) ? 1374 + xfs_qm_dqget(mp, ip, 1375 + ip->i_d.di_gid, XFS_DQ_GROUP, 1376 + XFS_QMOPT_DQALLOC|XFS_QMOPT_DOWARN, 1377 + &gdqp) : 1378 + xfs_qm_dqget(mp, ip, 1379 + ip->i_d.di_projid, XFS_DQ_PROJ, 1380 + XFS_QMOPT_DQALLOC|XFS_QMOPT_DOWARN, 1381 + &gdqp); 1382 + if (error) { 1398 1383 if (udqp) 1399 1384 xfs_qm_dqrele(udqp); 1400 1385 ASSERT(error != ESRCH); ··· 1550 1521 INT_SET(ddq->d_rtbcount, ARCH_CONVERT, 0ULL); 1551 1522 INT_SET(ddq->d_btimer, ARCH_CONVERT, (time_t)0); 1552 1523 INT_SET(ddq->d_itimer, ARCH_CONVERT, (time_t)0); 1524 + INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, (time_t)0); 1553 1525 INT_SET(ddq->d_bwarns, ARCH_CONVERT, 0UL); 1554 1526 INT_SET(ddq->d_iwarns, ARCH_CONVERT, 0UL); 1527 + INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, 0UL); 1555 1528 ddq = (xfs_disk_dquot_t *) ((xfs_dqblk_t *)ddq + 1); 1556 1529 } 1557 1530 ··· 1572 1541 int error; 1573 1542 int notcommitted; 1574 1543 int incr; 1544 + int type; 1575 1545 1576 1546 ASSERT(blkcnt > 0); 1577 1547 notcommitted = 0; 1578 1548 incr = (blkcnt > XFS_QM_MAX_DQCLUSTER_LOGSZ) ? 1579 1549 XFS_QM_MAX_DQCLUSTER_LOGSZ : blkcnt; 1550 + type = flags & XFS_QMOPT_UQUOTA ? XFS_DQ_USER : 1551 + (flags & XFS_QMOPT_PQUOTA ? XFS_DQ_PROJ : XFS_DQ_GROUP); 1580 1552 error = 0; 1581 1553 1582 1554 /* ··· 1598 1564 if (error) 1599 1565 break; 1600 1566 1601 - (void) xfs_qm_reset_dqcounts(mp, bp, firstid, 1602 - flags & XFS_QMOPT_UQUOTA ? 1603 - XFS_DQ_USER : XFS_DQ_GROUP); 1567 + (void) xfs_qm_reset_dqcounts(mp, bp, firstid, type); 1604 1568 xfs_bdwrite(mp, bp); 1605 1569 /* 1606 1570 * goto the next block. ··· 1610 1578 } 1611 1579 1612 1580 /* 1613 - * Iterate over all allocated USR/GRP dquots in the system, calling a 1581 + * Iterate over all allocated USR/GRP/PRJ dquots in the system, calling a 1614 1582 * caller supplied function for every chunk of dquots that we find. 1615 1583 */ 1616 1584 STATIC int ··· 1881 1849 xfs_qm_quotacheck_dqadjust(udqp, nblks, rtblks); 1882 1850 xfs_qm_dqput(udqp); 1883 1851 } 1884 - if (XFS_IS_GQUOTA_ON(mp)) { 1852 + if (XFS_IS_OQUOTA_ON(mp)) { 1885 1853 ASSERT(gdqp); 1886 1854 xfs_qm_quotacheck_dqadjust(gdqp, nblks, rtblks); 1887 1855 xfs_qm_dqput(gdqp); ··· 1930 1898 cmn_err(CE_NOTE, "XFS quotacheck %s: Please wait.", mp->m_fsname); 1931 1899 1932 1900 /* 1933 - * First we go thru all the dquots on disk, USR and GRP, and reset 1901 + * First we go thru all the dquots on disk, USR and GRP/PRJ, and reset 1934 1902 * their counters to zero. We need a clean slate. 1935 1903 * We don't log our changes till later. 1936 1904 */ ··· 1941 1909 } 1942 1910 1943 1911 if ((gip = XFS_QI_GQIP(mp))) { 1944 - if ((error = xfs_qm_dqiterate(mp, gip, XFS_QMOPT_GQUOTA))) 1912 + if ((error = xfs_qm_dqiterate(mp, gip, XFS_IS_GQUOTA_ON(mp) ? 1913 + XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA))) 1945 1914 goto error_return; 1946 - flags |= XFS_GQUOTA_CHKD; 1915 + flags |= XFS_OQUOTA_CHKD; 1947 1916 } 1948 1917 1949 1918 do { ··· 1971 1938 if (error) { 1972 1939 xfs_qm_dqpurge_all(mp, 1973 1940 XFS_QMOPT_UQUOTA|XFS_QMOPT_GQUOTA| 1974 - XFS_QMOPT_QUOTAOFF); 1941 + XFS_QMOPT_PQUOTA|XFS_QMOPT_QUOTAOFF); 1975 1942 goto error_return; 1976 1943 } 1977 1944 /* ··· 1994 1961 * quotachecked status, since we won't be doing accounting for 1995 1962 * that type anymore. 1996 1963 */ 1997 - mp->m_qflags &= ~(XFS_GQUOTA_CHKD | XFS_UQUOTA_CHKD); 1964 + mp->m_qflags &= ~(XFS_OQUOTA_CHKD | XFS_UQUOTA_CHKD); 1998 1965 mp->m_qflags |= flags; 1999 1966 2000 1967 XQM_LIST_PRINT(&(XFS_QI_MPL_LIST(mp)), MPL_NEXT, "++++ Mp list +++"); ··· 2046 2013 0, 0, &uip, 0))) 2047 2014 return XFS_ERROR(error); 2048 2015 } 2049 - if (XFS_IS_GQUOTA_ON(mp) && 2016 + if (XFS_IS_OQUOTA_ON(mp) && 2050 2017 mp->m_sb.sb_gquotino != NULLFSINO) { 2051 2018 ASSERT(mp->m_sb.sb_gquotino > 0); 2052 2019 if ((error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, ··· 2076 2043 2077 2044 flags &= ~XFS_QMOPT_SBVERSION; 2078 2045 } 2079 - if (XFS_IS_GQUOTA_ON(mp) && gip == NULL) { 2080 - if ((error = xfs_qm_qino_alloc(mp, &gip, 2081 - sbflags | XFS_SB_GQUOTINO, 2082 - flags | XFS_QMOPT_GQUOTA))) { 2046 + if (XFS_IS_OQUOTA_ON(mp) && gip == NULL) { 2047 + flags |= (XFS_IS_GQUOTA_ON(mp) ? 2048 + XFS_QMOPT_GQUOTA : XFS_QMOPT_PQUOTA); 2049 + error = xfs_qm_qino_alloc(mp, &gip, 2050 + sbflags | XFS_SB_GQUOTINO, flags); 2051 + if (error) { 2083 2052 if (uip) 2084 2053 VN_RELE(XFS_ITOV(uip)); 2085 2054 ··· 2487 2452 xfs_inode_t *ip, 2488 2453 uid_t uid, 2489 2454 gid_t gid, 2455 + prid_t prid, 2490 2456 uint flags, 2491 2457 xfs_dquot_t **O_udqpp, 2492 2458 xfs_dquot_t **O_gdqpp) ··· 2519 2483 } 2520 2484 2521 2485 uq = gq = NULL; 2522 - if ((flags & XFS_QMOPT_UQUOTA) && 2523 - XFS_IS_UQUOTA_ON(mp)) { 2486 + if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) { 2524 2487 if (ip->i_d.di_uid != uid) { 2525 2488 /* 2526 2489 * What we need is the dquot that has this uid, and ··· 2557 2522 xfs_dqunlock(uq); 2558 2523 } 2559 2524 } 2560 - if ((flags & XFS_QMOPT_GQUOTA) && 2561 - XFS_IS_GQUOTA_ON(mp)) { 2525 + if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) { 2562 2526 if (ip->i_d.di_gid != gid) { 2563 2527 xfs_iunlock(ip, lockflags); 2564 2528 if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)gid, 2565 2529 XFS_DQ_GROUP, 2530 + XFS_QMOPT_DQALLOC | 2531 + XFS_QMOPT_DOWARN, 2532 + &gq))) { 2533 + if (uq) 2534 + xfs_qm_dqrele(uq); 2535 + ASSERT(error != ENOENT); 2536 + return (error); 2537 + } 2538 + xfs_dqunlock(gq); 2539 + lockflags = XFS_ILOCK_SHARED; 2540 + xfs_ilock(ip, lockflags); 2541 + } else { 2542 + ASSERT(ip->i_gdquot); 2543 + gq = ip->i_gdquot; 2544 + xfs_dqlock(gq); 2545 + XFS_DQHOLD(gq); 2546 + xfs_dqunlock(gq); 2547 + } 2548 + } else if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) { 2549 + if (ip->i_d.di_projid != prid) { 2550 + xfs_iunlock(ip, lockflags); 2551 + if ((error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)prid, 2552 + XFS_DQ_PROJ, 2566 2553 XFS_QMOPT_DQALLOC | 2567 2554 XFS_QMOPT_DOWARN, 2568 2555 &gq))) { ··· 2631 2574 xfs_dquot_t *newdq) 2632 2575 { 2633 2576 xfs_dquot_t *prevdq; 2577 + uint bfield = XFS_IS_REALTIME_INODE(ip) ? 2578 + XFS_TRANS_DQ_RTBCOUNT : XFS_TRANS_DQ_BCOUNT; 2579 + 2634 2580 ASSERT(XFS_ISLOCKED_INODE_EXCL(ip)); 2635 2581 ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount)); 2636 2582 ··· 2642 2582 ASSERT(prevdq); 2643 2583 ASSERT(prevdq != newdq); 2644 2584 2645 - xfs_trans_mod_dquot(tp, prevdq, 2646 - XFS_TRANS_DQ_BCOUNT, 2647 - -(ip->i_d.di_nblocks)); 2648 - xfs_trans_mod_dquot(tp, prevdq, 2649 - XFS_TRANS_DQ_ICOUNT, 2650 - -1); 2585 + xfs_trans_mod_dquot(tp, prevdq, bfield, -(ip->i_d.di_nblocks)); 2586 + xfs_trans_mod_dquot(tp, prevdq, XFS_TRANS_DQ_ICOUNT, -1); 2651 2587 2652 2588 /* the sparkling new dquot */ 2653 - xfs_trans_mod_dquot(tp, newdq, 2654 - XFS_TRANS_DQ_BCOUNT, 2655 - ip->i_d.di_nblocks); 2656 - xfs_trans_mod_dquot(tp, newdq, 2657 - XFS_TRANS_DQ_ICOUNT, 2658 - 1); 2589 + xfs_trans_mod_dquot(tp, newdq, bfield, ip->i_d.di_nblocks); 2590 + xfs_trans_mod_dquot(tp, newdq, XFS_TRANS_DQ_ICOUNT, 1); 2659 2591 2660 2592 /* 2661 2593 * Take an extra reference, because the inode ··· 2663 2611 } 2664 2612 2665 2613 /* 2666 - * Quota reservations for setattr(AT_UID|AT_GID). 2614 + * Quota reservations for setattr(AT_UID|AT_GID|AT_PROJID). 2667 2615 */ 2668 2616 int 2669 2617 xfs_qm_vop_chown_reserve( ··· 2675 2623 { 2676 2624 int error; 2677 2625 xfs_mount_t *mp; 2678 - uint delblks; 2626 + uint delblks, blkflags; 2679 2627 xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq; 2680 2628 2681 2629 ASSERT(XFS_ISLOCKED_INODE(ip)); ··· 2684 2632 2685 2633 delblks = ip->i_delayed_blks; 2686 2634 delblksudq = delblksgdq = unresudq = unresgdq = NULL; 2635 + blkflags = XFS_IS_REALTIME_INODE(ip) ? 2636 + XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS; 2687 2637 2688 2638 if (XFS_IS_UQUOTA_ON(mp) && udqp && 2689 2639 ip->i_d.di_uid != (uid_t)INT_GET(udqp->q_core.d_id, ARCH_CONVERT)) { ··· 2700 2646 unresudq = ip->i_udquot; 2701 2647 } 2702 2648 } 2703 - if (XFS_IS_GQUOTA_ON(ip->i_mount) && gdqp && 2704 - ip->i_d.di_gid != INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) { 2705 - delblksgdq = gdqp; 2706 - if (delblks) { 2707 - ASSERT(ip->i_gdquot); 2708 - unresgdq = ip->i_gdquot; 2649 + if (XFS_IS_OQUOTA_ON(ip->i_mount) && gdqp) { 2650 + if ((XFS_IS_GQUOTA_ON(ip->i_mount) && ip->i_d.di_gid != 2651 + INT_GET(gdqp->q_core.d_id, ARCH_CONVERT)) || 2652 + (XFS_IS_PQUOTA_ON(ip->i_mount) && ip->i_d.di_projid != 2653 + INT_GET(gdqp->q_core.d_id, ARCH_CONVERT))) { 2654 + delblksgdq = gdqp; 2655 + if (delblks) { 2656 + ASSERT(ip->i_gdquot); 2657 + unresgdq = ip->i_gdquot; 2658 + } 2709 2659 } 2710 2660 } 2711 2661 2712 2662 if ((error = xfs_trans_reserve_quota_bydquots(tp, ip->i_mount, 2713 2663 delblksudq, delblksgdq, ip->i_d.di_nblocks, 1, 2714 - flags | XFS_QMOPT_RES_REGBLKS))) 2664 + flags | blkflags))) 2715 2665 return (error); 2716 2666 2717 2667 /* ··· 2732 2674 ASSERT(unresudq || unresgdq); 2733 2675 if ((error = xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, 2734 2676 delblksudq, delblksgdq, (xfs_qcnt_t)delblks, 0, 2735 - flags | XFS_QMOPT_RES_REGBLKS))) 2677 + flags | blkflags))) 2736 2678 return (error); 2737 2679 xfs_trans_reserve_quota_bydquots(NULL, ip->i_mount, 2738 2680 unresudq, unresgdq, -((xfs_qcnt_t)delblks), 0, 2739 - XFS_QMOPT_RES_REGBLKS); 2681 + blkflags); 2740 2682 } 2741 2683 2742 2684 return (0); ··· 2809 2751 } 2810 2752 2811 2753 /* ------------- list stuff -----------------*/ 2812 - void 2754 + STATIC void 2813 2755 xfs_qm_freelist_init(xfs_frlist_t *ql) 2814 2756 { 2815 2757 ql->qh_next = ql->qh_prev = (xfs_dquot_t *) ql; ··· 2818 2760 ql->qh_nelems = 0; 2819 2761 } 2820 2762 2821 - void 2763 + STATIC void 2822 2764 xfs_qm_freelist_destroy(xfs_frlist_t *ql) 2823 2765 { 2824 2766 xfs_dquot_t *dqp, *nextdqp; ··· 2844 2786 ASSERT(ql->qh_nelems == 0); 2845 2787 } 2846 2788 2847 - void 2789 + STATIC void 2848 2790 xfs_qm_freelist_insert(xfs_frlist_t *ql, xfs_dquot_t *dq) 2849 2791 { 2850 2792 dq->dq_flnext = ql->qh_next; ··· 2874 2816 xfs_qm_freelist_insert((xfs_frlist_t *)ql->qh_prev, dq); 2875 2817 } 2876 2818 2877 - int 2819 + STATIC int 2878 2820 xfs_qm_dqhashlock_nowait( 2879 2821 xfs_dquot_t *dqp) 2880 2822 { ··· 2894 2836 return (locked); 2895 2837 } 2896 2838 2897 - int 2839 + STATIC int 2898 2840 xfs_qm_mplist_nowait( 2899 2841 xfs_mount_t *mp) 2900 2842 {
+6 -10
fs/xfs/quota/xfs_qm.h
··· 1 1 /* 2 - * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 2 + * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 3 3 * 4 4 * This program is free software; you can redistribute it and/or modify it 5 5 * under the terms of version 2 of the GNU General Public License as ··· 133 133 time_t qi_btimelimit; /* limit for blks timer */ 134 134 time_t qi_itimelimit; /* limit for inodes timer */ 135 135 time_t qi_rtbtimelimit;/* limit for rt blks timer */ 136 - xfs_qwarncnt_t qi_bwarnlimit; /* limit for num warnings */ 137 - xfs_qwarncnt_t qi_iwarnlimit; /* limit for num warnings */ 136 + xfs_qwarncnt_t qi_bwarnlimit; /* limit for blks warnings */ 137 + xfs_qwarncnt_t qi_iwarnlimit; /* limit for inodes warnings */ 138 + xfs_qwarncnt_t qi_rtbwarnlimit;/* limit for rt blks warnings */ 138 139 mutex_t qi_quotaofflock;/* to serialize quotaoff */ 139 140 xfs_filblks_t qi_dqchunklen; /* # BBs in a chunk of dqs */ 140 141 uint qi_dqperchunk; /* # ondisk dqs in above chunk */ ··· 177 176 178 177 #define XFS_QM_BWARNLIMIT 5 179 178 #define XFS_QM_IWARNLIMIT 5 179 + #define XFS_QM_RTBWARNLIMIT 5 180 180 181 181 #define XFS_QM_LOCK(xqm) (mutex_lock(&xqm##_lock, PINOD)) 182 182 #define XFS_QM_UNLOCK(xqm) (mutex_unlock(&xqm##_lock)) ··· 186 184 187 185 extern void xfs_mount_reset_sbqflags(xfs_mount_t *); 188 186 189 - extern int xfs_qm_init_quotainfo(xfs_mount_t *); 190 187 extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); 191 188 extern int xfs_qm_mount_quotas(xfs_mount_t *, int); 192 189 extern void xfs_qm_mount_quotainit(xfs_mount_t *, uint); ··· 204 203 205 204 /* vop stuff */ 206 205 extern int xfs_qm_vop_dqalloc(xfs_mount_t *, xfs_inode_t *, 207 - uid_t, gid_t, uint, 206 + uid_t, gid_t, prid_t, uint, 208 207 xfs_dquot_t **, xfs_dquot_t **); 209 208 extern void xfs_qm_vop_dqattach_and_dqmod_newinode( 210 209 xfs_trans_t *, xfs_inode_t *, ··· 216 215 xfs_dquot_t *, xfs_dquot_t *, uint); 217 216 218 217 /* list stuff */ 219 - extern void xfs_qm_freelist_init(xfs_frlist_t *); 220 - extern void xfs_qm_freelist_destroy(xfs_frlist_t *); 221 - extern void xfs_qm_freelist_insert(xfs_frlist_t *, xfs_dquot_t *); 222 218 extern void xfs_qm_freelist_append(xfs_frlist_t *, xfs_dquot_t *); 223 219 extern void xfs_qm_freelist_unlink(xfs_dquot_t *); 224 220 extern int xfs_qm_freelist_lock_nowait(xfs_qm_t *); 225 - extern int xfs_qm_mplist_nowait(xfs_mount_t *); 226 - extern int xfs_qm_dqhashlock_nowait(xfs_dquot_t *); 227 221 228 222 /* system call interface */ 229 223 extern int xfs_qm_quotactl(bhv_desc_t *, int, int, xfs_caddr_t);
+35 -8
fs/xfs/quota/xfs_qm_bhv.c
··· 71 71 #define MNTOPT_NOQUOTA "noquota" /* no quotas */ 72 72 #define MNTOPT_USRQUOTA "usrquota" /* user quota enabled */ 73 73 #define MNTOPT_GRPQUOTA "grpquota" /* group quota enabled */ 74 + #define MNTOPT_PRJQUOTA "prjquota" /* project quota enabled */ 74 75 #define MNTOPT_UQUOTA "uquota" /* user quota (IRIX variant) */ 75 76 #define MNTOPT_GQUOTA "gquota" /* group quota (IRIX variant) */ 77 + #define MNTOPT_PQUOTA "pquota" /* project quota (IRIX variant) */ 76 78 #define MNTOPT_UQUOTANOENF "uqnoenforce"/* user quota limit enforcement */ 77 79 #define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */ 80 + #define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */ 78 81 #define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */ 79 82 80 83 STATIC int ··· 112 109 args->flags |= XFSMNT_UQUOTA; 113 110 args->flags &= ~XFSMNT_UQUOTAENF; 114 111 referenced = 1; 112 + } else if (!strcmp(this_char, MNTOPT_PQUOTA) || 113 + !strcmp(this_char, MNTOPT_PRJQUOTA)) { 114 + args->flags |= XFSMNT_PQUOTA | XFSMNT_PQUOTAENF; 115 + referenced = 1; 116 + } else if (!strcmp(this_char, MNTOPT_PQUOTANOENF)) { 117 + args->flags |= XFSMNT_PQUOTA; 118 + args->flags &= ~XFSMNT_PQUOTAENF; 119 + referenced = 1; 115 120 } else if (!strcmp(this_char, MNTOPT_GQUOTA) || 116 121 !strcmp(this_char, MNTOPT_GRPQUOTA)) { 117 122 args->flags |= XFSMNT_GQUOTA | XFSMNT_GQUOTAENF; ··· 136 125 137 126 while (length--) 138 127 *this_char++ = ','; 128 + } 129 + 130 + if ((args->flags & XFSMNT_GQUOTA) && (args->flags & XFSMNT_PQUOTA)) { 131 + cmn_err(CE_WARN, 132 + "XFS: cannot mount with both project and group quota"); 133 + return XFS_ERROR(EINVAL); 139 134 } 140 135 141 136 PVFS_PARSEARGS(BHV_NEXT(bhv), options, args, update, error); ··· 165 148 seq_puts(m, "," MNTOPT_UQUOTANOENF); 166 149 } 167 150 151 + if (mp->m_qflags & XFS_PQUOTA_ACCT) { 152 + (mp->m_qflags & XFS_OQUOTA_ENFD) ? 153 + seq_puts(m, "," MNTOPT_PRJQUOTA) : 154 + seq_puts(m, "," MNTOPT_PQUOTANOENF); 155 + } 156 + 168 157 if (mp->m_qflags & XFS_GQUOTA_ACCT) { 169 - (mp->m_qflags & XFS_GQUOTA_ENFD) ? 158 + (mp->m_qflags & XFS_OQUOTA_ENFD) ? 170 159 seq_puts(m, "," MNTOPT_GRPQUOTA) : 171 160 seq_puts(m, "," MNTOPT_GQUOTANOENF); 172 161 } 173 162 174 - if (!(mp->m_qflags & (XFS_UQUOTA_ACCT|XFS_GQUOTA_ACCT))) 163 + if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) 175 164 seq_puts(m, "," MNTOPT_NOQUOTA); 176 165 177 166 PVFS_SHOWARGS(BHV_NEXT(bhv), m, error); ··· 194 171 struct xfs_mount *mp = XFS_VFSTOM(vfsp); 195 172 int error; 196 173 197 - if (args->flags & (XFSMNT_UQUOTA | XFSMNT_GQUOTA)) 174 + if (args->flags & (XFSMNT_UQUOTA | XFSMNT_GQUOTA | XFSMNT_PQUOTA)) 198 175 xfs_qm_mount_quotainit(mp, args->flags); 199 176 PVFS_MOUNT(BHV_NEXT(bhv), args, cr, error); 200 177 return error; ··· 278 255 uint *quotaflags) 279 256 { 280 257 uint quotaondisk; 281 - uint uquotaondisk = 0, gquotaondisk = 0; 258 + uint uquotaondisk = 0, gquotaondisk = 0, pquotaondisk = 0; 282 259 283 260 *quotaflags = 0; 284 261 *needquotamount = B_FALSE; 285 262 286 263 quotaondisk = XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && 287 - mp->m_sb.sb_qflags & (XFS_UQUOTA_ACCT|XFS_GQUOTA_ACCT); 264 + (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT); 288 265 289 266 if (quotaondisk) { 290 267 uquotaondisk = mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT; 268 + pquotaondisk = mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT; 291 269 gquotaondisk = mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT; 292 270 } 293 271 ··· 301 277 302 278 if (((uquotaondisk && !XFS_IS_UQUOTA_ON(mp)) || 303 279 (!uquotaondisk && XFS_IS_UQUOTA_ON(mp)) || 280 + (pquotaondisk && !XFS_IS_PQUOTA_ON(mp)) || 281 + (!pquotaondisk && XFS_IS_PQUOTA_ON(mp)) || 304 282 (gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) || 305 - (!gquotaondisk && XFS_IS_GQUOTA_ON(mp))) && 283 + (!gquotaondisk && XFS_IS_OQUOTA_ON(mp))) && 306 284 xfs_dev_is_read_only(mp, "changing quota state")) { 307 285 cmn_err(CE_WARN, 308 - "XFS: please mount with%s%s%s.", 286 + "XFS: please mount with%s%s%s%s.", 309 287 (!quotaondisk ? "out quota" : ""), 310 288 (uquotaondisk ? " usrquota" : ""), 289 + (pquotaondisk ? " prjquota" : ""), 311 290 (gquotaondisk ? " grpquota" : "")); 312 291 return XFS_ERROR(EPERM); 313 292 } ··· 386 359 } 387 360 388 361 389 - struct xfs_qmops xfs_qmcore_xfs = { 362 + STATIC struct xfs_qmops xfs_qmcore_xfs = { 390 363 .xfs_qminit = xfs_qm_newmount, 391 364 .xfs_qmdone = xfs_qm_unmount_quotadestroy, 392 365 .xfs_qmmount = xfs_qm_endmount,
+113 -62
fs/xfs/quota/xfs_qm_syscalls.c
··· 118 118 * The following commands are valid even when quotaoff. 119 119 */ 120 120 switch (cmd) { 121 + case Q_XQUOTARM: 121 122 /* 122 - * truncate quota files. quota must be off. 123 + * Truncate quota files. quota must be off. 123 124 */ 124 - case Q_XQUOTARM: 125 125 if (XFS_IS_QUOTA_ON(mp) || addr == NULL) 126 126 return XFS_ERROR(EINVAL); 127 127 if (vfsp->vfs_flag & VFS_RDONLY) 128 128 return XFS_ERROR(EROFS); 129 129 return (xfs_qm_scall_trunc_qfiles(mp, 130 130 xfs_qm_import_qtype_flags(*(uint *)addr))); 131 + 132 + case Q_XGETQSTAT: 131 133 /* 132 134 * Get quota status information. 133 135 */ 134 - case Q_XGETQSTAT: 135 136 return (xfs_qm_scall_getqstat(mp, (fs_quota_stat_t *)addr)); 136 137 138 + case Q_XQUOTAON: 137 139 /* 138 - * QUOTAON for root f/s and quota enforcement on others.. 139 - * Quota accounting for non-root f/s's must be turned on 140 - * at mount time. 140 + * QUOTAON - enabling quota enforcement. 141 + * Quota accounting must be turned on at mount time. 141 142 */ 142 - case Q_XQUOTAON: 143 143 if (addr == NULL) 144 144 return XFS_ERROR(EINVAL); 145 145 if (vfsp->vfs_flag & VFS_RDONLY) 146 146 return XFS_ERROR(EROFS); 147 147 return (xfs_qm_scall_quotaon(mp, 148 148 xfs_qm_import_flags(*(uint *)addr))); 149 - case Q_XQUOTAOFF: 149 + 150 + case Q_XQUOTAOFF: 150 151 if (vfsp->vfs_flag & VFS_RDONLY) 151 152 return XFS_ERROR(EROFS); 152 153 break; 153 154 154 - default: 155 + default: 155 156 break; 156 157 } 157 158 ··· 160 159 return XFS_ERROR(ESRCH); 161 160 162 161 switch (cmd) { 163 - case Q_XQUOTAOFF: 162 + case Q_XQUOTAOFF: 164 163 if (vfsp->vfs_flag & VFS_RDONLY) 165 164 return XFS_ERROR(EROFS); 166 165 error = xfs_qm_scall_quotaoff(mp, ··· 168 167 B_FALSE); 169 168 break; 170 169 171 - /* 172 - * Defaults to XFS_GETUQUOTA. 173 - */ 174 - case Q_XGETQUOTA: 170 + case Q_XGETQUOTA: 175 171 error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_USER, 176 172 (fs_disk_quota_t *)addr); 177 173 break; 178 - /* 179 - * Set limits, both hard and soft. Defaults to Q_SETUQLIM. 180 - */ 181 - case Q_XSETQLIM: 174 + case Q_XGETGQUOTA: 175 + error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, 176 + (fs_disk_quota_t *)addr); 177 + break; 178 + case Q_XGETPQUOTA: 179 + error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_PROJ, 180 + (fs_disk_quota_t *)addr); 181 + break; 182 + 183 + case Q_XSETQLIM: 182 184 if (vfsp->vfs_flag & VFS_RDONLY) 183 185 return XFS_ERROR(EROFS); 184 186 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER, 185 187 (fs_disk_quota_t *)addr); 186 188 break; 187 - 188 - case Q_XSETGQLIM: 189 + case Q_XSETGQLIM: 189 190 if (vfsp->vfs_flag & VFS_RDONLY) 190 191 return XFS_ERROR(EROFS); 191 192 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, 192 193 (fs_disk_quota_t *)addr); 193 194 break; 194 - 195 - 196 - case Q_XGETGQUOTA: 197 - error = xfs_qm_scall_getquota(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, 198 - (fs_disk_quota_t *)addr); 195 + case Q_XSETPQLIM: 196 + if (vfsp->vfs_flag & VFS_RDONLY) 197 + return XFS_ERROR(EROFS); 198 + error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ, 199 + (fs_disk_quota_t *)addr); 199 200 break; 200 201 201 - /* 202 - * Quotas are entirely undefined after quotaoff in XFS quotas. 203 - * For instance, there's no way to set limits when quotaoff. 204 - */ 205 - 206 - default: 202 + default: 207 203 error = XFS_ERROR(EINVAL); 208 204 break; 209 205 } ··· 284 286 } 285 287 if (flags & XFS_GQUOTA_ACCT) { 286 288 dqtype |= XFS_QMOPT_GQUOTA; 287 - flags |= (XFS_GQUOTA_CHKD | XFS_GQUOTA_ENFD); 289 + flags |= (XFS_OQUOTA_CHKD | XFS_OQUOTA_ENFD); 288 290 inactivate_flags |= XFS_GQUOTA_ACTIVE; 291 + } else if (flags & XFS_PQUOTA_ACCT) { 292 + dqtype |= XFS_QMOPT_PQUOTA; 293 + flags |= (XFS_OQUOTA_CHKD | XFS_OQUOTA_ENFD); 294 + inactivate_flags |= XFS_PQUOTA_ACTIVE; 289 295 } 290 296 291 297 /* ··· 366 364 /* 367 365 * If quotas is completely disabled, close shop. 368 366 */ 369 - if ((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_ALL) { 367 + if (((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET1) || 368 + ((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET2)) { 370 369 mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); 371 370 xfs_qm_destroy_quotainfo(mp); 372 371 return (0); ··· 381 378 XFS_PURGE_INODE(XFS_QI_UQIP(mp)); 382 379 XFS_QI_UQIP(mp) = NULL; 383 380 } 384 - if ((dqtype & XFS_QMOPT_GQUOTA) && XFS_QI_GQIP(mp)) { 381 + if ((dqtype & (XFS_QMOPT_GQUOTA|XFS_QMOPT_PQUOTA)) && XFS_QI_GQIP(mp)) { 385 382 XFS_PURGE_INODE(XFS_QI_GQIP(mp)); 386 383 XFS_QI_GQIP(mp) = NULL; 387 384 } ··· 414 411 } 415 412 } 416 413 417 - if ((flags & XFS_DQ_GROUP) && mp->m_sb.sb_gquotino != NULLFSINO) { 414 + if ((flags & (XFS_DQ_GROUP|XFS_DQ_PROJ)) && 415 + mp->m_sb.sb_gquotino != NULLFSINO) { 418 416 error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 0, 0, &qip, 0); 419 417 if (! error) { 420 418 (void) xfs_truncate_file(mp, qip); ··· 438 434 uint flags) 439 435 { 440 436 int error; 441 - unsigned long s; 437 + unsigned long s; 442 438 uint qf; 443 439 uint accflags; 444 440 __int64_t sbflags; ··· 472 468 (mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) == 0 && 473 469 (flags & XFS_UQUOTA_ENFD)) 474 470 || 471 + ((flags & XFS_PQUOTA_ACCT) == 0 && 472 + (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) == 0 && 473 + (flags & XFS_OQUOTA_ENFD)) 474 + || 475 475 ((flags & XFS_GQUOTA_ACCT) == 0 && 476 476 (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 && 477 - (flags & XFS_GQUOTA_ENFD))) { 477 + (flags & XFS_OQUOTA_ENFD))) { 478 478 qdprintk("Can't enforce without acct, flags=%x sbflags=%x\n", 479 479 flags, mp->m_sb.sb_qflags); 480 480 return XFS_ERROR(EINVAL); ··· 512 504 */ 513 505 if (((mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT) != 514 506 (mp->m_qflags & XFS_UQUOTA_ACCT)) || 507 + ((mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) != 508 + (mp->m_qflags & XFS_PQUOTA_ACCT)) || 509 + ((mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) != 510 + (mp->m_qflags & XFS_GQUOTA_ACCT)) || 515 511 (flags & XFS_ALL_QUOTA_ENFD) == 0) 516 512 return (0); 517 513 ··· 531 519 532 520 return (0); 533 521 } 534 - 535 522 536 523 537 524 /* ··· 617 606 if (!capable(CAP_SYS_ADMIN)) 618 607 return XFS_ERROR(EPERM); 619 608 620 - if ((newlim->d_fieldmask & (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK)) == 0) 609 + if ((newlim->d_fieldmask & 610 + (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK|FS_DQ_WARNS_MASK)) == 0) 621 611 return (0); 622 612 623 613 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM); ··· 703 691 qdprintk("ihard %Ld < isoft %Ld\n", hard, soft); 704 692 } 705 693 694 + /* 695 + * Update warnings counter(s) if requested 696 + */ 697 + if (newlim->d_fieldmask & FS_DQ_BWARNS) 698 + INT_SET(ddq->d_bwarns, ARCH_CONVERT, newlim->d_bwarns); 699 + if (newlim->d_fieldmask & FS_DQ_IWARNS) 700 + INT_SET(ddq->d_iwarns, ARCH_CONVERT, newlim->d_iwarns); 701 + if (newlim->d_fieldmask & FS_DQ_RTBWARNS) 702 + INT_SET(ddq->d_rtbwarns, ARCH_CONVERT, newlim->d_rtbwarns); 703 + 706 704 if (id == 0) { 707 705 /* 708 706 * Timelimits for the super user set the relative time 709 707 * the other users can be over quota for this file system. 710 708 * If it is zero a default is used. Ditto for the default 711 - * soft and hard limit values (already done, above). 709 + * soft and hard limit values (already done, above), and 710 + * for warnings. 712 711 */ 713 712 if (newlim->d_fieldmask & FS_DQ_BTIMER) { 714 713 mp->m_quotainfo->qi_btimelimit = newlim->d_btimer; ··· 733 710 mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer; 734 711 INT_SET(ddq->d_rtbtimer, ARCH_CONVERT, newlim->d_rtbtimer); 735 712 } 736 - } else /* if (XFS_IS_QUOTA_ENFORCED(mp)) */ { 713 + if (newlim->d_fieldmask & FS_DQ_BWARNS) 714 + mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns; 715 + if (newlim->d_fieldmask & FS_DQ_IWARNS) 716 + mp->m_quotainfo->qi_iwarnlimit = newlim->d_iwarns; 717 + if (newlim->d_fieldmask & FS_DQ_RTBWARNS) 718 + mp->m_quotainfo->qi_rtbwarnlimit = newlim->d_rtbwarns; 719 + } else { 737 720 /* 738 721 * If the user is now over quota, start the timelimit. 739 722 * The user will not be 'warned'. ··· 805 776 xfs_qoff_logitem_t *startqoff, 806 777 uint flags) 807 778 { 808 - xfs_trans_t *tp; 779 + xfs_trans_t *tp; 809 780 int error; 810 - xfs_qoff_logitem_t *qoffi; 781 + xfs_qoff_logitem_t *qoffi; 811 782 812 783 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QUOTAOFF_END); 813 784 ··· 957 928 958 929 STATIC uint 959 930 xfs_qm_import_qtype_flags( 960 - uint uflags) 931 + uint uflags) 961 932 { 933 + uint oflags = 0; 934 + 962 935 /* 963 - * Can't be both at the same time. 936 + * Can't be more than one, or none. 964 937 */ 965 938 if (((uflags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) == 966 - (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) || 967 - ((uflags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) == 0)) 939 + (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) || 940 + ((uflags & (XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) == 941 + (XFS_GROUP_QUOTA | XFS_PROJ_QUOTA)) || 942 + ((uflags & (XFS_USER_QUOTA | XFS_PROJ_QUOTA)) == 943 + (XFS_USER_QUOTA | XFS_PROJ_QUOTA)) || 944 + ((uflags & (XFS_GROUP_QUOTA|XFS_USER_QUOTA|XFS_PROJ_QUOTA)) == 0)) 968 945 return (0); 969 946 970 - return (uflags & XFS_USER_QUOTA) ? 971 - XFS_DQ_USER : XFS_DQ_GROUP; 947 + oflags |= (uflags & XFS_USER_QUOTA) ? XFS_DQ_USER : 0; 948 + oflags |= (uflags & XFS_PROJ_QUOTA) ? XFS_DQ_PROJ : 0; 949 + oflags |= (uflags & XFS_GROUP_QUOTA) ? XFS_DQ_GROUP: 0; 950 + return oflags; 972 951 } 973 952 974 953 STATIC uint ··· 984 947 uint flags) 985 948 { 986 949 /* 987 - * Can't be both at the same time. 950 + * Can't be more than one, or none. 988 951 */ 989 - ASSERT((flags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) != 990 - (XFS_GROUP_QUOTA | XFS_USER_QUOTA)); 991 - ASSERT((flags & (XFS_GROUP_QUOTA | XFS_USER_QUOTA)) != 0); 952 + ASSERT((flags & (XFS_PROJ_QUOTA | XFS_USER_QUOTA)) != 953 + (XFS_PROJ_QUOTA | XFS_USER_QUOTA)); 954 + ASSERT((flags & (XFS_PROJ_QUOTA | XFS_GROUP_QUOTA)) != 955 + (XFS_PROJ_QUOTA | XFS_GROUP_QUOTA)); 956 + ASSERT((flags & (XFS_USER_QUOTA | XFS_GROUP_QUOTA)) != 957 + (XFS_USER_QUOTA | XFS_GROUP_QUOTA)); 958 + ASSERT((flags & (XFS_PROJ_QUOTA|XFS_USER_QUOTA|XFS_GROUP_QUOTA)) != 0); 992 959 993 960 return (flags & XFS_DQ_USER) ? 994 - XFS_USER_QUOTA : XFS_GROUP_QUOTA; 961 + XFS_USER_QUOTA : (flags & XFS_DQ_PROJ) ? 962 + XFS_PROJ_QUOTA : XFS_GROUP_QUOTA; 995 963 } 996 964 997 965 STATIC uint ··· 1007 965 1008 966 if (uflags & XFS_QUOTA_UDQ_ACCT) 1009 967 flags |= XFS_UQUOTA_ACCT; 968 + if (uflags & XFS_QUOTA_PDQ_ACCT) 969 + flags |= XFS_PQUOTA_ACCT; 1010 970 if (uflags & XFS_QUOTA_GDQ_ACCT) 1011 971 flags |= XFS_GQUOTA_ACCT; 1012 972 if (uflags & XFS_QUOTA_UDQ_ENFD) 1013 973 flags |= XFS_UQUOTA_ENFD; 1014 - if (uflags & XFS_QUOTA_GDQ_ENFD) 1015 - flags |= XFS_GQUOTA_ENFD; 974 + if (uflags & (XFS_QUOTA_PDQ_ENFD|XFS_QUOTA_GDQ_ENFD)) 975 + flags |= XFS_OQUOTA_ENFD; 1016 976 return (flags); 1017 977 } 1018 978 ··· 1028 984 uflags = 0; 1029 985 if (flags & XFS_UQUOTA_ACCT) 1030 986 uflags |= XFS_QUOTA_UDQ_ACCT; 987 + if (flags & XFS_PQUOTA_ACCT) 988 + uflags |= XFS_QUOTA_PDQ_ACCT; 1031 989 if (flags & XFS_GQUOTA_ACCT) 1032 990 uflags |= XFS_QUOTA_GDQ_ACCT; 1033 991 if (flags & XFS_UQUOTA_ENFD) 1034 992 uflags |= XFS_QUOTA_UDQ_ENFD; 1035 - if (flags & XFS_GQUOTA_ENFD) 1036 - uflags |= XFS_QUOTA_GDQ_ENFD; 993 + if (flags & (XFS_OQUOTA_ENFD)) { 994 + uflags |= (flags & XFS_GQUOTA_ACCT) ? 995 + XFS_QUOTA_GDQ_ENFD : XFS_QUOTA_PDQ_ENFD; 996 + } 1037 997 return (uflags); 1038 998 } 1039 999 ··· 1118 1070 xfs_qm_dqrele(ip->i_udquot); 1119 1071 ip->i_udquot = NULL; 1120 1072 } 1121 - if ((flags & XFS_GQUOTA_ACCT) && ip->i_gdquot) { 1073 + if (flags & (XFS_PQUOTA_ACCT|XFS_GQUOTA_ACCT) && ip->i_gdquot) { 1122 1074 xfs_qm_dqrele(ip->i_gdquot); 1123 1075 ip->i_gdquot = NULL; 1124 1076 } ··· 1208 1160 { 1209 1161 cmn_err(CE_DEBUG, "-----------DQTEST DQUOT----------------"); 1210 1162 cmn_err(CE_DEBUG, "---- dquot ID = %d", d->d_id); 1211 - cmn_err(CE_DEBUG, "---- type = %s", XFS_QM_ISUDQ(d)? "USR" : "GRP"); 1212 1163 cmn_err(CE_DEBUG, "---- fs = 0x%p", d->q_mount); 1213 1164 cmn_err(CE_DEBUG, "---- bcount = %Lu (0x%x)", 1214 1165 d->d_bcount, (int)d->d_bcount); ··· 1278 1231 #ifdef QUOTADEBUG 1279 1232 if (!err) { 1280 1233 cmn_err(CE_DEBUG, "%d [%s] [0x%p] qchecked", 1281 - d->d_id, XFS_QM_ISUDQ(d) ? "USR" : "GRP", d->q_mount); 1234 + d->d_id, DQFLAGTO_TYPESTR(d), d->q_mount); 1282 1235 } 1283 1236 #endif 1284 1237 return (err); ··· 1334 1287 xfs_qm_internalqcheck_get_dquots( 1335 1288 xfs_mount_t *mp, 1336 1289 xfs_dqid_t uid, 1290 + xfs_dqid_t projid, 1337 1291 xfs_dqid_t gid, 1338 1292 xfs_dqtest_t **ud, 1339 1293 xfs_dqtest_t **gd) ··· 1343 1295 xfs_qm_internalqcheck_dqget(mp, uid, XFS_DQ_USER, ud); 1344 1296 if (XFS_IS_GQUOTA_ON(mp)) 1345 1297 xfs_qm_internalqcheck_dqget(mp, gid, XFS_DQ_GROUP, gd); 1298 + else if (XFS_IS_PQUOTA_ON(mp)) 1299 + xfs_qm_internalqcheck_dqget(mp, projid, XFS_DQ_PROJ, gd); 1346 1300 } 1347 1301 1348 1302 ··· 1412 1362 } 1413 1363 xfs_qm_internalqcheck_get_dquots(mp, 1414 1364 (xfs_dqid_t) ip->i_d.di_uid, 1365 + (xfs_dqid_t) ip->i_d.di_projid, 1415 1366 (xfs_dqid_t) ip->i_d.di_gid, 1416 1367 &ud, &gd); 1417 1368 if (XFS_IS_UQUOTA_ON(mp)) { 1418 1369 ASSERT(ud); 1419 1370 xfs_qm_internalqcheck_dqadjust(ip, ud); 1420 1371 } 1421 - if (XFS_IS_GQUOTA_ON(mp)) { 1372 + if (XFS_IS_OQUOTA_ON(mp)) { 1422 1373 ASSERT(gd); 1423 1374 xfs_qm_internalqcheck_dqadjust(ip, gd); 1424 1375 }
+6 -9
fs/xfs/quota/xfs_quota_priv.h
··· 56 56 #define XFS_QI_RTBTIMELIMIT(mp) ((mp)->m_quotainfo->qi_rtbtimelimit) 57 57 #define XFS_QI_ITIMELIMIT(mp) ((mp)->m_quotainfo->qi_itimelimit) 58 58 #define XFS_QI_BWARNLIMIT(mp) ((mp)->m_quotainfo->qi_bwarnlimit) 59 + #define XFS_QI_RTBWARNLIMIT(mp) ((mp)->m_quotainfo->qi_rtbwarnlimit) 59 60 #define XFS_QI_IWARNLIMIT(mp) ((mp)->m_quotainfo->qi_iwarnlimit) 60 61 #define XFS_QI_QOFFLOCK(mp) ((mp)->m_quotainfo->qi_quotaofflock) 61 62 ··· 103 102 (xfs_Gqm->qm_grp_dqhtable + \ 104 103 XFS_DQ_HASHVAL(mp, id))) 105 104 #define XFS_IS_DQTYPE_ON(mp, type) (type == XFS_DQ_USER ? \ 106 - XFS_IS_UQUOTA_ON(mp):XFS_IS_GQUOTA_ON(mp)) 105 + XFS_IS_UQUOTA_ON(mp) : \ 106 + XFS_IS_OQUOTA_ON(mp)) 107 107 #define XFS_IS_DQUOT_UNINITIALIZED(dqp) ( \ 108 108 !dqp->q_core.d_blk_hardlimit && \ 109 109 !dqp->q_core.d_blk_softlimit && \ ··· 179 177 (!((dqp)->q_core.d_id)) 180 178 181 179 #define XFS_PURGE_INODE(ip) \ 182 - { \ 183 - vmap_t dqvmap; \ 184 - vnode_t *dqvp; \ 185 - dqvp = XFS_ITOV(ip); \ 186 - VMAP(dqvp, dqvmap); \ 187 - VN_RELE(dqvp); \ 188 - } 180 + IRELE(ip); 189 181 190 182 #define DQFLAGTO_TYPESTR(d) (((d)->dq_flags & XFS_DQ_USER) ? "USR" : \ 191 - (((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : "???")) 183 + (((d)->dq_flags & XFS_DQ_GROUP) ? "GRP" : \ 184 + (((d)->dq_flags & XFS_DQ_PROJ) ? "PRJ":"???"))) 192 185 #define DQFLAGTO_DIRTYSTR(d) (XFS_DQ_IS_DIRTY(d) ? "DIRTY" : "NOTDIRTY") 193 186 194 187 #endif /* __XFS_QUOTA_PRIV_H__ */
+29 -31
fs/xfs/quota/xfs_trans_dquot.c
··· 187 187 /* 188 188 * Wrap around mod_dquot to account for both user and group quotas. 189 189 */ 190 - void 190 + STATIC void 191 191 xfs_trans_mod_dquot_byino( 192 192 xfs_trans_t *tp, 193 193 xfs_inode_t *ip, ··· 207 207 if (tp->t_dqinfo == NULL) 208 208 xfs_trans_alloc_dqinfo(tp); 209 209 210 - if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot) { 210 + if (XFS_IS_UQUOTA_ON(mp) && ip->i_udquot) 211 211 (void) xfs_trans_mod_dquot(tp, ip->i_udquot, field, delta); 212 - } 213 - if (XFS_IS_GQUOTA_ON(mp) && ip->i_gdquot) { 212 + if (XFS_IS_OQUOTA_ON(mp) && ip->i_gdquot) 214 213 (void) xfs_trans_mod_dquot(tp, ip->i_gdquot, field, delta); 215 - } 216 214 } 217 215 218 216 STATIC xfs_dqtrx_t * ··· 366 368 * Unreserve just the reservations done by this transaction. 367 369 * dquot is still left locked at exit. 368 370 */ 369 - void 371 + STATIC void 370 372 xfs_trans_apply_dquot_deltas( 371 373 xfs_trans_t *tp) 372 374 { ··· 497 499 * Adjust the RT reservation. 498 500 */ 499 501 if (qtrx->qt_rtblk_res != 0) { 500 - if (qtrx->qt_blk_res != qtrx->qt_blk_res_used) { 502 + if (qtrx->qt_rtblk_res != qtrx->qt_rtblk_res_used) { 501 503 if (qtrx->qt_rtblk_res > 502 504 qtrx->qt_rtblk_res_used) 503 505 dqp->q_res_rtbcount -= (xfs_qcnt_t) ··· 530 532 (xfs_qcnt_t)qtrx->qt_icount_delta; 531 533 } 532 534 533 - 534 - #ifdef QUOTADEBUG 535 - if (qtrx->qt_rtblk_res != 0) 536 - cmn_err(CE_DEBUG, "RT res %d for 0x%p\n", 537 - (int) qtrx->qt_rtblk_res, dqp); 538 - #endif 539 535 ASSERT(dqp->q_res_bcount >= 540 536 INT_GET(dqp->q_core.d_bcount, ARCH_CONVERT)); 541 537 ASSERT(dqp->q_res_icount >= ··· 630 638 int error; 631 639 xfs_qcnt_t hardlimit; 632 640 xfs_qcnt_t softlimit; 633 - time_t btimer; 641 + time_t timer; 642 + xfs_qwarncnt_t warns; 643 + xfs_qwarncnt_t warnlimit; 644 + xfs_qcnt_t count; 634 645 xfs_qcnt_t *resbcountp; 635 646 xfs_quotainfo_t *q = mp->m_quotainfo; 636 647 ··· 648 653 softlimit = INT_GET(dqp->q_core.d_blk_softlimit, ARCH_CONVERT); 649 654 if (!softlimit) 650 655 softlimit = q->qi_bsoftlimit; 651 - btimer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT); 656 + timer = INT_GET(dqp->q_core.d_btimer, ARCH_CONVERT); 657 + warns = INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT); 658 + warnlimit = XFS_QI_BWARNLIMIT(dqp->q_mount); 652 659 resbcountp = &dqp->q_res_bcount; 653 660 } else { 654 661 ASSERT(flags & XFS_TRANS_DQ_RES_RTBLKS); ··· 660 663 softlimit = INT_GET(dqp->q_core.d_rtb_softlimit, ARCH_CONVERT); 661 664 if (!softlimit) 662 665 softlimit = q->qi_rtbsoftlimit; 663 - btimer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT); 666 + timer = INT_GET(dqp->q_core.d_rtbtimer, ARCH_CONVERT); 667 + warns = INT_GET(dqp->q_core.d_rtbwarns, ARCH_CONVERT); 668 + warnlimit = XFS_QI_RTBWARNLIMIT(dqp->q_mount); 664 669 resbcountp = &dqp->q_res_rtbcount; 665 670 } 666 671 error = 0; ··· 692 693 * If timer or warnings has expired, 693 694 * return EDQUOT 694 695 */ 695 - if ((btimer != 0 && get_seconds() > btimer) || 696 - (dqp->q_core.d_bwarns && 697 - INT_GET(dqp->q_core.d_bwarns, ARCH_CONVERT) >= 698 - XFS_QI_BWARNLIMIT(dqp->q_mount))) { 696 + if ((timer != 0 && get_seconds() > timer) || 697 + (warns != 0 && warns >= warnlimit)) { 699 698 error = EDQUOT; 700 699 goto error_return; 701 700 } 702 701 } 703 702 } 704 703 if (ninos > 0) { 705 - hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit, ARCH_CONVERT); 704 + count = INT_GET(dqp->q_core.d_icount, ARCH_CONVERT); 705 + timer = INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT); 706 + warns = INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT); 707 + warnlimit = XFS_QI_IWARNLIMIT(dqp->q_mount); 708 + hardlimit = INT_GET(dqp->q_core.d_ino_hardlimit, 709 + ARCH_CONVERT); 706 710 if (!hardlimit) 707 711 hardlimit = q->qi_ihardlimit; 708 - softlimit = INT_GET(dqp->q_core.d_ino_softlimit, ARCH_CONVERT); 712 + softlimit = INT_GET(dqp->q_core.d_ino_softlimit, 713 + ARCH_CONVERT); 709 714 if (!softlimit) 710 715 softlimit = q->qi_isoftlimit; 711 - if (hardlimit > 0ULL && 712 - INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= hardlimit) { 716 + if (hardlimit > 0ULL && count >= hardlimit) { 713 717 error = EDQUOT; 714 718 goto error_return; 715 - } else if (softlimit > 0ULL && 716 - INT_GET(dqp->q_core.d_icount, ARCH_CONVERT) >= softlimit) { 719 + } else if (softlimit > 0ULL && count >= softlimit) { 717 720 /* 718 721 * If timer or warnings has expired, 719 722 * return EDQUOT 720 723 */ 721 - if ((dqp->q_core.d_itimer && 722 - get_seconds() > INT_GET(dqp->q_core.d_itimer, ARCH_CONVERT)) || 723 - (dqp->q_core.d_iwarns && 724 - INT_GET(dqp->q_core.d_iwarns, ARCH_CONVERT) >= 725 - XFS_QI_IWARNLIMIT(dqp->q_mount))) { 724 + if ((timer != 0 && get_seconds() > timer) || 725 + (warns != 0 && warns >= warnlimit)) { 726 726 error = EDQUOT; 727 727 goto error_return; 728 728 }
-1
fs/xfs/support/debug.c
··· 36 36 #include <linux/sched.h> 37 37 #include <linux/kernel.h> 38 38 39 - int doass = 1; 40 39 static char message[256]; /* keep it off the stack */ 41 40 static DEFINE_SPINLOCK(xfs_err_lock); 42 41
+1 -6
fs/xfs/support/debug.h
··· 50 50 #endif 51 51 52 52 #ifdef DEBUG 53 - # ifdef lint 54 - # define ASSERT(EX) ((void)0) /* avoid "constant in conditional" babble */ 55 - # else 56 - # define ASSERT(EX) ((!doass||(EX))?((void)0):assfail(#EX, __FILE__, __LINE__)) 57 - # endif /* lint */ 53 + # define ASSERT(EX) ((EX) ? ((void)0) : assfail(#EX, __FILE__, __LINE__)) 58 54 #else 59 55 # define ASSERT(x) ((void)0) 60 56 #endif 61 57 62 - extern int doass; /* dynamically turn off asserts */ 63 58 extern void assfail(char *, char *, int); 64 59 #ifdef DEBUG 65 60 extern unsigned long random(void);
+2 -2
fs/xfs/xfs_alloc.c
··· 59 59 #define XFSA_FIXUP_BNO_OK 1 60 60 #define XFSA_FIXUP_CNT_OK 2 61 61 62 - int 62 + STATIC int 63 63 xfs_alloc_search_busy(xfs_trans_t *tp, 64 64 xfs_agnumber_t agno, 65 65 xfs_agblock_t bno, ··· 2562 2562 /* 2563 2563 * returns non-zero if any of (agno,bno):len is in a busy list 2564 2564 */ 2565 - int 2565 + STATIC int 2566 2566 xfs_alloc_search_busy(xfs_trans_t *tp, 2567 2567 xfs_agnumber_t agno, 2568 2568 xfs_agblock_t bno,
+12 -5
fs/xfs/xfs_attr.c
··· 71 71 * Provide the external interfaces to manage attribute lists. 72 72 */ 73 73 74 + #define ATTR_SYSCOUNT 2 75 + STATIC struct attrnames posix_acl_access; 76 + STATIC struct attrnames posix_acl_default; 77 + STATIC struct attrnames *attr_system_names[ATTR_SYSCOUNT]; 78 + 74 79 /*======================================================================== 75 80 * Function prototypes for the kernel. 76 81 *========================================================================*/ ··· 88 83 /* 89 84 * Internal routines when attribute list is one block. 90 85 */ 86 + STATIC int xfs_attr_leaf_get(xfs_da_args_t *args); 91 87 STATIC int xfs_attr_leaf_addname(xfs_da_args_t *args); 92 88 STATIC int xfs_attr_leaf_removename(xfs_da_args_t *args); 93 89 STATIC int xfs_attr_leaf_list(xfs_attr_list_context_t *context); ··· 96 90 /* 97 91 * Internal routines when attribute list is more than one block. 98 92 */ 93 + STATIC int xfs_attr_node_get(xfs_da_args_t *args); 99 94 STATIC int xfs_attr_node_addname(xfs_da_args_t *args); 100 95 STATIC int xfs_attr_node_removename(xfs_da_args_t *args); 101 96 STATIC int xfs_attr_node_list(xfs_attr_list_context_t *context); ··· 1109 1102 * This leaf block cannot have a "remote" value, we only call this routine 1110 1103 * if bmap_one_block() says there is only one block (ie: no remote blks). 1111 1104 */ 1112 - int 1105 + STATIC int 1113 1106 xfs_attr_leaf_get(xfs_da_args_t *args) 1114 1107 { 1115 1108 xfs_dabuf_t *bp; ··· 1714 1707 * block, ie: both true Btree attr lists and for single-leaf-blocks with 1715 1708 * "remote" values taking up more blocks. 1716 1709 */ 1717 - int 1710 + STATIC int 1718 1711 xfs_attr_node_get(xfs_da_args_t *args) 1719 1712 { 1720 1713 xfs_da_state_t *state; ··· 2405 2398 return xfs_acl_vhasacl_default(vp); 2406 2399 } 2407 2400 2408 - struct attrnames posix_acl_access = { 2401 + STATIC struct attrnames posix_acl_access = { 2409 2402 .attr_name = "posix_acl_access", 2410 2403 .attr_namelen = sizeof("posix_acl_access") - 1, 2411 2404 .attr_get = posix_acl_access_get, ··· 2414 2407 .attr_exists = posix_acl_access_exists, 2415 2408 }; 2416 2409 2417 - struct attrnames posix_acl_default = { 2410 + STATIC struct attrnames posix_acl_default = { 2418 2411 .attr_name = "posix_acl_default", 2419 2412 .attr_namelen = sizeof("posix_acl_default") - 1, 2420 2413 .attr_get = posix_acl_default_get, ··· 2423 2416 .attr_exists = posix_acl_default_exists, 2424 2417 }; 2425 2418 2426 - struct attrnames *attr_system_names[] = 2419 + STATIC struct attrnames *attr_system_names[] = 2427 2420 { &posix_acl_access, &posix_acl_default }; 2428 2421 2429 2422
-7
fs/xfs/xfs_attr.h
··· 76 76 extern struct attrnames attr_trusted; 77 77 extern struct attrnames *attr_namespaces[ATTR_NAMECOUNT]; 78 78 79 - #define ATTR_SYSCOUNT 2 80 - extern struct attrnames posix_acl_access; 81 - extern struct attrnames posix_acl_default; 82 - extern struct attrnames *attr_system_names[ATTR_SYSCOUNT]; 83 - 84 79 extern attrnames_t *attr_lookup_namespace(char *, attrnames_t **, int); 85 80 extern int attr_generic_list(struct vnode *, void *, size_t, int, ssize_t *); 86 81 ··· 179 184 struct attrlist_cursor_kern *, struct cred *); 180 185 int xfs_attr_inactive(struct xfs_inode *dp); 181 186 182 - int xfs_attr_node_get(struct xfs_da_args *); 183 - int xfs_attr_leaf_get(struct xfs_da_args *); 184 187 int xfs_attr_shortform_getvalue(struct xfs_da_args *); 185 188 int xfs_attr_fetch(struct xfs_inode *, char *, int, 186 189 char *, int *, int, struct cred *);
+22 -6
fs/xfs/xfs_attr_leaf.c
··· 79 79 /* 80 80 * Routines used for growing the Btree. 81 81 */ 82 + STATIC int xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t which_block, 83 + xfs_dabuf_t **bpp); 82 84 STATIC int xfs_attr_leaf_add_work(xfs_dabuf_t *leaf_buffer, xfs_da_args_t *args, 83 85 int freemap_index); 84 86 STATIC void xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *leaf_buffer); ··· 94 92 int *number_usedbytes_in_blk1); 95 93 96 94 /* 95 + * Routines used for shrinking the Btree. 96 + */ 97 + STATIC int xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, 98 + xfs_dabuf_t *bp, int level); 99 + STATIC int xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, 100 + xfs_dabuf_t *bp); 101 + STATIC int xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp, 102 + xfs_dablk_t blkno, int blkcnt); 103 + 104 + /* 97 105 * Utility routines. 98 106 */ 99 107 STATIC void xfs_attr_leaf_moveents(xfs_attr_leafblock_t *src_leaf, ··· 111 99 xfs_attr_leafblock_t *dst_leaf, 112 100 int dst_start, int move_count, 113 101 xfs_mount_t *mp); 102 + STATIC int xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index); 103 + STATIC int xfs_attr_put_listent(xfs_attr_list_context_t *context, 104 + attrnames_t *, char *name, int namelen, 105 + int valuelen); 114 106 115 107 116 108 /*======================================================================== ··· 790 774 * Create the initial contents of a leaf attribute list 791 775 * or a leaf in a node attribute list. 792 776 */ 793 - int 777 + STATIC int 794 778 xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp) 795 779 { 796 780 xfs_attr_leafblock_t *leaf; ··· 2225 2209 * Calculate the number of bytes used to store the indicated attribute 2226 2210 * (whether local or remote only calculate bytes in this block). 2227 2211 */ 2228 - int 2212 + STATIC int 2229 2213 xfs_attr_leaf_entsize(xfs_attr_leafblock_t *leaf, int index) 2230 2214 { 2231 2215 xfs_attr_leaf_name_local_t *name_loc; ··· 2396 2380 * we may be reading them directly out of a user buffer. 2397 2381 */ 2398 2382 /*ARGSUSED*/ 2399 - int 2383 + STATIC int 2400 2384 xfs_attr_put_listent(xfs_attr_list_context_t *context, 2401 2385 attrnames_t *namesp, char *name, int namelen, int valuelen) 2402 2386 { ··· 2756 2740 * Recurse (gasp!) through the attribute nodes until we find leaves. 2757 2741 * We're doing a depth-first traversal in order to invalidate everything. 2758 2742 */ 2759 - int 2743 + STATIC int 2760 2744 xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp, 2761 2745 int level) 2762 2746 { ··· 2865 2849 * Note that we must release the lock on the buffer so that we are not 2866 2850 * caught holding something that the logging code wants to flush to disk. 2867 2851 */ 2868 - int 2852 + STATIC int 2869 2853 xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp) 2870 2854 { 2871 2855 xfs_attr_leafblock_t *leaf; ··· 2950 2934 * Look at all the extents for this logical region, 2951 2935 * invalidate any buffers that are incore/in transactions. 2952 2936 */ 2953 - int 2937 + STATIC int 2954 2938 xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp, 2955 2939 xfs_dablk_t blkno, int blkcnt) 2956 2940 {
-12
fs/xfs/xfs_attr_leaf.h
··· 261 261 /* 262 262 * Routines used for growing the Btree. 263 263 */ 264 - int xfs_attr_leaf_create(struct xfs_da_args *args, xfs_dablk_t which_block, 265 - struct xfs_dabuf **bpp); 266 264 int xfs_attr_leaf_split(struct xfs_da_state *state, 267 265 struct xfs_da_state_blk *oldblk, 268 266 struct xfs_da_state_blk *newblk); ··· 282 284 struct xfs_da_state_blk *drop_blk, 283 285 struct xfs_da_state_blk *save_blk); 284 286 int xfs_attr_root_inactive(struct xfs_trans **trans, struct xfs_inode *dp); 285 - int xfs_attr_node_inactive(struct xfs_trans **trans, struct xfs_inode *dp, 286 - struct xfs_dabuf *bp, int level); 287 - int xfs_attr_leaf_inactive(struct xfs_trans **trans, struct xfs_inode *dp, 288 - struct xfs_dabuf *bp); 289 - int xfs_attr_leaf_freextent(struct xfs_trans **trans, struct xfs_inode *dp, 290 - xfs_dablk_t blkno, int blkcnt); 291 287 292 288 /* 293 289 * Utility routines. ··· 291 299 struct xfs_dabuf *leaf2_bp); 292 300 int xfs_attr_leaf_newentsize(struct xfs_da_args *args, int blocksize, 293 301 int *local); 294 - int xfs_attr_leaf_entsize(struct xfs_attr_leafblock *leaf, int index); 295 - int xfs_attr_put_listent(struct xfs_attr_list_context *context, 296 - struct attrnames *, char *name, int namelen, 297 - int valuelen); 298 302 int xfs_attr_rolltrans(struct xfs_trans **transp, struct xfs_inode *dp); 299 303 300 304 #endif /* __XFS_ATTR_LEAF_H__ */
+1 -1
fs/xfs/xfs_bit.c
··· 45 45 /* 46 46 * Index of high bit number in byte, -1 for none set, 0..7 otherwise. 47 47 */ 48 - const char xfs_highbit[256] = { 48 + STATIC const char xfs_highbit[256] = { 49 49 -1, 0, 1, 1, 2, 2, 2, 2, /* 00 .. 07 */ 50 50 3, 3, 3, 3, 3, 3, 3, 3, /* 08 .. 0f */ 51 51 4, 4, 4, 4, 4, 4, 4, 4, /* 10 .. 17 */
+78 -49
fs/xfs/xfs_bmap.c
··· 301 301 xfs_bmbt_irec_t *gotp, /* out: extent entry found */ 302 302 xfs_bmbt_irec_t *prevp); /* out: previous extent entry found */ 303 303 304 + /* 305 + * Check the last inode extent to determine whether this allocation will result 306 + * in blocks being allocated at the end of the file. When we allocate new data 307 + * blocks at the end of the file which do not start at the previous data block, 308 + * we will try to align the new blocks at stripe unit boundaries. 309 + */ 310 + STATIC int /* error */ 311 + xfs_bmap_isaeof( 312 + xfs_inode_t *ip, /* incore inode pointer */ 313 + xfs_fileoff_t off, /* file offset in fsblocks */ 314 + int whichfork, /* data or attribute fork */ 315 + char *aeof); /* return value */ 316 + 304 317 #ifdef XFS_BMAP_TRACE 305 318 /* 306 319 * Add a bmap trace buffer entry. Base routine for the others. ··· 4545 4532 xfs_extlen_t alen; /* allocated extent length */ 4546 4533 xfs_fileoff_t aoff; /* allocated file offset */ 4547 4534 xfs_bmalloca_t bma; /* args for xfs_bmap_alloc */ 4548 - char contig; /* allocation must be one extent */ 4549 4535 xfs_btree_cur_t *cur; /* bmap btree cursor */ 4550 - char delay; /* this request is for delayed alloc */ 4551 4536 xfs_fileoff_t end; /* end of mapped file region */ 4552 4537 int eof; /* we've hit the end of extent list */ 4538 + char contig; /* allocation must be one extent */ 4539 + char delay; /* this request is for delayed alloc */ 4540 + char exact; /* don't do all of wasdelayed extent */ 4553 4541 xfs_bmbt_rec_t *ep; /* extent list entry pointer */ 4554 4542 int error; /* error return */ 4555 - char exact; /* don't do all of wasdelayed extent */ 4556 4543 xfs_bmbt_irec_t got; /* current extent list record */ 4557 4544 xfs_ifork_t *ifp; /* inode fork pointer */ 4558 4545 xfs_extlen_t indlen; /* indirect blocks length */ 4559 - char inhole; /* current location is hole in file */ 4560 4546 xfs_extnum_t lastx; /* last useful extent number */ 4561 4547 int logflags; /* flags for transaction logging */ 4562 4548 xfs_extlen_t minleft; /* min blocks left after allocation */ ··· 4566 4554 xfs_extnum_t nextents; /* number of extents in file */ 4567 4555 xfs_fileoff_t obno; /* old block number (offset) */ 4568 4556 xfs_bmbt_irec_t prev; /* previous extent list record */ 4569 - char stateless; /* ignore state flag set */ 4570 4557 int tmp_logflags; /* temp flags holder */ 4558 + int whichfork; /* data or attr fork */ 4559 + char inhole; /* current location is hole in file */ 4560 + char stateless; /* ignore state flag set */ 4571 4561 char trim; /* output trimmed to match range */ 4572 4562 char userdata; /* allocating non-metadata */ 4573 4563 char wasdelay; /* old extent was delayed */ 4574 - int whichfork; /* data or attr fork */ 4575 4564 char wr; /* this is a write request */ 4565 + char rt; /* this is a realtime file */ 4576 4566 char rsvd; /* OK to allocate reserved blocks */ 4577 4567 #ifdef DEBUG 4578 4568 xfs_fileoff_t orig_bno; /* original block number value */ ··· 4604 4590 } 4605 4591 if (XFS_FORCED_SHUTDOWN(mp)) 4606 4592 return XFS_ERROR(EIO); 4593 + rt = XFS_IS_REALTIME_INODE(ip); 4607 4594 ifp = XFS_IFORK_PTR(ip, whichfork); 4608 4595 ASSERT(ifp->if_ext_max == 4609 4596 XFS_IFORK_SIZE(ip, whichfork) / (uint)sizeof(xfs_bmbt_rec_t)); ··· 4709 4694 } 4710 4695 minlen = contig ? alen : 1; 4711 4696 if (delay) { 4712 - indlen = (xfs_extlen_t) 4713 - xfs_bmap_worst_indlen(ip, alen); 4714 - ASSERT(indlen > 0); 4697 + xfs_extlen_t extsz = 0; 4698 + 4699 + /* Figure out the extent size, adjust alen */ 4700 + if (rt) { 4701 + if (!(extsz = ip->i_d.di_extsize)) 4702 + extsz = mp->m_sb.sb_rextsize; 4703 + alen = roundup(alen, extsz); 4704 + extsz = alen / mp->m_sb.sb_rextsize; 4705 + } 4706 + 4715 4707 /* 4716 4708 * Make a transaction-less quota reservation for 4717 4709 * delayed allocation blocks. This number gets ··· 4726 4704 * We return EDQUOT if we haven't allocated 4727 4705 * blks already inside this loop; 4728 4706 */ 4729 - if (XFS_TRANS_RESERVE_BLKQUOTA( 4730 - mp, NULL, ip, (long)alen)) { 4707 + if (XFS_TRANS_RESERVE_QUOTA_NBLKS( 4708 + mp, NULL, ip, (long)alen, 0, 4709 + rt ? XFS_QMOPT_RES_RTBLKS : 4710 + XFS_QMOPT_RES_REGBLKS)) { 4731 4711 if (n == 0) { 4732 4712 *nmap = 0; 4733 4713 ASSERT(cur == NULL); ··· 4742 4718 * Split changing sb for alen and indlen since 4743 4719 * they could be coming from different places. 4744 4720 */ 4745 - if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) { 4746 - xfs_extlen_t extsz; 4747 - xfs_extlen_t ralen; 4748 - if (!(extsz = ip->i_d.di_extsize)) 4749 - extsz = mp->m_sb.sb_rextsize; 4750 - ralen = roundup(alen, extsz); 4751 - ralen = ralen / mp->m_sb.sb_rextsize; 4752 - if (xfs_mod_incore_sb(mp, 4753 - XFS_SBS_FREXTENTS, 4754 - -(ralen), rsvd)) { 4755 - if (XFS_IS_QUOTA_ON(ip->i_mount)) 4756 - XFS_TRANS_UNRESERVE_BLKQUOTA( 4757 - mp, NULL, ip, 4758 - (long)alen); 4759 - break; 4760 - } 4761 - } else { 4762 - if (xfs_mod_incore_sb(mp, 4763 - XFS_SBS_FDBLOCKS, 4764 - -(alen), rsvd)) { 4765 - if (XFS_IS_QUOTA_ON(ip->i_mount)) 4766 - XFS_TRANS_UNRESERVE_BLKQUOTA( 4767 - mp, NULL, ip, 4768 - (long)alen); 4769 - break; 4770 - } 4771 - } 4721 + indlen = (xfs_extlen_t) 4722 + xfs_bmap_worst_indlen(ip, alen); 4723 + ASSERT(indlen > 0); 4772 4724 4773 - if (xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS, 4774 - -(indlen), rsvd)) { 4775 - XFS_TRANS_UNRESERVE_BLKQUOTA( 4776 - mp, NULL, ip, (long)alen); 4725 + if (rt) 4726 + error = xfs_mod_incore_sb(mp, 4727 + XFS_SBS_FREXTENTS, 4728 + -(extsz), rsvd); 4729 + else 4730 + error = xfs_mod_incore_sb(mp, 4731 + XFS_SBS_FDBLOCKS, 4732 + -(alen), rsvd); 4733 + if (!error) 4734 + error = xfs_mod_incore_sb(mp, 4735 + XFS_SBS_FDBLOCKS, 4736 + -(indlen), rsvd); 4737 + 4738 + if (error) { 4739 + if (XFS_IS_QUOTA_ON(ip->i_mount)) 4740 + /* unreserve the blocks now */ 4741 + XFS_TRANS_UNRESERVE_QUOTA_NBLKS( 4742 + mp, NULL, ip, 4743 + (long)alen, 0, rt ? 4744 + XFS_QMOPT_RES_RTBLKS : 4745 + XFS_QMOPT_RES_REGBLKS); 4777 4746 break; 4778 4747 } 4748 + 4779 4749 ip->i_delayed_blks += alen; 4780 4750 abno = NULLSTARTBLOCK(indlen); 4781 4751 } else { ··· 5394 5376 } 5395 5377 if (wasdel) { 5396 5378 ASSERT(STARTBLOCKVAL(del.br_startblock) > 0); 5397 - xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS, 5398 - (int)del.br_blockcount, rsvd); 5399 - /* Unreserve our quota space */ 5400 - XFS_TRANS_RESERVE_QUOTA_NBLKS( 5401 - mp, NULL, ip, -((long)del.br_blockcount), 0, 5402 - isrt ? XFS_QMOPT_RES_RTBLKS : 5379 + /* Update realtim/data freespace, unreserve quota */ 5380 + if (isrt) { 5381 + xfs_filblks_t rtexts; 5382 + 5383 + rtexts = XFS_FSB_TO_B(mp, del.br_blockcount); 5384 + do_div(rtexts, mp->m_sb.sb_rextsize); 5385 + xfs_mod_incore_sb(mp, XFS_SBS_FREXTENTS, 5386 + (int)rtexts, rsvd); 5387 + XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, NULL, ip, 5388 + -((long)del.br_blockcount), 0, 5389 + XFS_QMOPT_RES_RTBLKS); 5390 + } else { 5391 + xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS, 5392 + (int)del.br_blockcount, rsvd); 5393 + XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, NULL, ip, 5394 + -((long)del.br_blockcount), 0, 5403 5395 XFS_QMOPT_RES_REGBLKS); 5396 + } 5404 5397 ip->i_delayed_blks -= del.br_blockcount; 5405 5398 if (cur) 5406 5399 cur->bc_private.b.flags |= ··· 5743 5714 * blocks at the end of the file which do not start at the previous data block, 5744 5715 * we will try to align the new blocks at stripe unit boundaries. 5745 5716 */ 5746 - int /* error */ 5717 + STATIC int /* error */ 5747 5718 xfs_bmap_isaeof( 5748 5719 xfs_inode_t *ip, /* incore inode pointer */ 5749 5720 xfs_fileoff_t off, /* file offset in fsblocks */
-13
fs/xfs/xfs_bmap.h
··· 332 332 int iflags); /* interface flags */ 333 333 334 334 /* 335 - * Check the last inode extent to determine whether this allocation will result 336 - * in blocks being allocated at the end of the file. When we allocate new data 337 - * blocks at the end of the file which do not start at the previous data block, 338 - * we will try to align the new blocks at stripe unit boundaries. 339 - */ 340 - int 341 - xfs_bmap_isaeof( 342 - struct xfs_inode *ip, 343 - xfs_fileoff_t off, 344 - int whichfork, 345 - char *aeof); 346 - 347 - /* 348 335 * Check if the endoff is outside the last extent. If so the caller will grow 349 336 * the allocation to a stripe unit boundary 350 337 */
-14
fs/xfs/xfs_bmap_btree.c
··· 2331 2331 return xfs_bmbt_lookup(cur, XFS_LOOKUP_GE, stat); 2332 2332 } 2333 2333 2334 - int /* error */ 2335 - xfs_bmbt_lookup_le( 2336 - xfs_btree_cur_t *cur, 2337 - xfs_fileoff_t off, 2338 - xfs_fsblock_t bno, 2339 - xfs_filblks_t len, 2340 - int *stat) /* success/failure */ 2341 - { 2342 - cur->bc_rec.b.br_startoff = off; 2343 - cur->bc_rec.b.br_startblock = bno; 2344 - cur->bc_rec.b.br_blockcount = len; 2345 - return xfs_bmbt_lookup(cur, XFS_LOOKUP_LE, stat); 2346 - } 2347 - 2348 2334 /* 2349 2335 * Give the bmap btree a new root block. Copy the old broot contents 2350 2336 * down into a real block and make the broot point to it.
-8
fs/xfs/xfs_bmap_btree.h
··· 580 580 xfs_filblks_t, 581 581 int *); 582 582 583 - int 584 - xfs_bmbt_lookup_le( 585 - struct xfs_btree_cur *, 586 - xfs_fileoff_t, 587 - xfs_fsblock_t, 588 - xfs_filblks_t, 589 - int *); 590 - 591 583 /* 592 584 * Give the bmap btree a new root block. Copy the old broot contents 593 585 * down into a real block and make the broot point to it.
+11 -1
fs/xfs/xfs_btree.c
··· 90 90 */ 91 91 92 92 /* 93 + * Retrieve the block pointer from the cursor at the given level. 94 + * This may be a bmap btree root or from a buffer. 95 + */ 96 + STATIC xfs_btree_block_t * /* generic btree block pointer */ 97 + xfs_btree_get_block( 98 + xfs_btree_cur_t *cur, /* btree cursor */ 99 + int level, /* level in btree */ 100 + struct xfs_buf **bpp); /* buffer containing the block */ 101 + 102 + /* 93 103 * Checking routine: return maxrecs for the block. 94 104 */ 95 105 STATIC int /* number of records fitting in block */ ··· 507 497 * Retrieve the block pointer from the cursor at the given level. 508 498 * This may be a bmap btree root or from a buffer. 509 499 */ 510 - xfs_btree_block_t * /* generic btree block pointer */ 500 + STATIC xfs_btree_block_t * /* generic btree block pointer */ 511 501 xfs_btree_get_block( 512 502 xfs_btree_cur_t *cur, /* btree cursor */ 513 503 int level, /* level in btree */
-10
fs/xfs/xfs_btree.h
··· 325 325 int level); /* level to change */ 326 326 327 327 /* 328 - * Retrieve the block pointer from the cursor at the given level. 329 - * This may be a bmap btree root or from a buffer. 330 - */ 331 - xfs_btree_block_t * /* generic btree block pointer */ 332 - xfs_btree_get_block( 333 - xfs_btree_cur_t *cur, /* btree cursor */ 334 - int level, /* level in btree */ 335 - struct xfs_buf **bpp); /* buffer containing the block */ 336 - 337 - /* 338 328 * Get a buffer for the block, return it with no data read. 339 329 * Long-form addressing. 340 330 */
+12 -12
fs/xfs/xfs_buf_item.c
··· 172 172 * 173 173 * If the XFS_BLI_STALE flag has been set, then log nothing. 174 174 */ 175 - uint 175 + STATIC uint 176 176 xfs_buf_item_size( 177 177 xfs_buf_log_item_t *bip) 178 178 { ··· 240 240 * format structure, and the rest point to contiguous chunks 241 241 * within the buffer. 242 242 */ 243 - void 243 + STATIC void 244 244 xfs_buf_item_format( 245 245 xfs_buf_log_item_t *bip, 246 246 xfs_log_iovec_t *log_vector) ··· 365 365 * item in memory so it cannot be written out. Simply call bpin() 366 366 * on the buffer to do this. 367 367 */ 368 - void 368 + STATIC void 369 369 xfs_buf_item_pin( 370 370 xfs_buf_log_item_t *bip) 371 371 { ··· 391 391 * If the XFS_BLI_STALE flag is set and we are the last reference, 392 392 * then free up the buf log item and unlock the buffer. 393 393 */ 394 - void 394 + STATIC void 395 395 xfs_buf_item_unpin( 396 396 xfs_buf_log_item_t *bip, 397 397 int stale) ··· 446 446 * so we need to free the item's descriptor (that points to the item) 447 447 * in the transaction. 448 448 */ 449 - void 449 + STATIC void 450 450 xfs_buf_item_unpin_remove( 451 451 xfs_buf_log_item_t *bip, 452 452 xfs_trans_t *tp) ··· 493 493 * the lock right away, return 0. If we can get the lock, pull the 494 494 * buffer from the free list, mark it busy, and return 1. 495 495 */ 496 - uint 496 + STATIC uint 497 497 xfs_buf_item_trylock( 498 498 xfs_buf_log_item_t *bip) 499 499 { ··· 537 537 * This is for support of xfs_trans_bhold(). Make sure the 538 538 * XFS_BLI_HOLD field is cleared if we don't free the item. 539 539 */ 540 - void 540 + STATIC void 541 541 xfs_buf_item_unlock( 542 542 xfs_buf_log_item_t *bip) 543 543 { ··· 635 635 * by returning the original lsn of that transaction here rather than 636 636 * the current one. 637 637 */ 638 - xfs_lsn_t 638 + STATIC xfs_lsn_t 639 639 xfs_buf_item_committed( 640 640 xfs_buf_log_item_t *bip, 641 641 xfs_lsn_t lsn) ··· 654 654 * and have aborted this transaction, we'll trap this buffer when it tries to 655 655 * get written out. 656 656 */ 657 - void 657 + STATIC void 658 658 xfs_buf_item_abort( 659 659 xfs_buf_log_item_t *bip) 660 660 { ··· 674 674 * B_DELWRI set, then get it going out to disk with a call to bawrite(). 675 675 * If not, then just release the buffer. 676 676 */ 677 - void 677 + STATIC void 678 678 xfs_buf_item_push( 679 679 xfs_buf_log_item_t *bip) 680 680 { ··· 693 693 } 694 694 695 695 /* ARGSUSED */ 696 - void 696 + STATIC void 697 697 xfs_buf_item_committing(xfs_buf_log_item_t *bip, xfs_lsn_t commit_lsn) 698 698 { 699 699 } ··· 701 701 /* 702 702 * This is the ops vector shared by all buf log items. 703 703 */ 704 - struct xfs_item_ops xfs_buf_item_ops = { 704 + STATIC struct xfs_item_ops xfs_buf_item_ops = { 705 705 .iop_size = (uint(*)(xfs_log_item_t*))xfs_buf_item_size, 706 706 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 707 707 xfs_buf_item_format,
+1 -1
fs/xfs/xfs_buf_item.h
··· 80 80 * user or group dquots and may require special recovery handling. 81 81 */ 82 82 #define XFS_BLI_UDQUOT_BUF 0x4 83 - /* #define XFS_BLI_PDQUOT_BUF 0x8 */ 83 + #define XFS_BLI_PDQUOT_BUF 0x8 84 84 #define XFS_BLI_GDQUOT_BUF 0x10 85 85 86 86 #define XFS_BLI_CHUNK 128
+6 -3
fs/xfs/xfs_da_btree.c
··· 113 113 STATIC uint xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count); 114 114 STATIC int xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp); 115 115 STATIC xfs_dabuf_t *xfs_da_buf_make(int nbuf, xfs_buf_t **bps, inst_t *ra); 116 - 116 + STATIC int xfs_da_blk_unlink(xfs_da_state_t *state, 117 + xfs_da_state_blk_t *drop_blk, 118 + xfs_da_state_blk_t *save_blk); 119 + STATIC void xfs_da_state_kill_altpath(xfs_da_state_t *state); 117 120 118 121 /*======================================================================== 119 122 * Routines used for growing the Btree. ··· 1427 1424 /* 1428 1425 * Unlink a block from a doubly linked list of blocks. 1429 1426 */ 1430 - int /* error */ 1427 + STATIC int /* error */ 1431 1428 xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, 1432 1429 xfs_da_state_blk_t *save_blk) 1433 1430 { ··· 2384 2381 /* 2385 2382 * Kill the altpath contents of a da-state structure. 2386 2383 */ 2387 - void 2384 + STATIC void 2388 2385 xfs_da_state_kill_altpath(xfs_da_state_t *state) 2389 2386 { 2390 2387 int i;
-3
fs/xfs/xfs_da_btree.h
··· 296 296 /* 297 297 * Utility routines. 298 298 */ 299 - int xfs_da_blk_unlink(xfs_da_state_t *state, xfs_da_state_blk_t *drop_blk, 300 - xfs_da_state_blk_t *save_blk); 301 299 int xfs_da_blk_link(xfs_da_state_t *state, xfs_da_state_blk_t *old_blk, 302 300 xfs_da_state_blk_t *new_blk); 303 301 ··· 318 320 uint xfs_da_log2_roundup(uint i); 319 321 xfs_da_state_t *xfs_da_state_alloc(void); 320 322 void xfs_da_state_free(xfs_da_state_t *state); 321 - void xfs_da_state_kill_altpath(xfs_da_state_t *state); 322 323 323 324 void xfs_da_buf_done(xfs_dabuf_t *dabuf); 324 325 void xfs_da_log_buf(struct xfs_trans *tp, xfs_dabuf_t *dabuf, uint first,
+4 -3
fs/xfs/xfs_dfrag.c
··· 180 180 goto error0; 181 181 } 182 182 183 - if (VN_CACHED(tvp) != 0) 184 - xfs_inval_cached_pages(XFS_ITOV(tip), &(tip->i_iocore), 185 - (xfs_off_t)0, 0, 0); 183 + if (VN_CACHED(tvp) != 0) { 184 + xfs_inval_cached_trace(&tip->i_iocore, 0, -1, 0, -1); 185 + VOP_FLUSHINVAL_PAGES(tvp, 0, -1, FI_REMAPF_LOCKED); 186 + } 186 187 187 188 /* Verify O_DIRECT for ftmp */ 188 189 if (VN_CACHED(tvp) != 0) {
+1 -1
fs/xfs/xfs_dir2_data.c
··· 304 304 /* 305 305 * Remove a bestfree entry from the table. 306 306 */ 307 - void 307 + STATIC void 308 308 xfs_dir2_data_freeremove( 309 309 xfs_dir2_data_t *d, /* data block pointer */ 310 310 xfs_dir2_data_free_t *dfp, /* bestfree entry pointer */
-4
fs/xfs/xfs_dir2_data.h
··· 193 193 xfs_dir2_data_unused_t *dup, int *loghead); 194 194 195 195 extern void 196 - xfs_dir2_data_freeremove(xfs_dir2_data_t *d, 197 - xfs_dir2_data_free_t *dfp, int *loghead); 198 - 199 - extern void 200 196 xfs_dir2_data_freescan(struct xfs_mount *mp, xfs_dir2_data_t *d, 201 197 int *loghead, char *aendp); 202 198
+6 -2
fs/xfs/xfs_dir2_leaf.c
··· 77 77 #endif 78 78 static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, xfs_dabuf_t **lbpp, 79 79 int *indexp, xfs_dabuf_t **dbpp); 80 + static void xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp, 81 + int first, int last); 82 + static void xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_dabuf *bp); 83 + 80 84 81 85 /* 82 86 * Convert a block form directory to a leaf form directory. ··· 1218 1214 /* 1219 1215 * Log the bests entries indicated from a leaf1 block. 1220 1216 */ 1221 - void 1217 + static void 1222 1218 xfs_dir2_leaf_log_bests( 1223 1219 xfs_trans_t *tp, /* transaction pointer */ 1224 1220 xfs_dabuf_t *bp, /* leaf buffer */ ··· 1282 1278 /* 1283 1279 * Log the tail of the leaf1 block. 1284 1280 */ 1285 - void 1281 + STATIC void 1286 1282 xfs_dir2_leaf_log_tail( 1287 1283 xfs_trans_t *tp, /* transaction pointer */ 1288 1284 xfs_dabuf_t *bp) /* leaf buffer */
-7
fs/xfs/xfs_dir2_leaf.h
··· 330 330 int first, int last); 331 331 332 332 extern void 333 - xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp, 334 - int first, int last); 335 - 336 - extern void 337 333 xfs_dir2_leaf_log_header(struct xfs_trans *tp, struct xfs_dabuf *bp); 338 - 339 - extern void 340 - xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_dabuf *bp); 341 334 342 335 extern int 343 336 xfs_dir2_leaf_lookup(struct xfs_da_args *args);
+5 -1
fs/xfs/xfs_dir_leaf.c
··· 91 91 int *number_entries_in_blk1, 92 92 int *number_namebytes_in_blk1); 93 93 94 + STATIC int xfs_dir_leaf_create(struct xfs_da_args *args, 95 + xfs_dablk_t which_block, 96 + struct xfs_dabuf **bpp); 97 + 94 98 /* 95 99 * Utility routines. 96 100 */ ··· 785 781 * Create the initial contents of a leaf directory 786 782 * or a leaf in a node directory. 787 783 */ 788 - int 784 + STATIC int 789 785 xfs_dir_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp) 790 786 { 791 787 xfs_dir_leafblock_t *leaf;
-2
fs/xfs/xfs_dir_leaf.h
··· 202 202 /* 203 203 * Routines used for growing the Btree. 204 204 */ 205 - int xfs_dir_leaf_create(struct xfs_da_args *args, xfs_dablk_t which_block, 206 - struct xfs_dabuf **bpp); 207 205 int xfs_dir_leaf_split(struct xfs_da_state *state, 208 206 struct xfs_da_state_blk *oldblk, 209 207 struct xfs_da_state_blk *newblk);
+12 -7
fs/xfs/xfs_dmapi.h
··· 166 166 #define DM_FLAGS_NDELAY 0x001 /* return EAGAIN after dm_pending() */ 167 167 #define DM_FLAGS_UNWANTED 0x002 /* event not in fsys dm_eventset_t */ 168 168 #define DM_FLAGS_ISEM 0x004 /* thread holds i_sem */ 169 - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) 170 - #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,21) 171 - /* i_alloc_sem was added in 2.4.22-pre1 */ 172 169 #define DM_FLAGS_IALLOCSEM_RD 0x010 /* thread holds i_alloc_sem rd */ 173 170 #define DM_FLAGS_IALLOCSEM_WR 0x020 /* thread holds i_alloc_sem wr */ 174 - #endif 175 - #endif 176 171 177 172 /* 178 173 * Based on IO_ISDIRECT, decide which i_ flag is set. 179 174 */ 180 - #ifdef DM_FLAGS_IALLOCSEM_RD 175 + #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) 176 + #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ 177 + DM_FLAGS_ISEM : 0) 178 + #define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM) 179 + #endif 180 + 181 + #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) && \ 182 + (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,22)) 181 183 #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ 182 184 DM_FLAGS_IALLOCSEM_RD : DM_FLAGS_ISEM) 183 185 #define DM_SEM_FLAG_WR (DM_FLAGS_IALLOCSEM_WR | DM_FLAGS_ISEM) 184 - #else 186 + #endif 187 + 188 + #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,21) 185 189 #define DM_SEM_FLAG_RD(ioflags) (((ioflags) & IO_ISDIRECT) ? \ 186 190 0 : DM_FLAGS_ISEM) 187 191 #define DM_SEM_FLAG_WR (DM_FLAGS_ISEM) 188 192 #endif 193 + 189 194 190 195 /* 191 196 * Macros to turn caller specified delay/block flags into
+1 -1
fs/xfs/xfs_error.c
··· 280 280 } 281 281 } 282 282 283 - void 283 + STATIC void 284 284 xfs_hex_dump(void *p, int length) 285 285 { 286 286 __uint8_t *uip = (__uint8_t*)p;
-3
fs/xfs/xfs_error.h
··· 73 73 int linenum, 74 74 inst_t *ra); 75 75 76 - extern void 77 - xfs_hex_dump(void *p, int length); 78 - 79 76 #define XFS_ERROR_REPORT(e, lvl, mp) \ 80 77 xfs_error_report(e, lvl, mp, __FILE__, __LINE__, __return_address) 81 78 #define XFS_CORRUPTION_ERROR(e, lvl, mp, mem) \
+32 -94
fs/xfs/xfs_extfree_item.c
··· 59 59 STATIC void xfs_efd_item_abort(xfs_efd_log_item_t *); 60 60 61 61 62 + void 63 + xfs_efi_item_free(xfs_efi_log_item_t *efip) 64 + { 65 + int nexts = efip->efi_format.efi_nextents; 66 + 67 + if (nexts > XFS_EFI_MAX_FAST_EXTENTS) { 68 + kmem_free(efip, sizeof(xfs_efi_log_item_t) + 69 + (nexts - 1) * sizeof(xfs_extent_t)); 70 + } else { 71 + kmem_zone_free(xfs_efi_zone, efip); 72 + } 73 + } 62 74 63 75 /* 64 76 * This returns the number of iovecs needed to log the given efi item. ··· 132 120 STATIC void 133 121 xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale) 134 122 { 135 - int nexts; 136 - int size; 137 123 xfs_mount_t *mp; 138 124 SPLDECL(s); 139 125 ··· 142 132 * xfs_trans_delete_ail() drops the AIL lock. 143 133 */ 144 134 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s); 145 - 146 - nexts = efip->efi_format.efi_nextents; 147 - if (nexts > XFS_EFI_MAX_FAST_EXTENTS) { 148 - size = sizeof(xfs_efi_log_item_t); 149 - size += (nexts - 1) * sizeof(xfs_extent_t); 150 - kmem_free(efip, size); 151 - } else { 152 - kmem_zone_free(xfs_efi_zone, efip); 153 - } 135 + xfs_efi_item_free(efip); 154 136 } else { 155 137 efip->efi_flags |= XFS_EFI_COMMITTED; 156 138 AIL_UNLOCK(mp, s); 157 139 } 158 - 159 - return; 160 140 } 161 141 162 142 /* ··· 159 159 STATIC void 160 160 xfs_efi_item_unpin_remove(xfs_efi_log_item_t *efip, xfs_trans_t *tp) 161 161 { 162 - int nexts; 163 - int size; 164 162 xfs_mount_t *mp; 165 163 xfs_log_item_desc_t *lidp; 166 164 SPLDECL(s); ··· 176 178 * xfs_trans_delete_ail() drops the AIL lock. 177 179 */ 178 180 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s); 179 - /* 180 - * now free the item itself 181 - */ 182 - nexts = efip->efi_format.efi_nextents; 183 - if (nexts > XFS_EFI_MAX_FAST_EXTENTS) { 184 - size = sizeof(xfs_efi_log_item_t); 185 - size += (nexts - 1) * sizeof(xfs_extent_t); 186 - kmem_free(efip, size); 187 - } else { 188 - kmem_zone_free(xfs_efi_zone, efip); 189 - } 181 + xfs_efi_item_free(efip); 190 182 } else { 191 183 efip->efi_flags |= XFS_EFI_COMMITTED; 192 184 AIL_UNLOCK(mp, s); 193 185 } 194 - 195 - return; 196 186 } 197 187 198 188 /* ··· 231 245 STATIC void 232 246 xfs_efi_item_abort(xfs_efi_log_item_t *efip) 233 247 { 234 - int nexts; 235 - int size; 236 - 237 - nexts = efip->efi_format.efi_nextents; 238 - if (nexts > XFS_EFI_MAX_FAST_EXTENTS) { 239 - size = sizeof(xfs_efi_log_item_t); 240 - size += (nexts - 1) * sizeof(xfs_extent_t); 241 - kmem_free(efip, size); 242 - } else { 243 - kmem_zone_free(xfs_efi_zone, efip); 244 - } 245 - return; 248 + xfs_efi_item_free(efip); 246 249 } 247 250 248 251 /* ··· 263 288 /* 264 289 * This is the ops vector shared by all efi log items. 265 290 */ 266 - struct xfs_item_ops xfs_efi_item_ops = { 291 + STATIC struct xfs_item_ops xfs_efi_item_ops = { 267 292 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efi_item_size, 268 293 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 269 294 xfs_efi_item_format, ··· 330 355 { 331 356 xfs_mount_t *mp; 332 357 int extents_left; 333 - uint size; 334 - int nexts; 335 358 SPLDECL(s); 336 359 337 360 mp = efip->efi_item.li_mountp; ··· 345 372 * xfs_trans_delete_ail() drops the AIL lock. 346 373 */ 347 374 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s); 375 + xfs_efi_item_free(efip); 348 376 } else { 349 377 AIL_UNLOCK(mp, s); 350 - } 351 - 352 - if (extents_left == 0) { 353 - nexts = efip->efi_format.efi_nextents; 354 - if (nexts > XFS_EFI_MAX_FAST_EXTENTS) { 355 - size = sizeof(xfs_efi_log_item_t); 356 - size += (nexts - 1) * sizeof(xfs_extent_t); 357 - kmem_free(efip, size); 358 - } else { 359 - kmem_zone_free(xfs_efi_zone, efip); 360 - } 361 378 } 362 379 } 363 380 ··· 361 398 xfs_efi_cancel( 362 399 xfs_efi_log_item_t *efip) 363 400 { 364 - int nexts; 365 - int size; 366 401 xfs_mount_t *mp; 367 402 SPLDECL(s); 368 403 ··· 371 410 * xfs_trans_delete_ail() drops the AIL lock. 372 411 */ 373 412 xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s); 374 - 375 - nexts = efip->efi_format.efi_nextents; 376 - if (nexts > XFS_EFI_MAX_FAST_EXTENTS) { 377 - size = sizeof(xfs_efi_log_item_t); 378 - size += (nexts - 1) * sizeof(xfs_extent_t); 379 - kmem_free(efip, size); 380 - } else { 381 - kmem_zone_free(xfs_efi_zone, efip); 382 - } 413 + xfs_efi_item_free(efip); 383 414 } else { 384 415 efip->efi_flags |= XFS_EFI_CANCELED; 385 416 AIL_UNLOCK(mp, s); 386 417 } 387 - 388 - return; 389 418 } 390 419 420 + STATIC void 421 + xfs_efd_item_free(xfs_efd_log_item_t *efdp) 422 + { 423 + int nexts = efdp->efd_format.efd_nextents; 391 424 392 - 393 - 425 + if (nexts > XFS_EFD_MAX_FAST_EXTENTS) { 426 + kmem_free(efdp, sizeof(xfs_efd_log_item_t) + 427 + (nexts - 1) * sizeof(xfs_extent_t)); 428 + } else { 429 + kmem_zone_free(xfs_efd_zone, efdp); 430 + } 431 + } 394 432 395 433 /* 396 434 * This returns the number of iovecs needed to log the given efd item. ··· 493 533 STATIC xfs_lsn_t 494 534 xfs_efd_item_committed(xfs_efd_log_item_t *efdp, xfs_lsn_t lsn) 495 535 { 496 - uint size; 497 - int nexts; 498 - 499 536 /* 500 537 * If we got a log I/O error, it's always the case that the LR with the 501 538 * EFI got unpinned and freed before the EFD got aborted. ··· 500 543 if ((efdp->efd_item.li_flags & XFS_LI_ABORTED) == 0) 501 544 xfs_efi_release(efdp->efd_efip, efdp->efd_format.efd_nextents); 502 545 503 - nexts = efdp->efd_format.efd_nextents; 504 - if (nexts > XFS_EFD_MAX_FAST_EXTENTS) { 505 - size = sizeof(xfs_efd_log_item_t); 506 - size += (nexts - 1) * sizeof(xfs_extent_t); 507 - kmem_free(efdp, size); 508 - } else { 509 - kmem_zone_free(xfs_efd_zone, efdp); 510 - } 511 - 546 + xfs_efd_item_free(efdp); 512 547 return (xfs_lsn_t)-1; 513 548 } 514 549 ··· 514 565 STATIC void 515 566 xfs_efd_item_abort(xfs_efd_log_item_t *efdp) 516 567 { 517 - int nexts; 518 - int size; 519 - 520 568 /* 521 569 * If we got a log I/O error, it's always the case that the LR with the 522 570 * EFI got unpinned and freed before the EFD got aborted. So don't ··· 522 576 if ((efdp->efd_item.li_flags & XFS_LI_ABORTED) == 0) 523 577 xfs_efi_cancel(efdp->efd_efip); 524 578 525 - nexts = efdp->efd_format.efd_nextents; 526 - if (nexts > XFS_EFD_MAX_FAST_EXTENTS) { 527 - size = sizeof(xfs_efd_log_item_t); 528 - size += (nexts - 1) * sizeof(xfs_extent_t); 529 - kmem_free(efdp, size); 530 - } else { 531 - kmem_zone_free(xfs_efd_zone, efdp); 532 - } 533 - return; 579 + xfs_efd_item_free(efdp); 534 580 } 535 581 536 582 /* ··· 553 615 /* 554 616 * This is the ops vector shared by all efd log items. 555 617 */ 556 - struct xfs_item_ops xfs_efd_item_ops = { 618 + STATIC struct xfs_item_ops xfs_efd_item_ops = { 557 619 .iop_size = (uint(*)(xfs_log_item_t*))xfs_efd_item_size, 558 620 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 559 621 xfs_efd_item_format,
+2
fs/xfs/xfs_extfree_item.h
··· 118 118 xfs_efd_log_item_t *xfs_efd_init(struct xfs_mount *, xfs_efi_log_item_t *, 119 119 uint); 120 120 121 + void xfs_efi_item_free(xfs_efi_log_item_t *); 122 + 121 123 #endif /* __KERNEL__ */ 122 124 123 125 #endif /* __XFS_EXTFREE_ITEM_H__ */
+2 -1
fs/xfs/xfs_fs.h
··· 60 60 __u32 fsx_xflags; /* xflags field value (get/set) */ 61 61 __u32 fsx_extsize; /* extsize field value (get/set)*/ 62 62 __u32 fsx_nextents; /* nextents field value (get) */ 63 - unsigned char fsx_pad[16]; 63 + __u32 fsx_projid; /* project identifier (get/set) */ 64 + unsigned char fsx_pad[12]; 64 65 }; 65 66 #endif 66 67
-26
fs/xfs/xfs_fsops.c
··· 559 559 return(0); 560 560 } 561 561 562 - void 563 - xfs_fs_log_dummy(xfs_mount_t *mp) 564 - { 565 - xfs_trans_t *tp; 566 - xfs_inode_t *ip; 567 - 568 - 569 - tp = _xfs_trans_alloc(mp, XFS_TRANS_DUMMY1); 570 - atomic_inc(&mp->m_active_trans); 571 - if (xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0)) { 572 - xfs_trans_cancel(tp, 0); 573 - return; 574 - } 575 - 576 - ip = mp->m_rootip; 577 - xfs_ilock(ip, XFS_ILOCK_EXCL); 578 - 579 - xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); 580 - xfs_trans_ihold(tp, ip); 581 - xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); 582 - xfs_trans_set_sync(tp); 583 - xfs_trans_commit(tp, 0, NULL); 584 - 585 - xfs_iunlock(ip, XFS_ILOCK_EXCL); 586 - } 587 - 588 562 int 589 563 xfs_fs_goingdown( 590 564 xfs_mount_t *mp,
+6 -2
fs/xfs/xfs_ialloc_btree.h
··· 100 100 #endif 101 101 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_IS_FREE) 102 102 int xfs_inobt_is_free(xfs_inobt_rec_t *rp, int i); 103 - #define XFS_INOBT_IS_FREE(rp,i) xfs_inobt_is_free(rp,i) 103 + #define XFS_INOBT_IS_FREE(rp,i) xfs_inobt_is_free(rp,i) 104 + #define XFS_INOBT_IS_FREE_DISK(rp,i) xfs_inobt_is_free_disk(rp,i) 104 105 #else 105 - #define XFS_INOBT_IS_FREE(rp,i) (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0) 106 + #define XFS_INOBT_IS_FREE(rp,i) \ 107 + (((rp)->ir_free & XFS_INOBT_MASK(i)) != 0) 108 + #define XFS_INOBT_IS_FREE_DISK(rp,i) \ 109 + ((INT_GET((rp)->ir_free, ARCH_CONVERT) & XFS_INOBT_MASK(i)) != 0) 106 110 #endif 107 111 #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_INOBT_SET_FREE) 108 112 void xfs_inobt_set_free(xfs_inobt_rec_t *rp, int i);
+43 -146
fs/xfs/xfs_inode.c
··· 146 146 #endif 147 147 148 148 /* 149 - * called from bwrite on xfs inode buffers 150 - */ 151 - void 152 - xfs_inobp_bwcheck(xfs_buf_t *bp) 153 - { 154 - xfs_mount_t *mp; 155 - int i; 156 - int j; 157 - xfs_dinode_t *dip; 158 - 159 - ASSERT(XFS_BUF_FSPRIVATE3(bp, void *) != NULL); 160 - 161 - mp = XFS_BUF_FSPRIVATE3(bp, xfs_mount_t *); 162 - 163 - 164 - j = mp->m_inode_cluster_size >> mp->m_sb.sb_inodelog; 165 - 166 - for (i = 0; i < j; i++) { 167 - dip = (xfs_dinode_t *) xfs_buf_offset(bp, 168 - i * mp->m_sb.sb_inodesize); 169 - if (INT_GET(dip->di_core.di_magic, ARCH_CONVERT) != XFS_DINODE_MAGIC) { 170 - cmn_err(CE_WARN, 171 - "Bad magic # 0x%x in XFS inode buffer 0x%Lx, starting blockno %Ld, offset 0x%x", 172 - INT_GET(dip->di_core.di_magic, ARCH_CONVERT), 173 - (__uint64_t)(__psunsigned_t) bp, 174 - (__int64_t) XFS_BUF_ADDR(bp), 175 - xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize)); 176 - xfs_fs_cmn_err(CE_WARN, mp, 177 - "corrupt, unmount and run xfs_repair"); 178 - } 179 - if (!dip->di_next_unlinked) { 180 - cmn_err(CE_WARN, 181 - "Bad next_unlinked field (0) in XFS inode buffer 0x%p, starting blockno %Ld, offset 0x%x", 182 - (__uint64_t)(__psunsigned_t) bp, 183 - (__int64_t) XFS_BUF_ADDR(bp), 184 - xfs_buf_offset(bp, i * mp->m_sb.sb_inodesize)); 185 - xfs_fs_cmn_err(CE_WARN, mp, 186 - "corrupt, unmount and run xfs_repair"); 187 - } 188 - } 189 - 190 - return; 191 - } 192 - 193 - /* 194 149 * This routine is called to map an inode number within a file 195 150 * system to the buffer containing the on-disk version of the 196 151 * inode. It returns a pointer to the buffer containing the ··· 158 203 * Use xfs_imap() to determine the size and location of the 159 204 * buffer to read from disk. 160 205 */ 161 - int 206 + STATIC int 162 207 xfs_inotobp( 163 208 xfs_mount_t *mp, 164 209 xfs_trans_t *tp, ··· 1202 1247 case S_IFREG: 1203 1248 case S_IFDIR: 1204 1249 if (unlikely(pip->i_d.di_flags & XFS_DIFLAG_ANY)) { 1205 - if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) { 1206 - if ((mode & S_IFMT) == S_IFDIR) { 1207 - ip->i_d.di_flags |= XFS_DIFLAG_RTINHERIT; 1208 - } else { 1209 - ip->i_d.di_flags |= XFS_DIFLAG_REALTIME; 1250 + uint di_flags = 0; 1251 + 1252 + if ((mode & S_IFMT) == S_IFDIR) { 1253 + if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) 1254 + di_flags |= XFS_DIFLAG_RTINHERIT; 1255 + } else { 1256 + if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) { 1257 + di_flags |= XFS_DIFLAG_REALTIME; 1210 1258 ip->i_iocore.io_flags |= XFS_IOCORE_RT; 1211 1259 } 1212 1260 } 1213 1261 if ((pip->i_d.di_flags & XFS_DIFLAG_NOATIME) && 1214 1262 xfs_inherit_noatime) 1215 - ip->i_d.di_flags |= XFS_DIFLAG_NOATIME; 1263 + di_flags |= XFS_DIFLAG_NOATIME; 1216 1264 if ((pip->i_d.di_flags & XFS_DIFLAG_NODUMP) && 1217 1265 xfs_inherit_nodump) 1218 - ip->i_d.di_flags |= XFS_DIFLAG_NODUMP; 1266 + di_flags |= XFS_DIFLAG_NODUMP; 1219 1267 if ((pip->i_d.di_flags & XFS_DIFLAG_SYNC) && 1220 1268 xfs_inherit_sync) 1221 - ip->i_d.di_flags |= XFS_DIFLAG_SYNC; 1269 + di_flags |= XFS_DIFLAG_SYNC; 1222 1270 if ((pip->i_d.di_flags & XFS_DIFLAG_NOSYMLINKS) && 1223 1271 xfs_inherit_nosymlinks) 1224 - ip->i_d.di_flags |= XFS_DIFLAG_NOSYMLINKS; 1272 + di_flags |= XFS_DIFLAG_NOSYMLINKS; 1273 + if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 1274 + di_flags |= XFS_DIFLAG_PROJINHERIT; 1275 + ip->i_d.di_flags |= di_flags; 1225 1276 } 1226 1277 /* FALLTHROUGH */ 1227 1278 case S_IFLNK: ··· 2117 2156 (ip->i_update_core == 0)); 2118 2157 } 2119 2158 2120 - void 2159 + STATIC void 2121 2160 xfs_ifree_cluster( 2122 2161 xfs_inode_t *free_ip, 2123 2162 xfs_trans_t *tp, ··· 2836 2875 * be subsequently pinned once someone is waiting for it to be 2837 2876 * unpinned. 2838 2877 */ 2839 - void 2878 + STATIC void 2840 2879 xfs_iunpin_wait( 2841 2880 xfs_inode_t *ip) 2842 2881 { ··· 3562 3601 3563 3602 3564 3603 /* 3565 - * Flush all inactive inodes in mp. Return true if no user references 3566 - * were found, false otherwise. 3604 + * Flush all inactive inodes in mp. 3567 3605 */ 3568 - int 3606 + void 3569 3607 xfs_iflush_all( 3570 - xfs_mount_t *mp, 3571 - int flag) 3608 + xfs_mount_t *mp) 3572 3609 { 3573 - int busy; 3574 - int done; 3575 - int purged; 3576 3610 xfs_inode_t *ip; 3577 - vmap_t vmap; 3578 3611 vnode_t *vp; 3579 3612 3580 - busy = done = 0; 3581 - while (!done) { 3582 - purged = 0; 3583 - XFS_MOUNT_ILOCK(mp); 3584 - ip = mp->m_inodes; 3585 - if (ip == NULL) { 3586 - break; 3613 + again: 3614 + XFS_MOUNT_ILOCK(mp); 3615 + ip = mp->m_inodes; 3616 + if (ip == NULL) 3617 + goto out; 3618 + 3619 + do { 3620 + /* Make sure we skip markers inserted by sync */ 3621 + if (ip->i_mount == NULL) { 3622 + ip = ip->i_mnext; 3623 + continue; 3587 3624 } 3588 - do { 3589 - /* Make sure we skip markers inserted by sync */ 3590 - if (ip->i_mount == NULL) { 3591 - ip = ip->i_mnext; 3592 - continue; 3593 - } 3594 3625 3595 - /* 3596 - * It's up to our caller to purge the root 3597 - * and quota vnodes later. 3598 - */ 3599 - vp = XFS_ITOV_NULL(ip); 3600 - 3601 - if (!vp) { 3602 - XFS_MOUNT_IUNLOCK(mp); 3603 - xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC); 3604 - purged = 1; 3605 - break; 3606 - } 3607 - 3608 - if (vn_count(vp) != 0) { 3609 - if (vn_count(vp) == 1 && 3610 - (ip == mp->m_rootip || 3611 - (mp->m_quotainfo && 3612 - (ip->i_ino == mp->m_sb.sb_uquotino || 3613 - ip->i_ino == mp->m_sb.sb_gquotino)))) { 3614 - 3615 - ip = ip->i_mnext; 3616 - continue; 3617 - } 3618 - if (!(flag & XFS_FLUSH_ALL)) { 3619 - busy = 1; 3620 - done = 1; 3621 - break; 3622 - } 3623 - /* 3624 - * Ignore busy inodes but continue flushing 3625 - * others. 3626 - */ 3627 - ip = ip->i_mnext; 3628 - continue; 3629 - } 3630 - /* 3631 - * Sample vp mapping while holding mp locked on MP 3632 - * systems, so we don't purge a reclaimed or 3633 - * nonexistent vnode. We break from the loop 3634 - * since we know that we modify 3635 - * it by pulling ourselves from it in xfs_reclaim() 3636 - * called via vn_purge() below. Set ip to the next 3637 - * entry in the list anyway so we'll know below 3638 - * whether we reached the end or not. 3639 - */ 3640 - VMAP(vp, vmap); 3626 + vp = XFS_ITOV_NULL(ip); 3627 + if (!vp) { 3641 3628 XFS_MOUNT_IUNLOCK(mp); 3642 - 3643 - vn_purge(vp, &vmap); 3644 - 3645 - purged = 1; 3646 - break; 3647 - } while (ip != mp->m_inodes); 3648 - /* 3649 - * We need to distinguish between when we exit the loop 3650 - * after a purge and when we simply hit the end of the 3651 - * list. We can't use the (ip == mp->m_inodes) test, 3652 - * because when we purge an inode at the start of the list 3653 - * the next inode on the list becomes mp->m_inodes. That 3654 - * would cause such a test to bail out early. The purged 3655 - * variable tells us how we got out of the loop. 3656 - */ 3657 - if (!purged) { 3658 - done = 1; 3629 + xfs_finish_reclaim(ip, 0, XFS_IFLUSH_ASYNC); 3630 + goto again; 3659 3631 } 3660 - } 3661 - XFS_MOUNT_IUNLOCK(mp); 3662 - return !busy; 3663 - } 3664 3632 3633 + ASSERT(vn_count(vp) == 0); 3634 + 3635 + ip = ip->i_mnext; 3636 + } while (ip != mp->m_inodes); 3637 + out: 3638 + XFS_MOUNT_IUNLOCK(mp); 3639 + } 3665 3640 3666 3641 /* 3667 3642 * xfs_iaccess: check accessibility of inode for mode.
+1 -8
fs/xfs/xfs_inode.h
··· 412 412 #define XFS_IFLUSH_DELWRI 5 413 413 414 414 /* 415 - * Flags for xfs_iflush_all. 416 - */ 417 - #define XFS_FLUSH_ALL 0x1 418 - 419 - /* 420 415 * Flags for xfs_itruncate_start(). 421 416 */ 422 417 #define XFS_ITRUNC_DEFINITE 0x1 ··· 482 487 /* 483 488 * xfs_inode.c prototypes. 484 489 */ 485 - int xfs_inotobp(struct xfs_mount *, struct xfs_trans *, xfs_ino_t, 486 - xfs_dinode_t **, struct xfs_buf **, int *); 487 490 int xfs_itobp(struct xfs_mount *, struct xfs_trans *, 488 491 xfs_inode_t *, xfs_dinode_t **, struct xfs_buf **, 489 492 xfs_daddr_t); ··· 515 522 void xfs_iunpin(xfs_inode_t *); 516 523 int xfs_iextents_copy(xfs_inode_t *, xfs_bmbt_rec_t *, int); 517 524 int xfs_iflush(xfs_inode_t *, uint); 518 - int xfs_iflush_all(struct xfs_mount *, int); 525 + void xfs_iflush_all(struct xfs_mount *); 519 526 int xfs_iaccess(xfs_inode_t *, mode_t, cred_t *); 520 527 uint xfs_iroundup(uint); 521 528 void xfs_ichgtime(xfs_inode_t *, int);
+1 -1
fs/xfs/xfs_inode_item.c
··· 910 910 /* 911 911 * This is the ops vector shared by all buf log items. 912 912 */ 913 - struct xfs_item_ops xfs_inode_item_ops = { 913 + STATIC struct xfs_item_ops xfs_inode_item_ops = { 914 914 .iop_size = (uint(*)(xfs_log_item_t*))xfs_inode_item_size, 915 915 .iop_format = (void(*)(xfs_log_item_t*, xfs_log_iovec_t*)) 916 916 xfs_inode_item_format,
+27 -38
fs/xfs/xfs_iomap.c
··· 385 385 int nimaps, maps; 386 386 int error; 387 387 int bmapi_flag; 388 + int quota_flag; 388 389 int rt; 389 390 xfs_trans_t *tp; 390 391 xfs_bmbt_irec_t imap[XFS_WRITE_IMAPS], *imapp; 391 392 xfs_bmap_free_t free_list; 392 393 int aeof; 393 - xfs_filblks_t datablocks; 394 + xfs_filblks_t datablocks, qblocks, resblks; 394 395 int committed; 395 396 int numrtextents; 396 - uint resblks; 397 397 398 398 /* 399 399 * Make sure that the dquots are there. This doesn't hold ··· 419 419 xfs_fileoff_t map_last_fsb; 420 420 421 421 map_last_fsb = ret_imap->br_blockcount + ret_imap->br_startoff; 422 - 423 422 if (map_last_fsb < last_fsb) { 424 423 last_fsb = map_last_fsb; 425 424 count_fsb = last_fsb - offset_fsb; ··· 427 428 } 428 429 429 430 /* 430 - * determine if reserving space on 431 - * the data or realtime partition. 431 + * Determine if reserving space on the data or realtime partition. 432 432 */ 433 433 if ((rt = XFS_IS_REALTIME_INODE(ip))) { 434 - int sbrtextsize, iprtextsize; 434 + xfs_extlen_t extsz; 435 435 436 - sbrtextsize = mp->m_sb.sb_rextsize; 437 - iprtextsize = 438 - ip->i_d.di_extsize ? ip->i_d.di_extsize : sbrtextsize; 439 - numrtextents = (count_fsb + iprtextsize - 1); 440 - do_div(numrtextents, sbrtextsize); 436 + if (!(extsz = ip->i_d.di_extsize)) 437 + extsz = mp->m_sb.sb_rextsize; 438 + numrtextents = qblocks = (count_fsb + extsz - 1); 439 + do_div(numrtextents, mp->m_sb.sb_rextsize); 440 + quota_flag = XFS_QMOPT_RES_RTBLKS; 441 441 datablocks = 0; 442 442 } else { 443 - datablocks = count_fsb; 443 + datablocks = qblocks = count_fsb; 444 + quota_flag = XFS_QMOPT_RES_REGBLKS; 444 445 numrtextents = 0; 445 446 } 446 447 447 448 /* 448 - * allocate and setup the transaction 449 + * Allocate and setup the transaction 449 450 */ 450 451 xfs_iunlock(ip, XFS_ILOCK_EXCL); 451 452 tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT); 452 - 453 453 resblks = XFS_DIOSTRAT_SPACE_RES(mp, datablocks); 454 - 455 454 error = xfs_trans_reserve(tp, resblks, 456 455 XFS_WRITE_LOG_RES(mp), numrtextents, 457 456 XFS_TRANS_PERM_LOG_RES, 458 457 XFS_WRITE_LOG_COUNT); 459 458 460 459 /* 461 - * check for running out of space 460 + * Check for running out of space, note: need lock to return 462 461 */ 463 462 if (error) 464 - /* 465 - * Free the transaction structure. 466 - */ 467 463 xfs_trans_cancel(tp, 0); 468 - 469 464 xfs_ilock(ip, XFS_ILOCK_EXCL); 470 - 471 465 if (error) 472 - goto error_out; /* Don't return in above if .. trans .., 473 - need lock to return */ 466 + goto error_out; 474 467 475 - if (XFS_TRANS_RESERVE_BLKQUOTA(mp, tp, ip, resblks)) { 468 + if (XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, qblocks, 0, quota_flag)) { 476 469 error = (EDQUOT); 477 470 goto error1; 478 471 } 479 - nimaps = 1; 480 472 481 473 bmapi_flag = XFS_BMAPI_WRITE; 482 474 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); ··· 477 487 bmapi_flag |= XFS_BMAPI_PREALLOC; 478 488 479 489 /* 480 - * issue the bmapi() call to allocate the blocks 490 + * Issue the bmapi() call to allocate the blocks 481 491 */ 482 492 XFS_BMAP_INIT(&free_list, &firstfsb); 493 + nimaps = 1; 483 494 imapp = &imap[0]; 484 495 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, 485 496 bmapi_flag, &firstfsb, 0, imapp, &nimaps, &free_list); 486 - if (error) { 497 + if (error) 487 498 goto error0; 488 - } 489 499 490 500 /* 491 - * complete the transaction 501 + * Complete the transaction 492 502 */ 493 - 494 503 error = xfs_bmap_finish(&tp, &free_list, firstfsb, &committed); 495 - if (error) { 504 + if (error) 496 505 goto error0; 497 - } 498 - 499 506 error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES, NULL); 500 - if (error) { 507 + if (error) 501 508 goto error_out; 502 - } 503 509 504 - /* copy any maps to caller's array and return any error. */ 510 + /* 511 + * Copy any maps to caller's array and return any error. 512 + */ 505 513 if (nimaps == 0) { 506 514 error = (ENOSPC); 507 515 goto error_out; ··· 518 530 } 519 531 return 0; 520 532 521 - error0: /* Cancel bmap, unlock inode, and cancel trans */ 533 + error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */ 522 534 xfs_bmap_cancel(&free_list); 535 + XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, qblocks, 0, quota_flag); 523 536 524 - error1: /* Just cancel transaction */ 537 + error1: /* Just cancel transaction */ 525 538 xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); 526 539 *nmaps = 0; /* nothing set-up here */ 527 540
+3 -3
fs/xfs/xfs_log.c
··· 134 134 #define xlog_verify_tail_lsn(a,b,c) 135 135 #endif 136 136 137 - int xlog_iclogs_empty(xlog_t *log); 137 + STATIC int xlog_iclogs_empty(xlog_t *log); 138 138 139 139 #ifdef DEBUG 140 140 int xlog_do_error = 0; ··· 1857 1857 * 1858 1858 * State Change: DIRTY -> ACTIVE 1859 1859 */ 1860 - void 1860 + STATIC void 1861 1861 xlog_state_clean_log(xlog_t *log) 1862 1862 { 1863 1863 xlog_in_core_t *iclog; ··· 3542 3542 return (retval); 3543 3543 } 3544 3544 3545 - int 3545 + STATIC int 3546 3546 xlog_iclogs_empty(xlog_t *log) 3547 3547 { 3548 3548 xlog_in_core_t *iclog;
-2
fs/xfs/xfs_log_priv.h
··· 535 535 536 536 /* common routines */ 537 537 extern xfs_lsn_t xlog_assign_tail_lsn(struct xfs_mount *mp); 538 - extern int xlog_find_head(xlog_t *log, xfs_daddr_t *head_blk); 539 538 extern int xlog_find_tail(xlog_t *log, 540 539 xfs_daddr_t *head_blk, 541 540 xfs_daddr_t *tail_blk, ··· 547 548 extern struct xfs_buf *xlog_get_bp(xlog_t *, int); 548 549 extern void xlog_put_bp(struct xfs_buf *); 549 550 extern int xlog_bread(xlog_t *, xfs_daddr_t, int, struct xfs_buf *); 550 - extern xfs_caddr_t xlog_align(xlog_t *, xfs_daddr_t, int, struct xfs_buf *); 551 551 552 552 /* iclog tracing */ 553 553 #define XLOG_TRACE_GRAB_FLUSH 1
+14 -17
fs/xfs/xfs_log_recover.c
··· 148 148 * The buffer is kept locked across the write and is returned locked. 149 149 * This can only be used for synchronous log writes. 150 150 */ 151 - int 151 + STATIC int 152 152 xlog_bwrite( 153 153 xlog_t *log, 154 154 xfs_daddr_t blk_no, ··· 179 179 return error; 180 180 } 181 181 182 - xfs_caddr_t 182 + STATIC xfs_caddr_t 183 183 xlog_align( 184 184 xlog_t *log, 185 185 xfs_daddr_t blk_no, ··· 528 528 * 529 529 * Return: zero if normal, non-zero if error. 530 530 */ 531 - int 531 + STATIC int 532 532 xlog_find_head( 533 533 xlog_t *log, 534 534 xfs_daddr_t *return_head_blk) ··· 1964 1964 * probably a good thing to do for other buf types also. 1965 1965 */ 1966 1966 error = 0; 1967 - if (buf_f->blf_flags & (XFS_BLI_UDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) { 1967 + if (buf_f->blf_flags & 1968 + (XFS_BLI_UDQUOT_BUF|XFS_BLI_PDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) { 1968 1969 error = xfs_qm_dqcheck((xfs_disk_dquot_t *) 1969 1970 item->ri_buf[i].i_addr, 1970 1971 -1, 0, XFS_QMOPT_DOWARN, ··· 2031 2030 } 2032 2031 2033 2032 if (INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_USER && 2033 + INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_PROJ && 2034 2034 INT_GET(ddq->d_flags, ARCH_CONVERT) != XFS_DQ_GROUP) { 2035 2035 if (flags & XFS_QMOPT_DOWARN) 2036 2036 cmn_err(CE_ALERT, ··· 2137 2135 type = 0; 2138 2136 if (buf_f->blf_flags & XFS_BLI_UDQUOT_BUF) 2139 2137 type |= XFS_DQ_USER; 2138 + if (buf_f->blf_flags & XFS_BLI_PDQUOT_BUF) 2139 + type |= XFS_DQ_PROJ; 2140 2140 if (buf_f->blf_flags & XFS_BLI_GDQUOT_BUF) 2141 2141 type |= XFS_DQ_GROUP; 2142 2142 /* ··· 2251 2247 error = 0; 2252 2248 if (flags & XFS_BLI_INODE_BUF) { 2253 2249 error = xlog_recover_do_inode_buffer(mp, item, bp, buf_f); 2254 - } else if (flags & (XFS_BLI_UDQUOT_BUF | XFS_BLI_GDQUOT_BUF)) { 2250 + } else if (flags & 2251 + (XFS_BLI_UDQUOT_BUF|XFS_BLI_PDQUOT_BUF|XFS_BLI_GDQUOT_BUF)) { 2255 2252 xlog_recover_do_dquot_buffer(mp, log, item, bp, buf_f); 2256 2253 } else { 2257 2254 xlog_recover_do_reg_buffer(mp, item, bp, buf_f); ··· 2624 2619 * This type of quotas was turned off, so ignore this record. 2625 2620 */ 2626 2621 type = INT_GET(recddq->d_flags, ARCH_CONVERT) & 2627 - (XFS_DQ_USER | XFS_DQ_GROUP); 2622 + (XFS_DQ_USER | XFS_DQ_PROJ | XFS_DQ_GROUP); 2628 2623 ASSERT(type); 2629 2624 if (log->l_quotaoffs_flag & type) 2630 2625 return (0); ··· 2747 2742 xfs_efi_log_item_t *efip = NULL; 2748 2743 xfs_log_item_t *lip; 2749 2744 int gen; 2750 - int nexts; 2751 2745 __uint64_t efi_id; 2752 2746 SPLDECL(s); 2753 2747 ··· 2781 2777 } 2782 2778 lip = xfs_trans_next_ail(mp, lip, &gen, NULL); 2783 2779 } 2784 - if (lip == NULL) { 2785 - AIL_UNLOCK(mp, s); 2786 - } 2787 2780 2788 2781 /* 2789 2782 * If we found it, then free it up. If it wasn't there, it 2790 2783 * must have been overwritten in the log. Oh well. 2791 2784 */ 2792 2785 if (lip != NULL) { 2793 - nexts = efip->efi_format.efi_nextents; 2794 - if (nexts > XFS_EFI_MAX_FAST_EXTENTS) { 2795 - kmem_free(lip, sizeof(xfs_efi_log_item_t) + 2796 - ((nexts - 1) * sizeof(xfs_extent_t))); 2797 - } else { 2798 - kmem_zone_free(xfs_efi_zone, efip); 2799 - } 2786 + xfs_efi_item_free(efip); 2787 + } else { 2788 + AIL_UNLOCK(mp, s); 2800 2789 } 2801 2790 } 2802 2791
+5
fs/xfs/xfs_macros.c
··· 1658 1658 { 1659 1659 return XFS_INOBT_IS_FREE(rp, i); 1660 1660 } 1661 + int 1662 + xfs_inobt_is_free_disk(xfs_inobt_rec_t *rp, int i) 1663 + { 1664 + return XFS_INOBT_IS_FREE_DISK(rp, i); 1665 + } 1661 1666 #endif 1662 1667 1663 1668 #if XFS_WANT_FUNCS_C || (XFS_WANT_SPACE_C && XFSSO_XFS_INOBT_IS_LAST_REC)
+4 -12
fs/xfs/xfs_mount.c
··· 64 64 STATIC void xfs_mount_log_sbunit(xfs_mount_t *, __int64_t); 65 65 STATIC int xfs_uuid_mount(xfs_mount_t *); 66 66 STATIC void xfs_uuid_unmount(xfs_mount_t *mp); 67 + STATIC void xfs_unmountfs_wait(xfs_mount_t *); 67 68 68 69 static struct { 69 70 short offset; ··· 556 555 * fields from the superblock associated with the given 557 556 * mount structure 558 557 */ 559 - void 558 + STATIC void 560 559 xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) 561 560 { 562 561 int i; ··· 1082 1081 int64_t fsid; 1083 1082 #endif 1084 1083 1085 - xfs_iflush_all(mp, XFS_FLUSH_ALL); 1084 + xfs_iflush_all(mp); 1086 1085 1087 1086 XFS_QM_DQPURGEALL(mp, 1088 1087 XFS_QMOPT_UQUOTA | XFS_QMOPT_GQUOTA | XFS_QMOPT_UMOUNTING); ··· 1112 1111 */ 1113 1112 ASSERT(mp->m_inodes == NULL); 1114 1113 1115 - /* 1116 - * We may have bufs that are in the process of getting written still. 1117 - * We must wait for the I/O completion of those. The sync flag here 1118 - * does a two pass iteration thru the bufcache. 1119 - */ 1120 - if (XFS_FORCED_SHUTDOWN(mp)) { 1121 - xfs_incore_relse(mp->m_ddev_targp, 0, 1); /* synchronous */ 1122 - } 1123 - 1124 1114 xfs_unmountfs_close(mp, cr); 1125 1115 if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0) 1126 1116 xfs_uuid_unmount(mp); ··· 1138 1146 xfs_free_buftarg(mp->m_ddev_targp, 0); 1139 1147 } 1140 1148 1141 - void 1149 + STATIC void 1142 1150 xfs_unmountfs_wait(xfs_mount_t *mp) 1143 1151 { 1144 1152 if (mp->m_logdev_targp != mp->m_ddev_targp)
+3 -4
fs/xfs/xfs_mount.h
··· 141 141 typedef void (*xfs_dqdetach_t)(struct xfs_inode *); 142 142 typedef int (*xfs_dqpurgeall_t)(struct xfs_mount *, uint); 143 143 typedef int (*xfs_dqvopalloc_t)(struct xfs_mount *, 144 - struct xfs_inode *, uid_t, gid_t, uint, 144 + struct xfs_inode *, uid_t, gid_t, prid_t, uint, 145 145 struct xfs_dquot **, struct xfs_dquot **); 146 146 typedef void (*xfs_dqvopcreate_t)(struct xfs_trans *, struct xfs_inode *, 147 147 struct xfs_dquot *, struct xfs_dquot *); ··· 185 185 (*(mp)->m_qm_ops.xfs_dqdetach)(ip) 186 186 #define XFS_QM_DQPURGEALL(mp, fl) \ 187 187 (*(mp)->m_qm_ops.xfs_dqpurgeall)(mp, fl) 188 - #define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, fl, dq1, dq2) \ 189 - (*(mp)->m_qm_ops.xfs_dqvopalloc)(mp, ip, uid, gid, fl, dq1, dq2) 188 + #define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, prid, fl, dq1, dq2) \ 189 + (*(mp)->m_qm_ops.xfs_dqvopalloc)(mp, ip, uid, gid, prid, fl, dq1, dq2) 190 190 #define XFS_QM_DQVOPCREATE(mp, tp, ip, dq1, dq2) \ 191 191 (*(mp)->m_qm_ops.xfs_dqvopcreate)(tp, ip, dq1, dq2) 192 192 #define XFS_QM_DQVOPRENAME(mp, ip) \ ··· 544 544 extern int xfs_mountfs(struct vfs *, xfs_mount_t *mp, int); 545 545 546 546 extern int xfs_unmountfs(xfs_mount_t *, struct cred *); 547 - extern void xfs_unmountfs_wait(xfs_mount_t *); 548 547 extern void xfs_unmountfs_close(xfs_mount_t *, struct cred *); 549 548 extern int xfs_unmountfs_writesb(xfs_mount_t *); 550 549 extern int xfs_unmount_flush(xfs_mount_t *, int);
+43 -29
fs/xfs/xfs_quota.h
··· 96 96 * flags for q_flags field in the dquot. 97 97 */ 98 98 #define XFS_DQ_USER 0x0001 /* a user quota */ 99 - /* #define XFS_DQ_PROJ 0x0002 -- project quota (IRIX) */ 99 + #define XFS_DQ_PROJ 0x0002 /* project quota */ 100 100 #define XFS_DQ_GROUP 0x0004 /* a group quota */ 101 101 #define XFS_DQ_FLOCKED 0x0008 /* flush lock taken */ 102 102 #define XFS_DQ_DIRTY 0x0010 /* dquot is dirty */ 103 103 #define XFS_DQ_WANT 0x0020 /* for lookup/reclaim race */ 104 104 #define XFS_DQ_INACTIVE 0x0040 /* dq off mplist & hashlist */ 105 105 #define XFS_DQ_MARKER 0x0080 /* sentinel */ 106 + 107 + #define XFS_DQ_ALLTYPES (XFS_DQ_USER|XFS_DQ_PROJ|XFS_DQ_GROUP) 106 108 107 109 /* 108 110 * In the worst case, when both user and group quotas are on, ··· 126 124 typedef struct xfs_dq_logformat { 127 125 __uint16_t qlf_type; /* dquot log item type */ 128 126 __uint16_t qlf_size; /* size of this item */ 129 - xfs_dqid_t qlf_id; /* usr/grp id number : 32 bits */ 127 + xfs_dqid_t qlf_id; /* usr/grp/proj id : 32 bits */ 130 128 __int64_t qlf_blkno; /* blkno of dquot buffer */ 131 129 __int32_t qlf_len; /* len of dquot buffer */ 132 130 __uint32_t qlf_boffset; /* off of dquot in buffer */ ··· 154 152 #define XFS_UQUOTA_ACCT 0x0001 /* user quota accounting ON */ 155 153 #define XFS_UQUOTA_ENFD 0x0002 /* user quota limits enforced */ 156 154 #define XFS_UQUOTA_CHKD 0x0004 /* quotacheck run on usr quotas */ 157 - #define XFS_PQUOTA_ACCT 0x0008 /* (IRIX) project quota accounting ON */ 158 - #define XFS_GQUOTA_ENFD 0x0010 /* group quota limits enforced */ 159 - #define XFS_GQUOTA_CHKD 0x0020 /* quotacheck run on grp quotas */ 155 + #define XFS_PQUOTA_ACCT 0x0008 /* project quota accounting ON */ 156 + #define XFS_OQUOTA_ENFD 0x0010 /* other (grp/prj) quota limits enforced */ 157 + #define XFS_OQUOTA_CHKD 0x0020 /* quotacheck run on other (grp/prj) quotas */ 160 158 #define XFS_GQUOTA_ACCT 0x0040 /* group quota accounting ON */ 161 159 162 160 /* ··· 164 162 * are in the process of getting turned off. These flags are in m_qflags but 165 163 * never in sb_qflags. 166 164 */ 167 - #define XFS_UQUOTA_ACTIVE 0x0080 /* uquotas are being turned off */ 168 - #define XFS_GQUOTA_ACTIVE 0x0100 /* gquotas are being turned off */ 165 + #define XFS_UQUOTA_ACTIVE 0x0100 /* uquotas are being turned off */ 166 + #define XFS_PQUOTA_ACTIVE 0x0200 /* pquotas are being turned off */ 167 + #define XFS_GQUOTA_ACTIVE 0x0400 /* gquotas are being turned off */ 169 168 170 169 /* 171 170 * Checking XFS_IS_*QUOTA_ON() while holding any inode lock guarantees 172 171 * quota will be not be switched off as long as that inode lock is held. 173 172 */ 174 173 #define XFS_IS_QUOTA_ON(mp) ((mp)->m_qflags & (XFS_UQUOTA_ACTIVE | \ 175 - XFS_GQUOTA_ACTIVE)) 174 + XFS_GQUOTA_ACTIVE | \ 175 + XFS_PQUOTA_ACTIVE)) 176 + #define XFS_IS_OQUOTA_ON(mp) ((mp)->m_qflags & (XFS_GQUOTA_ACTIVE | \ 177 + XFS_PQUOTA_ACTIVE)) 176 178 #define XFS_IS_UQUOTA_ON(mp) ((mp)->m_qflags & XFS_UQUOTA_ACTIVE) 177 179 #define XFS_IS_GQUOTA_ON(mp) ((mp)->m_qflags & XFS_GQUOTA_ACTIVE) 180 + #define XFS_IS_PQUOTA_ON(mp) ((mp)->m_qflags & XFS_PQUOTA_ACTIVE) 178 181 179 182 /* 180 183 * Flags to tell various functions what to do. Not all of these are meaningful ··· 189 182 #define XFS_QMOPT_DQLOCK 0x0000001 /* dqlock */ 190 183 #define XFS_QMOPT_DQALLOC 0x0000002 /* alloc dquot ondisk if needed */ 191 184 #define XFS_QMOPT_UQUOTA 0x0000004 /* user dquot requested */ 192 - #define XFS_QMOPT_GQUOTA 0x0000008 /* group dquot requested */ 185 + #define XFS_QMOPT_PQUOTA 0x0000008 /* project dquot requested */ 193 186 #define XFS_QMOPT_FORCE_RES 0x0000010 /* ignore quota limits */ 194 187 #define XFS_QMOPT_DQSUSER 0x0000020 /* don't cache super users dquot */ 195 188 #define XFS_QMOPT_SBVERSION 0x0000040 /* change superblock version num */ ··· 199 192 #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if necessary */ 200 193 #define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */ 201 194 #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot, if damaged. */ 195 + #define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */ 202 196 203 197 /* 204 198 * flags to xfs_trans_mod_dquot to indicate which field needs to be ··· 239 231 #define XFS_TRANS_DQ_DELRTBCOUNT XFS_QMOPT_DELRTBCOUNT 240 232 241 233 242 - #define XFS_QMOPT_QUOTALL (XFS_QMOPT_UQUOTA|XFS_QMOPT_GQUOTA) 234 + #define XFS_QMOPT_QUOTALL \ 235 + (XFS_QMOPT_UQUOTA | XFS_QMOPT_PQUOTA | XFS_QMOPT_GQUOTA) 243 236 #define XFS_QMOPT_RESBLK_MASK (XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_RES_RTBLKS) 244 237 245 238 #ifdef __KERNEL__ ··· 255 246 */ 256 247 #define XFS_NOT_DQATTACHED(mp, ip) ((XFS_IS_UQUOTA_ON(mp) &&\ 257 248 (ip)->i_udquot == NULL) || \ 258 - (XFS_IS_GQUOTA_ON(mp) && \ 249 + (XFS_IS_OQUOTA_ON(mp) && \ 259 250 (ip)->i_gdquot == NULL)) 260 251 261 - #define XFS_QM_NEED_QUOTACHECK(mp) ((XFS_IS_UQUOTA_ON(mp) && \ 262 - (mp->m_sb.sb_qflags & \ 263 - XFS_UQUOTA_CHKD) == 0) || \ 264 - (XFS_IS_GQUOTA_ON(mp) && \ 265 - (mp->m_sb.sb_qflags & \ 266 - XFS_GQUOTA_CHKD) == 0)) 252 + #define XFS_QM_NEED_QUOTACHECK(mp) \ 253 + ((XFS_IS_UQUOTA_ON(mp) && \ 254 + (mp->m_sb.sb_qflags & XFS_UQUOTA_CHKD) == 0) || \ 255 + (XFS_IS_GQUOTA_ON(mp) && \ 256 + ((mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD) == 0 || \ 257 + (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT))) || \ 258 + (XFS_IS_PQUOTA_ON(mp) && \ 259 + ((mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD) == 0 || \ 260 + (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT)))) 261 + 262 + #define XFS_MOUNT_QUOTA_SET1 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ 263 + XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ 264 + XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD) 265 + 266 + #define XFS_MOUNT_QUOTA_SET2 (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ 267 + XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ 268 + XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD) 267 269 268 270 #define XFS_MOUNT_QUOTA_ALL (XFS_UQUOTA_ACCT|XFS_UQUOTA_ENFD|\ 269 - XFS_UQUOTA_CHKD|XFS_GQUOTA_ACCT|\ 270 - XFS_GQUOTA_ENFD|XFS_GQUOTA_CHKD) 271 + XFS_UQUOTA_CHKD|XFS_PQUOTA_ACCT|\ 272 + XFS_OQUOTA_ENFD|XFS_OQUOTA_CHKD|\ 273 + XFS_GQUOTA_ACCT) 271 274 #define XFS_MOUNT_QUOTA_MASK (XFS_MOUNT_QUOTA_ALL | XFS_UQUOTA_ACTIVE | \ 272 - XFS_GQUOTA_ACTIVE) 275 + XFS_GQUOTA_ACTIVE | XFS_PQUOTA_ACTIVE) 273 276 274 277 275 278 /* ··· 352 331 #define XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp) \ 353 332 XFS_DQTRXOP_VOID(mp, tp, qo_unreserve_and_mod_dquots) 354 333 355 - #define XFS_TRANS_RESERVE_BLKQUOTA(mp, tp, ip, nblks) \ 356 - XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, 0, \ 357 - XFS_QMOPT_RES_REGBLKS) 358 - #define XFS_TRANS_RESERVE_BLKQUOTA_FORCE(mp, tp, ip, nblks) \ 359 - XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, 0, \ 360 - XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES) 361 - #define XFS_TRANS_UNRESERVE_BLKQUOTA(mp, tp, ip, nblks) \ 362 - XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, -(nblks), 0, \ 363 - XFS_QMOPT_RES_REGBLKS) 334 + #define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, flags) \ 335 + XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, -(nblks), -(ninos), flags) 364 336 #define XFS_TRANS_RESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \ 365 337 XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, \ 366 338 f | XFS_QMOPT_RES_REGBLKS)
-18
fs/xfs/xfs_rename.c
··· 234 234 return 0; 235 235 } 236 236 237 - 238 - int rename_which_error_return = 0; 239 - 240 237 /* 241 238 * xfs_rename 242 239 */ ··· 313 316 &num_inodes); 314 317 315 318 if (error) { 316 - rename_which_error_return = __LINE__; 317 319 /* 318 320 * We have nothing locked, no inode references, and 319 321 * no transaction, so just get out. ··· 328 332 */ 329 333 if (target_ip == NULL && (src_dp != target_dp) && 330 334 target_dp->i_d.di_nlink >= XFS_MAXLINK) { 331 - rename_which_error_return = __LINE__; 332 335 error = XFS_ERROR(EMLINK); 333 336 xfs_rename_unlock4(inodes, XFS_ILOCK_SHARED); 334 337 goto rele_return; ··· 354 359 XFS_TRANS_PERM_LOG_RES, XFS_RENAME_LOG_COUNT); 355 360 } 356 361 if (error) { 357 - rename_which_error_return = __LINE__; 358 362 xfs_trans_cancel(tp, 0); 359 363 goto rele_return; 360 364 } ··· 363 369 */ 364 370 if ((error = XFS_QM_DQVOPRENAME(mp, inodes))) { 365 371 xfs_trans_cancel(tp, cancel_flags); 366 - rename_which_error_return = __LINE__; 367 372 goto rele_return; 368 373 } 369 374 ··· 406 413 if (spaceres == 0 && 407 414 (error = XFS_DIR_CANENTER(mp, tp, target_dp, target_name, 408 415 target_namelen))) { 409 - rename_which_error_return = __LINE__; 410 416 goto error_return; 411 417 } 412 418 /* ··· 417 425 target_namelen, src_ip->i_ino, 418 426 &first_block, &free_list, spaceres); 419 427 if (error == ENOSPC) { 420 - rename_which_error_return = __LINE__; 421 428 goto error_return; 422 429 } 423 430 if (error) { 424 - rename_which_error_return = __LINE__; 425 431 goto abort_return; 426 432 } 427 433 xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); ··· 427 437 if (new_parent && src_is_directory) { 428 438 error = xfs_bumplink(tp, target_dp); 429 439 if (error) { 430 - rename_which_error_return = __LINE__; 431 440 goto abort_return; 432 441 } 433 442 } ··· 444 455 if (!(XFS_DIR_ISEMPTY(target_ip->i_mount, target_ip)) || 445 456 (target_ip->i_d.di_nlink > 2)) { 446 457 error = XFS_ERROR(EEXIST); 447 - rename_which_error_return = __LINE__; 448 458 goto error_return; 449 459 } 450 460 } ··· 461 473 target_namelen, src_ip->i_ino, &first_block, 462 474 &free_list, spaceres); 463 475 if (error) { 464 - rename_which_error_return = __LINE__; 465 476 goto abort_return; 466 477 } 467 478 xfs_ichgtime(target_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); ··· 471 484 */ 472 485 error = xfs_droplink(tp, target_ip); 473 486 if (error) { 474 - rename_which_error_return = __LINE__; 475 487 goto abort_return; 476 488 } 477 489 target_ip_dropped = 1; ··· 481 495 */ 482 496 error = xfs_droplink(tp, target_ip); 483 497 if (error) { 484 - rename_which_error_return = __LINE__; 485 498 goto abort_return; 486 499 } 487 500 } ··· 504 519 &free_list, spaceres); 505 520 ASSERT(error != EEXIST); 506 521 if (error) { 507 - rename_which_error_return = __LINE__; 508 522 goto abort_return; 509 523 } 510 524 xfs_ichgtime(src_ip, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); ··· 534 550 */ 535 551 error = xfs_droplink(tp, src_dp); 536 552 if (error) { 537 - rename_which_error_return = __LINE__; 538 553 goto abort_return; 539 554 } 540 555 } ··· 541 558 error = XFS_DIR_REMOVENAME(mp, tp, src_dp, src_name, src_namelen, 542 559 src_ip->i_ino, &first_block, &free_list, spaceres); 543 560 if (error) { 544 - rename_which_error_return = __LINE__; 545 561 goto abort_return; 546 562 } 547 563 xfs_ichgtime(src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
+1 -20
fs/xfs/xfs_trans.c
··· 332 332 333 333 334 334 /* 335 - * This is called to set the a callback to be called when the given 336 - * transaction is committed to disk. The transaction pointer and the 337 - * argument pointer will be passed to the callback routine. 338 - * 339 - * Only one callback can be associated with any single transaction. 340 - */ 341 - void 342 - xfs_trans_callback( 343 - xfs_trans_t *tp, 344 - xfs_trans_callback_t callback, 345 - void *arg) 346 - { 347 - ASSERT(tp->t_callback == NULL); 348 - tp->t_callback = callback; 349 - tp->t_callarg = arg; 350 - } 351 - 352 - 353 - /* 354 335 * Record the indicated change to the given field for application 355 336 * to the file system's superblock when the transaction commits. 356 337 * For now, just store the change in the transaction structure. ··· 532 551 * 533 552 * This is done efficiently with a single call to xfs_mod_incore_sb_batch(). 534 553 */ 535 - void 554 + STATIC void 536 555 xfs_trans_unreserve_and_mod_sb( 537 556 xfs_trans_t *tp) 538 557 {
-3
fs/xfs/xfs_trans.h
··· 987 987 xfs_trans_t *xfs_trans_dup(xfs_trans_t *); 988 988 int xfs_trans_reserve(xfs_trans_t *, uint, uint, uint, 989 989 uint, uint); 990 - void xfs_trans_callback(xfs_trans_t *, 991 - void (*)(xfs_trans_t *, void *), void *); 992 990 void xfs_trans_mod_sb(xfs_trans_t *, uint, long); 993 991 struct xfs_buf *xfs_trans_get_buf(xfs_trans_t *, struct xfs_buftarg *, xfs_daddr_t, 994 992 int, uint); ··· 1008 1010 xfs_ino_t , uint, uint, struct xfs_inode **); 1009 1011 void xfs_trans_ijoin(xfs_trans_t *, struct xfs_inode *, uint); 1010 1012 void xfs_trans_ihold(xfs_trans_t *, struct xfs_inode *); 1011 - void xfs_trans_ihold_release(xfs_trans_t *, struct xfs_inode *); 1012 1013 void xfs_trans_log_buf(xfs_trans_t *, struct xfs_buf *, uint, uint); 1013 1014 void xfs_trans_log_inode(xfs_trans_t *, struct xfs_inode *, uint); 1014 1015 struct xfs_efi_log_item *xfs_trans_get_efi(xfs_trans_t *, uint);
+1
fs/xfs/xfs_trans_buf.c
··· 976 976 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 977 977 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 978 978 ASSERT(type == XFS_BLI_UDQUOT_BUF || 979 + type == XFS_BLI_PDQUOT_BUF || 979 980 type == XFS_BLI_GDQUOT_BUF); 980 981 981 982 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
-18
fs/xfs/xfs_trans_inode.c
··· 253 253 ip->i_itemp->ili_flags |= XFS_ILI_HOLD; 254 254 } 255 255 256 - /* 257 - * Cancel the previous inode hold request made on this inode 258 - * for this transaction. 259 - */ 260 - /*ARGSUSED*/ 261 - void 262 - xfs_trans_ihold_release( 263 - xfs_trans_t *tp, 264 - xfs_inode_t *ip) 265 - { 266 - ASSERT(ip->i_transp == tp); 267 - ASSERT(ip->i_itemp != NULL); 268 - ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE)); 269 - ASSERT(ip->i_itemp->ili_flags & XFS_ILI_HOLD); 270 - 271 - ip->i_itemp->ili_flags &= ~XFS_ILI_HOLD; 272 - } 273 - 274 256 275 257 /* 276 258 * This is called to mark the fields indicated in fieldmask as needing
+1 -1
fs/xfs/xfs_types.h
··· 55 55 typedef unsigned long long int __uint64_t; 56 56 57 57 typedef enum { B_FALSE,B_TRUE } boolean_t; 58 - typedef __int64_t prid_t; /* project ID */ 58 + typedef __uint32_t prid_t; /* project ID */ 59 59 typedef __uint32_t inst_t; /* an instruction */ 60 60 61 61 typedef __s64 xfs_off_t; /* <file offset> type */
+1 -1
fs/xfs/xfs_utils.c
··· 428 428 if (ip->i_ino != mp->m_sb.sb_uquotino) 429 429 ASSERT(ip->i_udquot); 430 430 } 431 - if (XFS_IS_GQUOTA_ON(mp)) { 431 + if (XFS_IS_OQUOTA_ON(mp)) { 432 432 if (ip->i_ino != mp->m_sb.sb_gquotino) 433 433 ASSERT(ip->i_gdquot); 434 434 }
+37 -37
fs/xfs/xfs_vfsops.c
··· 368 368 } 369 369 370 370 /* 371 - * disallow mount attempts with (IRIX) project quota enabled 372 - */ 373 - if (XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && 374 - (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT)) { 375 - cmn_err(CE_WARN, 376 - "XFS: cannot mount a filesystem with IRIX project quota enabled"); 377 - return XFS_ERROR(ENOSYS); 378 - } 379 - 380 - /* 381 371 * check for shared mount. 382 372 */ 383 373 if (ap->flags & XFSMNT_SHARED) { ··· 612 622 return XFS_ERROR(error); 613 623 } 614 624 615 - #define REMOUNT_READONLY_FLAGS (SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT) 625 + STATIC int 626 + xfs_quiesce_fs( 627 + xfs_mount_t *mp) 628 + { 629 + int count = 0, pincount; 630 + 631 + xfs_refcache_purge_mp(mp); 632 + xfs_flush_buftarg(mp->m_ddev_targp, 0); 633 + xfs_finish_reclaim_all(mp, 0); 634 + 635 + /* This loop must run at least twice. 636 + * The first instance of the loop will flush 637 + * most meta data but that will generate more 638 + * meta data (typically directory updates). 639 + * Which then must be flushed and logged before 640 + * we can write the unmount record. 641 + */ 642 + do { 643 + xfs_syncsub(mp, SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT, 0, NULL); 644 + pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1); 645 + if (!pincount) { 646 + delay(50); 647 + count++; 648 + } 649 + } while (count < 2); 650 + 651 + return 0; 652 + } 616 653 617 654 STATIC int 618 655 xfs_mntupdate( ··· 649 632 { 650 633 struct vfs *vfsp = bhvtovfs(bdp); 651 634 xfs_mount_t *mp = XFS_BHVTOM(bdp); 652 - int pincount, error; 653 - int count = 0; 635 + int error; 654 636 655 637 if (args->flags & XFSMNT_NOATIME) 656 638 mp->m_flags |= XFS_MOUNT_NOATIME; ··· 661 645 } 662 646 663 647 if (*flags & MS_RDONLY) { 664 - xfs_refcache_purge_mp(mp); 665 - xfs_flush_buftarg(mp->m_ddev_targp, 0); 666 - xfs_finish_reclaim_all(mp, 0); 667 - 668 - /* This loop must run at least twice. 669 - * The first instance of the loop will flush 670 - * most meta data but that will generate more 671 - * meta data (typically directory updates). 672 - * Which then must be flushed and logged before 673 - * we can write the unmount record. 674 - */ 675 - do { 676 - VFS_SYNC(vfsp, REMOUNT_READONLY_FLAGS, NULL, error); 677 - pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1); 678 - if (!pincount) { 679 - delay(50); 680 - count++; 681 - } 682 - } while (count < 2); 648 + xfs_quiesce_fs(mp); 683 649 684 650 /* Ok now write out an unmount record */ 685 651 xfs_log_unmount_write(mp); ··· 877 879 int flags, 878 880 cred_t *credp) 879 881 { 880 - xfs_mount_t *mp; 882 + xfs_mount_t *mp = XFS_BHVTOM(bdp); 881 883 882 - mp = XFS_BHVTOM(bdp); 883 - return (xfs_syncsub(mp, flags, 0, NULL)); 884 + if (unlikely(flags == SYNC_QUIESCE)) 885 + return xfs_quiesce_fs(mp); 886 + else 887 + return xfs_syncsub(mp, flags, 0, NULL); 884 888 } 885 889 886 890 /* ··· 1681 1681 return simple_strtoul(cp, endp, base) << shift_left_factor; 1682 1682 } 1683 1683 1684 - int 1684 + STATIC int 1685 1685 xfs_parseargs( 1686 1686 struct bhv_desc *bhv, 1687 1687 char *options, ··· 1867 1867 return 0; 1868 1868 } 1869 1869 1870 - int 1870 + STATIC int 1871 1871 xfs_showargs( 1872 1872 struct bhv_desc *bhv, 1873 1873 struct seq_file *m)
+64 -31
fs/xfs/xfs_vnodeops.c
··· 1 1 /* 2 - * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 2 + * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved. 3 3 * 4 4 * This program is free software; you can redistribute it and/or modify it 5 5 * under the terms of version 2 of the GNU General Public License as ··· 351 351 * If the IDs do change before we take the ilock, we're covered 352 352 * because the i_*dquot fields will get updated anyway. 353 353 */ 354 - if (XFS_IS_QUOTA_ON(mp) && (mask & (XFS_AT_UID|XFS_AT_GID))) { 354 + if (XFS_IS_QUOTA_ON(mp) && 355 + (mask & (XFS_AT_UID|XFS_AT_GID|XFS_AT_PROJID))) { 355 356 uint qflags = 0; 356 357 357 - if (mask & XFS_AT_UID) { 358 + if ((mask & XFS_AT_UID) && XFS_IS_UQUOTA_ON(mp)) { 358 359 uid = vap->va_uid; 359 360 qflags |= XFS_QMOPT_UQUOTA; 360 361 } else { 361 362 uid = ip->i_d.di_uid; 362 363 } 363 - if (mask & XFS_AT_GID) { 364 + if ((mask & XFS_AT_GID) && XFS_IS_GQUOTA_ON(mp)) { 364 365 gid = vap->va_gid; 365 366 qflags |= XFS_QMOPT_GQUOTA; 366 367 } else { 367 368 gid = ip->i_d.di_gid; 369 + } 370 + if ((mask & XFS_AT_PROJID) && XFS_IS_PQUOTA_ON(mp)) { 371 + projid = vap->va_projid; 372 + qflags |= XFS_QMOPT_PQUOTA; 373 + } else { 374 + projid = ip->i_d.di_projid; 368 375 } 369 376 /* 370 377 * We take a reference when we initialize udqp and gdqp, ··· 380 373 */ 381 374 ASSERT(udqp == NULL); 382 375 ASSERT(gdqp == NULL); 383 - code = XFS_QM_DQVOPALLOC(mp, ip, uid,gid, qflags, &udqp, &gdqp); 376 + code = XFS_QM_DQVOPALLOC(mp, ip, uid, gid, projid, qflags, 377 + &udqp, &gdqp); 384 378 if (code) 385 379 return (code); 386 380 } ··· 507 499 * that the group ID supplied to the chown() function 508 500 * shall be equal to either the group ID or one of the 509 501 * supplementary group IDs of the calling process. 510 - * 511 - * XXX: How does restricted_chown affect projid? 512 502 */ 513 503 if (restricted_chown && 514 504 (iuid != uid || (igid != gid && ··· 516 510 goto error_return; 517 511 } 518 512 /* 519 - * Do a quota reservation only if uid or gid is actually 513 + * Do a quota reservation only if uid/projid/gid is actually 520 514 * going to change. 521 515 */ 522 516 if ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) || 517 + (XFS_IS_PQUOTA_ON(mp) && iprojid != projid) || 523 518 (XFS_IS_GQUOTA_ON(mp) && igid != gid)) { 524 519 ASSERT(tp); 525 520 code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp, ··· 781 774 } 782 775 if (igid != gid) { 783 776 if (XFS_IS_GQUOTA_ON(mp)) { 777 + ASSERT(!XFS_IS_PQUOTA_ON(mp)); 784 778 ASSERT(mask & XFS_AT_GID); 785 779 ASSERT(gdqp); 786 780 olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip, ··· 790 782 ip->i_d.di_gid = gid; 791 783 } 792 784 if (iprojid != projid) { 785 + if (XFS_IS_PQUOTA_ON(mp)) { 786 + ASSERT(!XFS_IS_GQUOTA_ON(mp)); 787 + ASSERT(mask & XFS_AT_PROJID); 788 + ASSERT(gdqp); 789 + olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip, 790 + &ip->i_gdquot, gdqp); 791 + } 793 792 ip->i_d.di_projid = projid; 794 793 /* 795 794 * We may have to rev the inode as well as ··· 858 843 di_flags |= XFS_DIFLAG_NOATIME; 859 844 if (vap->va_xflags & XFS_XFLAG_NODUMP) 860 845 di_flags |= XFS_DIFLAG_NODUMP; 846 + if (vap->va_xflags & XFS_XFLAG_PROJINHERIT) 847 + di_flags |= XFS_DIFLAG_PROJINHERIT; 861 848 if ((ip->i_d.di_mode & S_IFMT) == S_IFDIR) { 862 849 if (vap->va_xflags & XFS_XFLAG_RTINHERIT) 863 850 di_flags |= XFS_DIFLAG_RTINHERIT; ··· 1915 1898 /* Return through std_return after this point. */ 1916 1899 1917 1900 udqp = gdqp = NULL; 1918 - if (vap->va_mask & XFS_AT_PROJID) 1901 + if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 1902 + prid = dp->i_d.di_projid; 1903 + else if (vap->va_mask & XFS_AT_PROJID) 1919 1904 prid = (xfs_prid_t)vap->va_projid; 1920 1905 else 1921 1906 prid = (xfs_prid_t)dfltprid; ··· 1926 1907 * Make sure that we have allocated dquot(s) on disk. 1927 1908 */ 1928 1909 error = XFS_QM_DQVOPALLOC(mp, dp, 1929 - current_fsuid(credp), current_fsgid(credp), 1910 + current_fsuid(credp), current_fsgid(credp), prid, 1930 1911 XFS_QMOPT_QUOTALL|XFS_QMOPT_INHERIT, &udqp, &gdqp); 1931 1912 if (error) 1932 1913 goto std_return; ··· 2623 2604 if (src_vp->v_type == VDIR) 2624 2605 return XFS_ERROR(EPERM); 2625 2606 2626 - /* 2627 - * For now, manually find the XFS behavior descriptor for 2628 - * the source vnode. If it doesn't exist then something 2629 - * is wrong and we should just return an error. 2630 - * Eventually we need to figure out how link is going to 2631 - * work in the face of stacked vnodes. 2632 - */ 2633 2607 src_bdp = vn_bhv_lookup_unlocked(VN_BHV_HEAD(src_vp), &xfs_vnodeops); 2634 - if (src_bdp == NULL) { 2635 - return XFS_ERROR(EXDEV); 2636 - } 2637 2608 sip = XFS_BHVTOI(src_bdp); 2638 2609 tdp = XFS_BHVTOI(target_dir_bdp); 2639 2610 mp = tdp->i_mount; ··· 2687 2678 */ 2688 2679 if (sip->i_d.di_nlink >= XFS_MAXLINK) { 2689 2680 error = XFS_ERROR(EMLINK); 2681 + goto error_return; 2682 + } 2683 + 2684 + /* 2685 + * If we are using project inheritance, we only allow hard link 2686 + * creation in our tree when the project IDs are the same; else 2687 + * the tree quota mechanism could be circumvented. 2688 + */ 2689 + if (unlikely((tdp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) && 2690 + (tdp->i_d.di_projid != sip->i_d.di_projid))) { 2691 + error = XFS_ERROR(EPERM); 2690 2692 goto error_return; 2691 2693 } 2692 2694 ··· 2823 2803 2824 2804 mp = dp->i_mount; 2825 2805 udqp = gdqp = NULL; 2826 - if (vap->va_mask & XFS_AT_PROJID) 2806 + if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 2807 + prid = dp->i_d.di_projid; 2808 + else if (vap->va_mask & XFS_AT_PROJID) 2827 2809 prid = (xfs_prid_t)vap->va_projid; 2828 2810 else 2829 2811 prid = (xfs_prid_t)dfltprid; ··· 2834 2812 * Make sure that we have allocated dquot(s) on disk. 2835 2813 */ 2836 2814 error = XFS_QM_DQVOPALLOC(mp, dp, 2837 - current_fsuid(credp), current_fsgid(credp), 2815 + current_fsuid(credp), current_fsgid(credp), prid, 2838 2816 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); 2839 2817 if (error) 2840 2818 goto std_return; ··· 3379 3357 /* Return through std_return after this point. */ 3380 3358 3381 3359 udqp = gdqp = NULL; 3382 - if (vap->va_mask & XFS_AT_PROJID) 3360 + if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) 3361 + prid = dp->i_d.di_projid; 3362 + else if (vap->va_mask & XFS_AT_PROJID) 3383 3363 prid = (xfs_prid_t)vap->va_projid; 3384 3364 else 3385 3365 prid = (xfs_prid_t)dfltprid; ··· 3390 3366 * Make sure that we have allocated dquot(s) on disk. 3391 3367 */ 3392 3368 error = XFS_QM_DQVOPALLOC(mp, dp, 3393 - current_fsuid(credp), current_fsgid(credp), 3369 + current_fsuid(credp), current_fsgid(credp), prid, 3394 3370 XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); 3395 3371 if (error) 3396 3372 goto std_return; ··· 4052 4028 * errno on error 4053 4029 * 4054 4030 */ 4055 - int 4031 + STATIC int 4056 4032 xfs_alloc_file_space( 4057 4033 xfs_inode_t *ip, 4058 4034 xfs_off_t offset, ··· 4175 4151 break; 4176 4152 } 4177 4153 xfs_ilock(ip, XFS_ILOCK_EXCL); 4178 - error = XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, 4179 - ip->i_udquot, ip->i_gdquot, resblks, 0, rt ? 4180 - XFS_QMOPT_RES_RTBLKS : XFS_QMOPT_RES_REGBLKS); 4154 + error = XFS_TRANS_RESERVE_QUOTA(mp, tp, 4155 + ip->i_udquot, ip->i_gdquot, resblks, 0, 0); 4181 4156 if (error) 4182 4157 goto error1; 4183 4158 ··· 4328 4305 xfs_off_t len, 4329 4306 int attr_flags) 4330 4307 { 4308 + vnode_t *vp; 4331 4309 int committed; 4332 4310 int done; 4333 4311 xfs_off_t end_dmi_offset; ··· 4349 4325 xfs_trans_t *tp; 4350 4326 int need_iolock = 1; 4351 4327 4352 - vn_trace_entry(XFS_ITOV(ip), __FUNCTION__, (inst_t *)__return_address); 4328 + vp = XFS_ITOV(ip); 4353 4329 mp = ip->i_mount; 4330 + 4331 + vn_trace_entry(vp, __FUNCTION__, (inst_t *)__return_address); 4354 4332 4355 4333 if ((error = XFS_QM_DQATTACH(mp, ip, 0))) 4356 4334 return error; ··· 4370 4344 DM_EVENT_ENABLED(XFS_MTOVFS(mp), ip, DM_EVENT_WRITE)) { 4371 4345 if (end_dmi_offset > ip->i_d.di_size) 4372 4346 end_dmi_offset = ip->i_d.di_size; 4373 - error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, XFS_ITOV(ip), 4347 + error = XFS_SEND_DATA(mp, DM_EVENT_WRITE, vp, 4374 4348 offset, end_dmi_offset - offset, 4375 4349 AT_DELAY_FLAG(attr_flags), NULL); 4376 4350 if (error) ··· 4389 4363 ioffset = offset & ~(rounding - 1); 4390 4364 if (ilen & (rounding - 1)) 4391 4365 ilen = (ilen + rounding) & ~(rounding - 1); 4392 - xfs_inval_cached_pages(XFS_ITOV(ip), &(ip->i_iocore), ioffset, 0, 0); 4366 + 4367 + if (VN_CACHED(vp) != 0) { 4368 + xfs_inval_cached_trace(&ip->i_iocore, ioffset, -1, 4369 + ctooff(offtoct(ioffset)), -1); 4370 + VOP_FLUSHINVAL_PAGES(vp, ctooff(offtoct(ioffset)), 4371 + -1, FI_REMAPF_LOCKED); 4372 + } 4373 + 4393 4374 /* 4394 4375 * Need to zero the stuff we're not freeing, on disk. 4395 4376 * If its a realtime file & can't use unwritten extents then we