aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c126
1 files changed, 57 insertions, 69 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index b76a829d7e20..108c7a085f94 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -27,13 +27,10 @@
27#include "xfs_trans_priv.h" 27#include "xfs_trans_priv.h"
28#include "xfs_sb.h" 28#include "xfs_sb.h"
29#include "xfs_ag.h" 29#include "xfs_ag.h"
30#include "xfs_dir2.h"
31#include "xfs_dmapi.h"
32#include "xfs_mount.h" 30#include "xfs_mount.h"
33#include "xfs_bmap_btree.h" 31#include "xfs_bmap_btree.h"
34#include "xfs_alloc_btree.h" 32#include "xfs_alloc_btree.h"
35#include "xfs_ialloc_btree.h" 33#include "xfs_ialloc_btree.h"
36#include "xfs_dir2_sf.h"
37#include "xfs_attr_sf.h" 34#include "xfs_attr_sf.h"
38#include "xfs_dinode.h" 35#include "xfs_dinode.h"
39#include "xfs_inode.h" 36#include "xfs_inode.h"
@@ -44,7 +41,6 @@
44#include "xfs_alloc.h" 41#include "xfs_alloc.h"
45#include "xfs_ialloc.h" 42#include "xfs_ialloc.h"
46#include "xfs_bmap.h" 43#include "xfs_bmap.h"
47#include "xfs_rw.h"
48#include "xfs_error.h" 44#include "xfs_error.h"
49#include "xfs_utils.h" 45#include "xfs_utils.h"
50#include "xfs_quota.h" 46#include "xfs_quota.h"
@@ -426,7 +422,7 @@ xfs_iformat(
426 if (!XFS_DFORK_Q(dip)) 422 if (!XFS_DFORK_Q(dip))
427 return 0; 423 return 0;
428 ASSERT(ip->i_afp == NULL); 424 ASSERT(ip->i_afp == NULL);
429 ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP); 425 ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP | KM_NOFS);
430 ip->i_afp->if_ext_max = 426 ip->i_afp->if_ext_max =
431 XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); 427 XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t);
432 switch (dip->di_aformat) { 428 switch (dip->di_aformat) {
@@ -509,7 +505,7 @@ xfs_iformat_local(
509 ifp->if_u1.if_data = ifp->if_u2.if_inline_data; 505 ifp->if_u1.if_data = ifp->if_u2.if_inline_data;
510 else { 506 else {
511 real_size = roundup(size, 4); 507 real_size = roundup(size, 4);
512 ifp->if_u1.if_data = kmem_alloc(real_size, KM_SLEEP); 508 ifp->if_u1.if_data = kmem_alloc(real_size, KM_SLEEP | KM_NOFS);
513 } 509 }
514 ifp->if_bytes = size; 510 ifp->if_bytes = size;
515 ifp->if_real_bytes = real_size; 511 ifp->if_real_bytes = real_size;
@@ -636,7 +632,7 @@ xfs_iformat_btree(
636 } 632 }
637 633
638 ifp->if_broot_bytes = size; 634 ifp->if_broot_bytes = size;
639 ifp->if_broot = kmem_alloc(size, KM_SLEEP); 635 ifp->if_broot = kmem_alloc(size, KM_SLEEP | KM_NOFS);
640 ASSERT(ifp->if_broot != NULL); 636 ASSERT(ifp->if_broot != NULL);
641 /* 637 /*
642 * Copy and convert from the on-disk structure 638 * Copy and convert from the on-disk structure
@@ -664,7 +660,8 @@ xfs_dinode_from_disk(
664 to->di_uid = be32_to_cpu(from->di_uid); 660 to->di_uid = be32_to_cpu(from->di_uid);
665 to->di_gid = be32_to_cpu(from->di_gid); 661 to->di_gid = be32_to_cpu(from->di_gid);
666 to->di_nlink = be32_to_cpu(from->di_nlink); 662 to->di_nlink = be32_to_cpu(from->di_nlink);
667 to->di_projid = be16_to_cpu(from->di_projid); 663 to->di_projid_lo = be16_to_cpu(from->di_projid_lo);
664 to->di_projid_hi = be16_to_cpu(from->di_projid_hi);
668 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad)); 665 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
669 to->di_flushiter = be16_to_cpu(from->di_flushiter); 666 to->di_flushiter = be16_to_cpu(from->di_flushiter);
670 to->di_atime.t_sec = be32_to_cpu(from->di_atime.t_sec); 667 to->di_atime.t_sec = be32_to_cpu(from->di_atime.t_sec);
@@ -699,7 +696,8 @@ xfs_dinode_to_disk(
699 to->di_uid = cpu_to_be32(from->di_uid); 696 to->di_uid = cpu_to_be32(from->di_uid);
700 to->di_gid = cpu_to_be32(from->di_gid); 697 to->di_gid = cpu_to_be32(from->di_gid);
701 to->di_nlink = cpu_to_be32(from->di_nlink); 698 to->di_nlink = cpu_to_be32(from->di_nlink);
702 to->di_projid = cpu_to_be16(from->di_projid); 699 to->di_projid_lo = cpu_to_be16(from->di_projid_lo);
700 to->di_projid_hi = cpu_to_be16(from->di_projid_hi);
703 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad)); 701 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
704 to->di_flushiter = cpu_to_be16(from->di_flushiter); 702 to->di_flushiter = cpu_to_be16(from->di_flushiter);
705 to->di_atime.t_sec = cpu_to_be32(from->di_atime.t_sec); 703 to->di_atime.t_sec = cpu_to_be32(from->di_atime.t_sec);
@@ -878,7 +876,7 @@ xfs_iread(
878 if (ip->i_d.di_version == 1) { 876 if (ip->i_d.di_version == 1) {
879 ip->i_d.di_nlink = ip->i_d.di_onlink; 877 ip->i_d.di_nlink = ip->i_d.di_onlink;
880 ip->i_d.di_onlink = 0; 878 ip->i_d.di_onlink = 0;
881 ip->i_d.di_projid = 0; 879 xfs_set_projid(ip, 0);
882 } 880 }
883 881
884 ip->i_delayed_blks = 0; 882 ip->i_delayed_blks = 0;
@@ -922,7 +920,6 @@ xfs_iread_extents(
922 int error; 920 int error;
923 xfs_ifork_t *ifp; 921 xfs_ifork_t *ifp;
924 xfs_extnum_t nextents; 922 xfs_extnum_t nextents;
925 size_t size;
926 923
927 if (unlikely(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) { 924 if (unlikely(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) {
928 XFS_ERROR_REPORT("xfs_iread_extents", XFS_ERRLEVEL_LOW, 925 XFS_ERROR_REPORT("xfs_iread_extents", XFS_ERRLEVEL_LOW,
@@ -930,7 +927,6 @@ xfs_iread_extents(
930 return XFS_ERROR(EFSCORRUPTED); 927 return XFS_ERROR(EFSCORRUPTED);
931 } 928 }
932 nextents = XFS_IFORK_NEXTENTS(ip, whichfork); 929 nextents = XFS_IFORK_NEXTENTS(ip, whichfork);
933 size = nextents * sizeof(xfs_bmbt_rec_t);
934 ifp = XFS_IFORK_PTR(ip, whichfork); 930 ifp = XFS_IFORK_PTR(ip, whichfork);
935 931
936 /* 932 /*
@@ -988,8 +984,7 @@ xfs_ialloc(
988 mode_t mode, 984 mode_t mode,
989 xfs_nlink_t nlink, 985 xfs_nlink_t nlink,
990 xfs_dev_t rdev, 986 xfs_dev_t rdev,
991 cred_t *cr, 987 prid_t prid,
992 xfs_prid_t prid,
993 int okalloc, 988 int okalloc,
994 xfs_buf_t **ialloc_context, 989 xfs_buf_t **ialloc_context,
995 boolean_t *call_again, 990 boolean_t *call_again,
@@ -1033,7 +1028,7 @@ xfs_ialloc(
1033 ASSERT(ip->i_d.di_nlink == nlink); 1028 ASSERT(ip->i_d.di_nlink == nlink);
1034 ip->i_d.di_uid = current_fsuid(); 1029 ip->i_d.di_uid = current_fsuid();
1035 ip->i_d.di_gid = current_fsgid(); 1030 ip->i_d.di_gid = current_fsgid();
1036 ip->i_d.di_projid = prid; 1031 xfs_set_projid(ip, prid);
1037 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); 1032 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
1038 1033
1039 /* 1034 /*
@@ -1226,7 +1221,7 @@ xfs_isize_check(
1226 (xfs_ufsize_t)XFS_MAXIOFFSET(mp)) - 1221 (xfs_ufsize_t)XFS_MAXIOFFSET(mp)) -
1227 map_first), 1222 map_first),
1228 XFS_BMAPI_ENTIRE, NULL, 0, imaps, &nimaps, 1223 XFS_BMAPI_ENTIRE, NULL, 0, imaps, &nimaps,
1229 NULL, NULL)) 1224 NULL))
1230 return; 1225 return;
1231 ASSERT(nimaps == 1); 1226 ASSERT(nimaps == 1);
1232 ASSERT(imaps[0].br_startblock == HOLESTARTBLOCK); 1227 ASSERT(imaps[0].br_startblock == HOLESTARTBLOCK);
@@ -1460,7 +1455,7 @@ xfs_itruncate_finish(
1460 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES); 1455 ASSERT((*tp)->t_flags & XFS_TRANS_PERM_LOG_RES);
1461 ASSERT(ip->i_transp == *tp); 1456 ASSERT(ip->i_transp == *tp);
1462 ASSERT(ip->i_itemp != NULL); 1457 ASSERT(ip->i_itemp != NULL);
1463 ASSERT(ip->i_itemp->ili_flags & XFS_ILI_HOLD); 1458 ASSERT(ip->i_itemp->ili_lock_flags == 0);
1464 1459
1465 1460
1466 ntp = *tp; 1461 ntp = *tp;
@@ -1589,11 +1584,10 @@ xfs_itruncate_finish(
1589 xfs_bmap_init(&free_list, &first_block); 1584 xfs_bmap_init(&free_list, &first_block);
1590 error = xfs_bunmapi(ntp, ip, 1585 error = xfs_bunmapi(ntp, ip,
1591 first_unmap_block, unmap_len, 1586 first_unmap_block, unmap_len,
1592 xfs_bmapi_aflag(fork) | 1587 xfs_bmapi_aflag(fork),
1593 (sync ? 0 : XFS_BMAPI_ASYNC),
1594 XFS_ITRUNC_MAX_EXTENTS, 1588 XFS_ITRUNC_MAX_EXTENTS,
1595 &first_block, &free_list, 1589 &first_block, &free_list,
1596 NULL, &done); 1590 &done);
1597 if (error) { 1591 if (error) {
1598 /* 1592 /*
1599 * If the bunmapi call encounters an error, 1593 * If the bunmapi call encounters an error,
@@ -1612,12 +1606,8 @@ xfs_itruncate_finish(
1612 */ 1606 */
1613 error = xfs_bmap_finish(tp, &free_list, &committed); 1607 error = xfs_bmap_finish(tp, &free_list, &committed);
1614 ntp = *tp; 1608 ntp = *tp;
1615 if (committed) { 1609 if (committed)
1616 /* link the inode into the next xact in the chain */ 1610 xfs_trans_ijoin(ntp, ip);
1617 xfs_trans_ijoin(ntp, ip,
1618 XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
1619 xfs_trans_ihold(ntp, ip);
1620 }
1621 1611
1622 if (error) { 1612 if (error) {
1623 /* 1613 /*
@@ -1646,9 +1636,7 @@ xfs_itruncate_finish(
1646 error = xfs_trans_commit(*tp, 0); 1636 error = xfs_trans_commit(*tp, 0);
1647 *tp = ntp; 1637 *tp = ntp;
1648 1638
1649 /* link the inode into the next transaction in the chain */ 1639 xfs_trans_ijoin(ntp, ip);
1650 xfs_trans_ijoin(ntp, ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
1651 xfs_trans_ihold(ntp, ip);
1652 1640
1653 if (error) 1641 if (error)
1654 return error; 1642 return error;
@@ -1927,6 +1915,11 @@ xfs_iunlink_remove(
1927 return 0; 1915 return 0;
1928} 1916}
1929 1917
1918/*
1919 * A big issue when freeing the inode cluster is is that we _cannot_ skip any
1920 * inodes that are in memory - they all must be marked stale and attached to
1921 * the cluster buffer.
1922 */
1930STATIC void 1923STATIC void
1931xfs_ifree_cluster( 1924xfs_ifree_cluster(
1932 xfs_inode_t *free_ip, 1925 xfs_inode_t *free_ip,
@@ -1958,8 +1951,6 @@ xfs_ifree_cluster(
1958 } 1951 }
1959 1952
1960 for (j = 0; j < nbufs; j++, inum += ninodes) { 1953 for (j = 0; j < nbufs; j++, inum += ninodes) {
1961 int found = 0;
1962
1963 blkno = XFS_AGB_TO_DADDR(mp, XFS_INO_TO_AGNO(mp, inum), 1954 blkno = XFS_AGB_TO_DADDR(mp, XFS_INO_TO_AGNO(mp, inum),
1964 XFS_INO_TO_AGBNO(mp, inum)); 1955 XFS_INO_TO_AGBNO(mp, inum));
1965 1956
@@ -1978,23 +1969,25 @@ xfs_ifree_cluster(
1978 /* 1969 /*
1979 * Walk the inodes already attached to the buffer and mark them 1970 * Walk the inodes already attached to the buffer and mark them
1980 * stale. These will all have the flush locks held, so an 1971 * stale. These will all have the flush locks held, so an
1981 * in-memory inode walk can't lock them. 1972 * in-memory inode walk can't lock them. By marking them all
1973 * stale first, we will not attempt to lock them in the loop
1974 * below as the XFS_ISTALE flag will be set.
1982 */ 1975 */
1983 lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *); 1976 lip = XFS_BUF_FSPRIVATE(bp, xfs_log_item_t *);
1984 while (lip) { 1977 while (lip) {
1985 if (lip->li_type == XFS_LI_INODE) { 1978 if (lip->li_type == XFS_LI_INODE) {
1986 iip = (xfs_inode_log_item_t *)lip; 1979 iip = (xfs_inode_log_item_t *)lip;
1987 ASSERT(iip->ili_logged == 1); 1980 ASSERT(iip->ili_logged == 1);
1988 lip->li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*)) xfs_istale_done; 1981 lip->li_cb = xfs_istale_done;
1989 xfs_trans_ail_copy_lsn(mp->m_ail, 1982 xfs_trans_ail_copy_lsn(mp->m_ail,
1990 &iip->ili_flush_lsn, 1983 &iip->ili_flush_lsn,
1991 &iip->ili_item.li_lsn); 1984 &iip->ili_item.li_lsn);
1992 xfs_iflags_set(iip->ili_inode, XFS_ISTALE); 1985 xfs_iflags_set(iip->ili_inode, XFS_ISTALE);
1993 found++;
1994 } 1986 }
1995 lip = lip->li_bio_list; 1987 lip = lip->li_bio_list;
1996 } 1988 }
1997 1989
1990
1998 /* 1991 /*
1999 * For each inode in memory attempt to add it to the inode 1992 * For each inode in memory attempt to add it to the inode
2000 * buffer and set it up for being staled on buffer IO 1993 * buffer and set it up for being staled on buffer IO
@@ -2006,6 +1999,7 @@ xfs_ifree_cluster(
2006 * even trying to lock them. 1999 * even trying to lock them.
2007 */ 2000 */
2008 for (i = 0; i < ninodes; i++) { 2001 for (i = 0; i < ninodes; i++) {
2002retry:
2009 read_lock(&pag->pag_ici_lock); 2003 read_lock(&pag->pag_ici_lock);
2010 ip = radix_tree_lookup(&pag->pag_ici_root, 2004 ip = radix_tree_lookup(&pag->pag_ici_root,
2011 XFS_INO_TO_AGINO(mp, (inum + i))); 2005 XFS_INO_TO_AGINO(mp, (inum + i)));
@@ -2016,38 +2010,36 @@ xfs_ifree_cluster(
2016 continue; 2010 continue;
2017 } 2011 }
2018 2012
2019 /* don't try to lock/unlock the current inode */ 2013 /*
2014 * Don't try to lock/unlock the current inode, but we
2015 * _cannot_ skip the other inodes that we did not find
2016 * in the list attached to the buffer and are not
2017 * already marked stale. If we can't lock it, back off
2018 * and retry.
2019 */
2020 if (ip != free_ip && 2020 if (ip != free_ip &&
2021 !xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) { 2021 !xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) {
2022 read_unlock(&pag->pag_ici_lock); 2022 read_unlock(&pag->pag_ici_lock);
2023 continue; 2023 delay(1);
2024 goto retry;
2024 } 2025 }
2025 read_unlock(&pag->pag_ici_lock); 2026 read_unlock(&pag->pag_ici_lock);
2026 2027
2027 if (!xfs_iflock_nowait(ip)) { 2028 xfs_iflock(ip);
2028 if (ip != free_ip)
2029 xfs_iunlock(ip, XFS_ILOCK_EXCL);
2030 continue;
2031 }
2032
2033 xfs_iflags_set(ip, XFS_ISTALE); 2029 xfs_iflags_set(ip, XFS_ISTALE);
2034 if (xfs_inode_clean(ip)) {
2035 ASSERT(ip != free_ip);
2036 xfs_ifunlock(ip);
2037 xfs_iunlock(ip, XFS_ILOCK_EXCL);
2038 continue;
2039 }
2040 2030
2031 /*
2032 * we don't need to attach clean inodes or those only
2033 * with unlogged changes (which we throw away, anyway).
2034 */
2041 iip = ip->i_itemp; 2035 iip = ip->i_itemp;
2042 if (!iip) { 2036 if (!iip || xfs_inode_clean(ip)) {
2043 /* inode with unlogged changes only */
2044 ASSERT(ip != free_ip); 2037 ASSERT(ip != free_ip);
2045 ip->i_update_core = 0; 2038 ip->i_update_core = 0;
2046 xfs_ifunlock(ip); 2039 xfs_ifunlock(ip);
2047 xfs_iunlock(ip, XFS_ILOCK_EXCL); 2040 xfs_iunlock(ip, XFS_ILOCK_EXCL);
2048 continue; 2041 continue;
2049 } 2042 }
2050 found++;
2051 2043
2052 iip->ili_last_fields = iip->ili_format.ilf_fields; 2044 iip->ili_last_fields = iip->ili_format.ilf_fields;
2053 iip->ili_format.ilf_fields = 0; 2045 iip->ili_format.ilf_fields = 0;
@@ -2055,16 +2047,14 @@ xfs_ifree_cluster(
2055 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn, 2047 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn,
2056 &iip->ili_item.li_lsn); 2048 &iip->ili_item.li_lsn);
2057 2049
2058 xfs_buf_attach_iodone(bp, 2050 xfs_buf_attach_iodone(bp, xfs_istale_done,
2059 (void(*)(xfs_buf_t*,xfs_log_item_t*)) 2051 &iip->ili_item);
2060 xfs_istale_done, (xfs_log_item_t *)iip);
2061 2052
2062 if (ip != free_ip) 2053 if (ip != free_ip)
2063 xfs_iunlock(ip, XFS_ILOCK_EXCL); 2054 xfs_iunlock(ip, XFS_ILOCK_EXCL);
2064 } 2055 }
2065 2056
2066 if (found) 2057 xfs_trans_stale_inode_buf(tp, bp);
2067 xfs_trans_stale_inode_buf(tp, bp);
2068 xfs_trans_binval(tp, bp); 2058 xfs_trans_binval(tp, bp);
2069 } 2059 }
2070 2060
@@ -2203,7 +2193,7 @@ xfs_iroot_realloc(
2203 */ 2193 */
2204 if (ifp->if_broot_bytes == 0) { 2194 if (ifp->if_broot_bytes == 0) {
2205 new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(rec_diff); 2195 new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(rec_diff);
2206 ifp->if_broot = kmem_alloc(new_size, KM_SLEEP); 2196 ifp->if_broot = kmem_alloc(new_size, KM_SLEEP | KM_NOFS);
2207 ifp->if_broot_bytes = (int)new_size; 2197 ifp->if_broot_bytes = (int)new_size;
2208 return; 2198 return;
2209 } 2199 }
@@ -2219,7 +2209,7 @@ xfs_iroot_realloc(
2219 new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(new_max); 2209 new_size = (size_t)XFS_BMAP_BROOT_SPACE_CALC(new_max);
2220 ifp->if_broot = kmem_realloc(ifp->if_broot, new_size, 2210 ifp->if_broot = kmem_realloc(ifp->if_broot, new_size,
2221 (size_t)XFS_BMAP_BROOT_SPACE_CALC(cur_max), /* old size */ 2211 (size_t)XFS_BMAP_BROOT_SPACE_CALC(cur_max), /* old size */
2222 KM_SLEEP); 2212 KM_SLEEP | KM_NOFS);
2223 op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, 2213 op = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
2224 ifp->if_broot_bytes); 2214 ifp->if_broot_bytes);
2225 np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1, 2215 np = (char *)XFS_BMAP_BROOT_PTR_ADDR(mp, ifp->if_broot, 1,
@@ -2245,7 +2235,7 @@ xfs_iroot_realloc(
2245 else 2235 else
2246 new_size = 0; 2236 new_size = 0;
2247 if (new_size > 0) { 2237 if (new_size > 0) {
2248 new_broot = kmem_alloc(new_size, KM_SLEEP); 2238 new_broot = kmem_alloc(new_size, KM_SLEEP | KM_NOFS);
2249 /* 2239 /*
2250 * First copy over the btree block header. 2240 * First copy over the btree block header.
2251 */ 2241 */
@@ -2349,7 +2339,8 @@ xfs_idata_realloc(
2349 real_size = roundup(new_size, 4); 2339 real_size = roundup(new_size, 4);
2350 if (ifp->if_u1.if_data == NULL) { 2340 if (ifp->if_u1.if_data == NULL) {
2351 ASSERT(ifp->if_real_bytes == 0); 2341 ASSERT(ifp->if_real_bytes == 0);
2352 ifp->if_u1.if_data = kmem_alloc(real_size, KM_SLEEP); 2342 ifp->if_u1.if_data = kmem_alloc(real_size,
2343 KM_SLEEP | KM_NOFS);
2353 } else if (ifp->if_u1.if_data != ifp->if_u2.if_inline_data) { 2344 } else if (ifp->if_u1.if_data != ifp->if_u2.if_inline_data) {
2354 /* 2345 /*
2355 * Only do the realloc if the underlying size 2346 * Only do the realloc if the underlying size
@@ -2360,11 +2351,12 @@ xfs_idata_realloc(
2360 kmem_realloc(ifp->if_u1.if_data, 2351 kmem_realloc(ifp->if_u1.if_data,
2361 real_size, 2352 real_size,
2362 ifp->if_real_bytes, 2353 ifp->if_real_bytes,
2363 KM_SLEEP); 2354 KM_SLEEP | KM_NOFS);
2364 } 2355 }
2365 } else { 2356 } else {
2366 ASSERT(ifp->if_real_bytes == 0); 2357 ASSERT(ifp->if_real_bytes == 0);
2367 ifp->if_u1.if_data = kmem_alloc(real_size, KM_SLEEP); 2358 ifp->if_u1.if_data = kmem_alloc(real_size,
2359 KM_SLEEP | KM_NOFS);
2368 memcpy(ifp->if_u1.if_data, ifp->if_u2.if_inline_data, 2360 memcpy(ifp->if_u1.if_data, ifp->if_u2.if_inline_data,
2369 ifp->if_bytes); 2361 ifp->if_bytes);
2370 } 2362 }
@@ -2731,11 +2723,10 @@ cluster_corrupt_out:
2731 * mark it as stale and brelse. 2723 * mark it as stale and brelse.
2732 */ 2724 */
2733 if (XFS_BUF_IODONE_FUNC(bp)) { 2725 if (XFS_BUF_IODONE_FUNC(bp)) {
2734 XFS_BUF_CLR_BDSTRAT_FUNC(bp);
2735 XFS_BUF_UNDONE(bp); 2726 XFS_BUF_UNDONE(bp);
2736 XFS_BUF_STALE(bp); 2727 XFS_BUF_STALE(bp);
2737 XFS_BUF_ERROR(bp,EIO); 2728 XFS_BUF_ERROR(bp,EIO);
2738 xfs_biodone(bp); 2729 xfs_buf_ioend(bp, 0);
2739 } else { 2730 } else {
2740 XFS_BUF_STALE(bp); 2731 XFS_BUF_STALE(bp);
2741 xfs_buf_relse(bp); 2732 xfs_buf_relse(bp);
@@ -3018,7 +3009,7 @@ xfs_iflush_int(
3018 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); 3009 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
3019 memset(&(dip->di_pad[0]), 0, 3010 memset(&(dip->di_pad[0]), 0,
3020 sizeof(dip->di_pad)); 3011 sizeof(dip->di_pad));
3021 ASSERT(ip->i_d.di_projid == 0); 3012 ASSERT(xfs_get_projid(ip) == 0);
3022 } 3013 }
3023 } 3014 }
3024 3015
@@ -3069,8 +3060,7 @@ xfs_iflush_int(
3069 * and unlock the inode's flush lock when the inode is 3060 * and unlock the inode's flush lock when the inode is
3070 * completely written to disk. 3061 * completely written to disk.
3071 */ 3062 */
3072 xfs_buf_attach_iodone(bp, (void(*)(xfs_buf_t*,xfs_log_item_t*)) 3063 xfs_buf_attach_iodone(bp, xfs_iflush_done, &iip->ili_item);
3073 xfs_iflush_done, (xfs_log_item_t *)iip);
3074 3064
3075 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 3065 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
3076 ASSERT(XFS_BUF_IODONE_FUNC(bp) != NULL); 3066 ASSERT(XFS_BUF_IODONE_FUNC(bp) != NULL);
@@ -3514,13 +3504,11 @@ xfs_iext_remove_indirect(
3514 xfs_extnum_t ext_diff; /* extents to remove in current list */ 3504 xfs_extnum_t ext_diff; /* extents to remove in current list */
3515 xfs_extnum_t nex1; /* number of extents before idx */ 3505 xfs_extnum_t nex1; /* number of extents before idx */
3516 xfs_extnum_t nex2; /* extents after idx + count */ 3506 xfs_extnum_t nex2; /* extents after idx + count */
3517 int nlists; /* entries in indirection array */
3518 int page_idx = idx; /* index in target extent list */ 3507 int page_idx = idx; /* index in target extent list */
3519 3508
3520 ASSERT(ifp->if_flags & XFS_IFEXTIREC); 3509 ASSERT(ifp->if_flags & XFS_IFEXTIREC);
3521 erp = xfs_iext_idx_to_irec(ifp, &page_idx, &erp_idx, 0); 3510 erp = xfs_iext_idx_to_irec(ifp, &page_idx, &erp_idx, 0);
3522 ASSERT(erp != NULL); 3511 ASSERT(erp != NULL);
3523 nlists = ifp->if_real_bytes / XFS_IEXT_BUFSZ;
3524 nex1 = page_idx; 3512 nex1 = page_idx;
3525 ext_cnt = count; 3513 ext_cnt = count;
3526 while (ext_cnt) { 3514 while (ext_cnt) {