diff options
-rw-r--r-- | Documentation/filesystems/ocfs2.txt | 6 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2.h | 7 | ||||
-rw-r--r-- | fs/ocfs2/refcounttree.c | 69 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 20 | ||||
-rw-r--r-- | fs/ocfs2/uptodate.c | 5 |
6 files changed, 83 insertions, 27 deletions
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt index c2a0871280a0..c58b9f5ba002 100644 --- a/Documentation/filesystems/ocfs2.txt +++ b/Documentation/filesystems/ocfs2.txt | |||
@@ -20,15 +20,16 @@ Lots of code taken from ext3 and other projects. | |||
20 | Authors in alphabetical order: | 20 | Authors in alphabetical order: |
21 | Joel Becker <joel.becker@oracle.com> | 21 | Joel Becker <joel.becker@oracle.com> |
22 | Zach Brown <zach.brown@oracle.com> | 22 | Zach Brown <zach.brown@oracle.com> |
23 | Mark Fasheh <mark.fasheh@oracle.com> | 23 | Mark Fasheh <mfasheh@suse.com> |
24 | Kurt Hackel <kurt.hackel@oracle.com> | 24 | Kurt Hackel <kurt.hackel@oracle.com> |
25 | Tao Ma <tao.ma@oracle.com> | ||
25 | Sunil Mushran <sunil.mushran@oracle.com> | 26 | Sunil Mushran <sunil.mushran@oracle.com> |
26 | Manish Singh <manish.singh@oracle.com> | 27 | Manish Singh <manish.singh@oracle.com> |
28 | Tiger Yang <tiger.yang@oracle.com> | ||
27 | 29 | ||
28 | Caveats | 30 | Caveats |
29 | ======= | 31 | ======= |
30 | Features which OCFS2 does not support yet: | 32 | Features which OCFS2 does not support yet: |
31 | - quotas | ||
32 | - Directory change notification (F_NOTIFY) | 33 | - Directory change notification (F_NOTIFY) |
33 | - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease) | 34 | - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease) |
34 | 35 | ||
@@ -70,7 +71,6 @@ commit=nrsec (*) Ocfs2 can be told to sync all its data and metadata | |||
70 | performance. | 71 | performance. |
71 | localalloc=8(*) Allows custom localalloc size in MB. If the value is too | 72 | localalloc=8(*) Allows custom localalloc size in MB. If the value is too |
72 | large, the fs will silently revert it to the default. | 73 | large, the fs will silently revert it to the default. |
73 | Localalloc is not enabled for local mounts. | ||
74 | localflocks This disables cluster aware flock. | 74 | localflocks This disables cluster aware flock. |
75 | inode64 Indicates that Ocfs2 is allowed to create inodes at | 75 | inode64 Indicates that Ocfs2 is allowed to create inodes at |
76 | any location in the filesystem, including those which | 76 | any location in the filesystem, including those which |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 89fc8ee1f5a5..de059f490586 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1712,7 +1712,8 @@ int ocfs2_check_range_for_refcount(struct inode *inode, loff_t pos, | |||
1712 | struct super_block *sb = inode->i_sb; | 1712 | struct super_block *sb = inode->i_sb; |
1713 | 1713 | ||
1714 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)) || | 1714 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb)) || |
1715 | !(OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL)) | 1715 | !(OCFS2_I(inode)->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL) || |
1716 | OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) | ||
1716 | return 0; | 1717 | return 0; |
1717 | 1718 | ||
1718 | cpos = pos >> OCFS2_SB(sb)->s_clustersize_bits; | 1719 | cpos = pos >> OCFS2_SB(sb)->s_clustersize_bits; |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index eae404602424..d963d8638709 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -35,12 +35,7 @@ | |||
35 | #include <linux/kref.h> | 35 | #include <linux/kref.h> |
36 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
37 | #include <linux/lockdep.h> | 37 | #include <linux/lockdep.h> |
38 | #ifndef CONFIG_OCFS2_COMPAT_JBD | 38 | #include <linux/jbd2.h> |
39 | # include <linux/jbd2.h> | ||
40 | #else | ||
41 | # include <linux/jbd.h> | ||
42 | # include "ocfs2_jbd_compat.h" | ||
43 | #endif | ||
44 | 39 | ||
45 | /* For union ocfs2_dlm_lksb */ | 40 | /* For union ocfs2_dlm_lksb */ |
46 | #include "stackglue.h" | 41 | #include "stackglue.h" |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 60287fc56bcb..3a0df7a1b810 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -3743,6 +3743,9 @@ static int ocfs2_attach_refcount_tree(struct inode *inode, | |||
3743 | goto out; | 3743 | goto out; |
3744 | } | 3744 | } |
3745 | 3745 | ||
3746 | if (oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) | ||
3747 | goto attach_xattr; | ||
3748 | |||
3746 | ocfs2_init_dinode_extent_tree(&di_et, INODE_CACHE(inode), di_bh); | 3749 | ocfs2_init_dinode_extent_tree(&di_et, INODE_CACHE(inode), di_bh); |
3747 | 3750 | ||
3748 | size = i_size_read(inode); | 3751 | size = i_size_read(inode); |
@@ -3769,6 +3772,7 @@ static int ocfs2_attach_refcount_tree(struct inode *inode, | |||
3769 | cpos += num_clusters; | 3772 | cpos += num_clusters; |
3770 | } | 3773 | } |
3771 | 3774 | ||
3775 | attach_xattr: | ||
3772 | if (oi->ip_dyn_features & OCFS2_HAS_XATTR_FL) { | 3776 | if (oi->ip_dyn_features & OCFS2_HAS_XATTR_FL) { |
3773 | ret = ocfs2_xattr_attach_refcount_tree(inode, di_bh, | 3777 | ret = ocfs2_xattr_attach_refcount_tree(inode, di_bh, |
3774 | &ref_tree->rf_ci, | 3778 | &ref_tree->rf_ci, |
@@ -3858,6 +3862,49 @@ out: | |||
3858 | return ret; | 3862 | return ret; |
3859 | } | 3863 | } |
3860 | 3864 | ||
3865 | static int ocfs2_duplicate_inline_data(struct inode *s_inode, | ||
3866 | struct buffer_head *s_bh, | ||
3867 | struct inode *t_inode, | ||
3868 | struct buffer_head *t_bh) | ||
3869 | { | ||
3870 | int ret; | ||
3871 | handle_t *handle; | ||
3872 | struct ocfs2_super *osb = OCFS2_SB(s_inode->i_sb); | ||
3873 | struct ocfs2_dinode *s_di = (struct ocfs2_dinode *)s_bh->b_data; | ||
3874 | struct ocfs2_dinode *t_di = (struct ocfs2_dinode *)t_bh->b_data; | ||
3875 | |||
3876 | BUG_ON(!(OCFS2_I(s_inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)); | ||
3877 | |||
3878 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | ||
3879 | if (IS_ERR(handle)) { | ||
3880 | ret = PTR_ERR(handle); | ||
3881 | mlog_errno(ret); | ||
3882 | goto out; | ||
3883 | } | ||
3884 | |||
3885 | ret = ocfs2_journal_access_di(handle, INODE_CACHE(t_inode), t_bh, | ||
3886 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
3887 | if (ret) { | ||
3888 | mlog_errno(ret); | ||
3889 | goto out_commit; | ||
3890 | } | ||
3891 | |||
3892 | t_di->id2.i_data.id_count = s_di->id2.i_data.id_count; | ||
3893 | memcpy(t_di->id2.i_data.id_data, s_di->id2.i_data.id_data, | ||
3894 | le16_to_cpu(s_di->id2.i_data.id_count)); | ||
3895 | spin_lock(&OCFS2_I(t_inode)->ip_lock); | ||
3896 | OCFS2_I(t_inode)->ip_dyn_features |= OCFS2_INLINE_DATA_FL; | ||
3897 | t_di->i_dyn_features = cpu_to_le16(OCFS2_I(t_inode)->ip_dyn_features); | ||
3898 | spin_unlock(&OCFS2_I(t_inode)->ip_lock); | ||
3899 | |||
3900 | ocfs2_journal_dirty(handle, t_bh); | ||
3901 | |||
3902 | out_commit: | ||
3903 | ocfs2_commit_trans(osb, handle); | ||
3904 | out: | ||
3905 | return ret; | ||
3906 | } | ||
3907 | |||
3861 | static int ocfs2_duplicate_extent_list(struct inode *s_inode, | 3908 | static int ocfs2_duplicate_extent_list(struct inode *s_inode, |
3862 | struct inode *t_inode, | 3909 | struct inode *t_inode, |
3863 | struct buffer_head *t_bh, | 3910 | struct buffer_head *t_bh, |
@@ -3997,6 +4044,14 @@ static int ocfs2_create_reflink_node(struct inode *s_inode, | |||
3997 | goto out; | 4044 | goto out; |
3998 | } | 4045 | } |
3999 | 4046 | ||
4047 | if (OCFS2_I(s_inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { | ||
4048 | ret = ocfs2_duplicate_inline_data(s_inode, s_bh, | ||
4049 | t_inode, t_bh); | ||
4050 | if (ret) | ||
4051 | mlog_errno(ret); | ||
4052 | goto out; | ||
4053 | } | ||
4054 | |||
4000 | ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), | 4055 | ret = ocfs2_lock_refcount_tree(osb, le64_to_cpu(di->i_refcount_loc), |
4001 | 1, &ref_tree, &ref_root_bh); | 4056 | 1, &ref_tree, &ref_root_bh); |
4002 | if (ret) { | 4057 | if (ret) { |
@@ -4013,10 +4068,6 @@ static int ocfs2_create_reflink_node(struct inode *s_inode, | |||
4013 | goto out_unlock_refcount; | 4068 | goto out_unlock_refcount; |
4014 | } | 4069 | } |
4015 | 4070 | ||
4016 | ret = ocfs2_complete_reflink(s_inode, s_bh, t_inode, t_bh, preserve); | ||
4017 | if (ret) | ||
4018 | mlog_errno(ret); | ||
4019 | |||
4020 | out_unlock_refcount: | 4071 | out_unlock_refcount: |
4021 | ocfs2_unlock_refcount_tree(osb, ref_tree, 1); | 4072 | ocfs2_unlock_refcount_tree(osb, ref_tree, 1); |
4022 | brelse(ref_root_bh); | 4073 | brelse(ref_root_bh); |
@@ -4068,9 +4119,17 @@ static int __ocfs2_reflink(struct dentry *old_dentry, | |||
4068 | ret = ocfs2_reflink_xattrs(inode, old_bh, | 4119 | ret = ocfs2_reflink_xattrs(inode, old_bh, |
4069 | new_inode, new_bh, | 4120 | new_inode, new_bh, |
4070 | preserve); | 4121 | preserve); |
4071 | if (ret) | 4122 | if (ret) { |
4072 | mlog_errno(ret); | 4123 | mlog_errno(ret); |
4124 | goto inode_unlock; | ||
4125 | } | ||
4073 | } | 4126 | } |
4127 | |||
4128 | ret = ocfs2_complete_reflink(inode, old_bh, | ||
4129 | new_inode, new_bh, preserve); | ||
4130 | if (ret) | ||
4131 | mlog_errno(ret); | ||
4132 | |||
4074 | inode_unlock: | 4133 | inode_unlock: |
4075 | ocfs2_inode_unlock(new_inode, 1); | 4134 | ocfs2_inode_unlock(new_inode, 1); |
4076 | brelse(new_bh); | 4135 | brelse(new_bh); |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index c0e48aeebb1c..14f47d2bfe02 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -773,18 +773,20 @@ static int ocfs2_sb_probe(struct super_block *sb, | |||
773 | if (tmpstat < 0) { | 773 | if (tmpstat < 0) { |
774 | status = tmpstat; | 774 | status = tmpstat; |
775 | mlog_errno(status); | 775 | mlog_errno(status); |
776 | goto bail; | 776 | break; |
777 | } | 777 | } |
778 | di = (struct ocfs2_dinode *) (*bh)->b_data; | 778 | di = (struct ocfs2_dinode *) (*bh)->b_data; |
779 | memset(stats, 0, sizeof(struct ocfs2_blockcheck_stats)); | 779 | memset(stats, 0, sizeof(struct ocfs2_blockcheck_stats)); |
780 | spin_lock_init(&stats->b_lock); | 780 | spin_lock_init(&stats->b_lock); |
781 | status = ocfs2_verify_volume(di, *bh, blksize, stats); | 781 | tmpstat = ocfs2_verify_volume(di, *bh, blksize, stats); |
782 | if (status >= 0) | 782 | if (tmpstat < 0) { |
783 | goto bail; | 783 | brelse(*bh); |
784 | brelse(*bh); | 784 | *bh = NULL; |
785 | *bh = NULL; | 785 | } |
786 | if (status != -EAGAIN) | 786 | if (tmpstat != -EAGAIN) { |
787 | status = tmpstat; | ||
787 | break; | 788 | break; |
789 | } | ||
788 | } | 790 | } |
789 | 791 | ||
790 | bail: | 792 | bail: |
@@ -1645,6 +1647,10 @@ static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
1645 | buf->f_bavail = buf->f_bfree; | 1647 | buf->f_bavail = buf->f_bfree; |
1646 | buf->f_files = numbits; | 1648 | buf->f_files = numbits; |
1647 | buf->f_ffree = freebits; | 1649 | buf->f_ffree = freebits; |
1650 | buf->f_fsid.val[0] = crc32_le(0, osb->uuid_str, OCFS2_VOL_UUID_LEN) | ||
1651 | & 0xFFFFFFFFUL; | ||
1652 | buf->f_fsid.val[1] = crc32_le(0, osb->uuid_str + OCFS2_VOL_UUID_LEN, | ||
1653 | OCFS2_VOL_UUID_LEN) & 0xFFFFFFFFUL; | ||
1648 | 1654 | ||
1649 | brelse(bh); | 1655 | brelse(bh); |
1650 | 1656 | ||
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c index b6284f235d2f..c61369342a27 100644 --- a/fs/ocfs2/uptodate.c +++ b/fs/ocfs2/uptodate.c | |||
@@ -53,11 +53,6 @@ | |||
53 | #include <linux/highmem.h> | 53 | #include <linux/highmem.h> |
54 | #include <linux/buffer_head.h> | 54 | #include <linux/buffer_head.h> |
55 | #include <linux/rbtree.h> | 55 | #include <linux/rbtree.h> |
56 | #ifndef CONFIG_OCFS2_COMPAT_JBD | ||
57 | # include <linux/jbd2.h> | ||
58 | #else | ||
59 | # include <linux/jbd.h> | ||
60 | #endif | ||
61 | 56 | ||
62 | #define MLOG_MASK_PREFIX ML_UPTODATE | 57 | #define MLOG_MASK_PREFIX ML_UPTODATE |
63 | 58 | ||