diff options
Diffstat (limited to 'fs/xfs/xfs_super.c')
-rw-r--r-- | fs/xfs/xfs_super.c | 88 |
1 files changed, 5 insertions, 83 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 0d9de41a7151..bdaf4cb9f4a2 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -868,67 +868,14 @@ xfs_fs_inode_init_once( | |||
868 | "xfsino", ip->i_ino); | 868 | "xfsino", ip->i_ino); |
869 | } | 869 | } |
870 | 870 | ||
871 | /* | ||
872 | * This is called by the VFS when dirtying inode metadata. This can happen | ||
873 | * for a few reasons, but we only care about timestamp updates, given that | ||
874 | * we handled the rest ourselves. In theory no other calls should happen, | ||
875 | * but for example generic_write_end() keeps dirtying the inode after | ||
876 | * updating i_size. Thus we check that the flags are exactly I_DIRTY_SYNC, | ||
877 | * and skip this call otherwise. | ||
878 | * | ||
879 | * We'll hopefull get a different method just for updating timestamps soon, | ||
880 | * at which point this hack can go away, and maybe we'll also get real | ||
881 | * error handling here. | ||
882 | */ | ||
883 | STATIC void | ||
884 | xfs_fs_dirty_inode( | ||
885 | struct inode *inode, | ||
886 | int flags) | ||
887 | { | ||
888 | struct xfs_inode *ip = XFS_I(inode); | ||
889 | struct xfs_mount *mp = ip->i_mount; | ||
890 | struct xfs_trans *tp; | ||
891 | int error; | ||
892 | |||
893 | if (flags != I_DIRTY_SYNC) | ||
894 | return; | ||
895 | |||
896 | trace_xfs_dirty_inode(ip); | ||
897 | |||
898 | tp = xfs_trans_alloc(mp, XFS_TRANS_FSYNC_TS); | ||
899 | error = xfs_trans_reserve(tp, 0, XFS_FSYNC_TS_LOG_RES(mp), 0, 0, 0); | ||
900 | if (error) { | ||
901 | xfs_trans_cancel(tp, 0); | ||
902 | goto trouble; | ||
903 | } | ||
904 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
905 | /* | ||
906 | * Grab all the latest timestamps from the Linux inode. | ||
907 | */ | ||
908 | ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec; | ||
909 | ip->i_d.di_atime.t_nsec = (__int32_t)inode->i_atime.tv_nsec; | ||
910 | ip->i_d.di_ctime.t_sec = (__int32_t)inode->i_ctime.tv_sec; | ||
911 | ip->i_d.di_ctime.t_nsec = (__int32_t)inode->i_ctime.tv_nsec; | ||
912 | ip->i_d.di_mtime.t_sec = (__int32_t)inode->i_mtime.tv_sec; | ||
913 | ip->i_d.di_mtime.t_nsec = (__int32_t)inode->i_mtime.tv_nsec; | ||
914 | |||
915 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | ||
916 | xfs_trans_log_inode(tp, ip, XFS_ILOG_TIMESTAMP); | ||
917 | error = xfs_trans_commit(tp, 0); | ||
918 | if (error) | ||
919 | goto trouble; | ||
920 | return; | ||
921 | |||
922 | trouble: | ||
923 | xfs_warn(mp, "failed to update timestamps for inode 0x%llx", ip->i_ino); | ||
924 | } | ||
925 | |||
926 | STATIC void | 871 | STATIC void |
927 | xfs_fs_evict_inode( | 872 | xfs_fs_evict_inode( |
928 | struct inode *inode) | 873 | struct inode *inode) |
929 | { | 874 | { |
930 | xfs_inode_t *ip = XFS_I(inode); | 875 | xfs_inode_t *ip = XFS_I(inode); |
931 | 876 | ||
877 | ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock)); | ||
878 | |||
932 | trace_xfs_evict_inode(ip); | 879 | trace_xfs_evict_inode(ip); |
933 | 880 | ||
934 | truncate_inode_pages(&inode->i_data, 0); | 881 | truncate_inode_pages(&inode->i_data, 0); |
@@ -937,22 +884,6 @@ xfs_fs_evict_inode( | |||
937 | XFS_STATS_INC(vn_remove); | 884 | XFS_STATS_INC(vn_remove); |
938 | XFS_STATS_DEC(vn_active); | 885 | XFS_STATS_DEC(vn_active); |
939 | 886 | ||
940 | /* | ||
941 | * The iolock is used by the file system to coordinate reads, | ||
942 | * writes, and block truncates. Up to this point the lock | ||
943 | * protected concurrent accesses by users of the inode. But | ||
944 | * from here forward we're doing some final processing of the | ||
945 | * inode because we're done with it, and although we reuse the | ||
946 | * iolock for protection it is really a distinct lock class | ||
947 | * (in the lockdep sense) from before. To keep lockdep happy | ||
948 | * (and basically indicate what we are doing), we explicitly | ||
949 | * re-init the iolock here. | ||
950 | */ | ||
951 | ASSERT(!rwsem_is_locked(&ip->i_iolock.mr_lock)); | ||
952 | mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino); | ||
953 | lockdep_set_class_and_name(&ip->i_iolock.mr_lock, | ||
954 | &xfs_iolock_reclaimable, "xfs_iolock_reclaimable"); | ||
955 | |||
956 | xfs_inactive(ip); | 887 | xfs_inactive(ip); |
957 | } | 888 | } |
958 | 889 | ||
@@ -1436,7 +1367,6 @@ xfs_fs_free_cached_objects( | |||
1436 | static const struct super_operations xfs_super_operations = { | 1367 | static const struct super_operations xfs_super_operations = { |
1437 | .alloc_inode = xfs_fs_alloc_inode, | 1368 | .alloc_inode = xfs_fs_alloc_inode, |
1438 | .destroy_inode = xfs_fs_destroy_inode, | 1369 | .destroy_inode = xfs_fs_destroy_inode, |
1439 | .dirty_inode = xfs_fs_dirty_inode, | ||
1440 | .evict_inode = xfs_fs_evict_inode, | 1370 | .evict_inode = xfs_fs_evict_inode, |
1441 | .drop_inode = xfs_fs_drop_inode, | 1371 | .drop_inode = xfs_fs_drop_inode, |
1442 | .put_super = xfs_fs_put_super, | 1372 | .put_super = xfs_fs_put_super, |
@@ -1491,13 +1421,9 @@ xfs_init_zones(void) | |||
1491 | if (!xfs_da_state_zone) | 1421 | if (!xfs_da_state_zone) |
1492 | goto out_destroy_btree_cur_zone; | 1422 | goto out_destroy_btree_cur_zone; |
1493 | 1423 | ||
1494 | xfs_dabuf_zone = kmem_zone_init(sizeof(xfs_dabuf_t), "xfs_dabuf"); | ||
1495 | if (!xfs_dabuf_zone) | ||
1496 | goto out_destroy_da_state_zone; | ||
1497 | |||
1498 | xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork"); | 1424 | xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork"); |
1499 | if (!xfs_ifork_zone) | 1425 | if (!xfs_ifork_zone) |
1500 | goto out_destroy_dabuf_zone; | 1426 | goto out_destroy_da_state_zone; |
1501 | 1427 | ||
1502 | xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans"); | 1428 | xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans"); |
1503 | if (!xfs_trans_zone) | 1429 | if (!xfs_trans_zone) |
@@ -1514,9 +1440,8 @@ xfs_init_zones(void) | |||
1514 | * size possible under XFS. This wastes a little bit of memory, | 1440 | * size possible under XFS. This wastes a little bit of memory, |
1515 | * but it is much faster. | 1441 | * but it is much faster. |
1516 | */ | 1442 | */ |
1517 | xfs_buf_item_zone = kmem_zone_init((sizeof(xfs_buf_log_item_t) + | 1443 | xfs_buf_item_zone = kmem_zone_init(sizeof(struct xfs_buf_log_item), |
1518 | (((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / | 1444 | "xfs_buf_item"); |
1519 | NBWORD) * sizeof(int))), "xfs_buf_item"); | ||
1520 | if (!xfs_buf_item_zone) | 1445 | if (!xfs_buf_item_zone) |
1521 | goto out_destroy_log_item_desc_zone; | 1446 | goto out_destroy_log_item_desc_zone; |
1522 | 1447 | ||
@@ -1561,8 +1486,6 @@ xfs_init_zones(void) | |||
1561 | kmem_zone_destroy(xfs_trans_zone); | 1486 | kmem_zone_destroy(xfs_trans_zone); |
1562 | out_destroy_ifork_zone: | 1487 | out_destroy_ifork_zone: |
1563 | kmem_zone_destroy(xfs_ifork_zone); | 1488 | kmem_zone_destroy(xfs_ifork_zone); |
1564 | out_destroy_dabuf_zone: | ||
1565 | kmem_zone_destroy(xfs_dabuf_zone); | ||
1566 | out_destroy_da_state_zone: | 1489 | out_destroy_da_state_zone: |
1567 | kmem_zone_destroy(xfs_da_state_zone); | 1490 | kmem_zone_destroy(xfs_da_state_zone); |
1568 | out_destroy_btree_cur_zone: | 1491 | out_destroy_btree_cur_zone: |
@@ -1590,7 +1513,6 @@ xfs_destroy_zones(void) | |||
1590 | kmem_zone_destroy(xfs_log_item_desc_zone); | 1513 | kmem_zone_destroy(xfs_log_item_desc_zone); |
1591 | kmem_zone_destroy(xfs_trans_zone); | 1514 | kmem_zone_destroy(xfs_trans_zone); |
1592 | kmem_zone_destroy(xfs_ifork_zone); | 1515 | kmem_zone_destroy(xfs_ifork_zone); |
1593 | kmem_zone_destroy(xfs_dabuf_zone); | ||
1594 | kmem_zone_destroy(xfs_da_state_zone); | 1516 | kmem_zone_destroy(xfs_da_state_zone); |
1595 | kmem_zone_destroy(xfs_btree_cur_zone); | 1517 | kmem_zone_destroy(xfs_btree_cur_zone); |
1596 | kmem_zone_destroy(xfs_bmap_free_item_zone); | 1518 | kmem_zone_destroy(xfs_bmap_free_item_zone); |