aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exofs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exofs/inode.c')
-rw-r--r--fs/exofs/inode.c56
1 files changed, 51 insertions, 5 deletions
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
index 03189a958b33..0163546ba05a 100644
--- a/fs/exofs/inode.c
+++ b/fs/exofs/inode.c
@@ -859,6 +859,15 @@ int exofs_setattr(struct dentry *dentry, struct iattr *iattr)
859 return error; 859 return error;
860} 860}
861 861
862static const struct osd_attr g_attr_inode_file_layout = ATTR_DEF(
863 EXOFS_APAGE_FS_DATA,
864 EXOFS_ATTR_INODE_FILE_LAYOUT,
865 0);
866static const struct osd_attr g_attr_inode_dir_layout = ATTR_DEF(
867 EXOFS_APAGE_FS_DATA,
868 EXOFS_ATTR_INODE_DIR_LAYOUT,
869 0);
870
862/* 871/*
863 * Read an inode from the OSD, and return it as is. We also return the size 872 * Read an inode from the OSD, and return it as is. We also return the size
864 * attribute in the 'obj_size' argument. 873 * attribute in the 'obj_size' argument.
@@ -867,11 +876,16 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
867 struct exofs_fcb *inode, uint64_t *obj_size) 876 struct exofs_fcb *inode, uint64_t *obj_size)
868{ 877{
869 struct exofs_sb_info *sbi = sb->s_fs_info; 878 struct exofs_sb_info *sbi = sb->s_fs_info;
870 struct osd_attr attrs[2]; 879 struct osd_attr attrs[] = {
880 [0] = g_attr_inode_data,
881 [1] = g_attr_inode_file_layout,
882 [2] = g_attr_inode_dir_layout,
883 [3] = g_attr_logical_length,
884 };
871 struct exofs_io_state *ios; 885 struct exofs_io_state *ios;
886 struct exofs_on_disk_inode_layout *layout;
872 int ret; 887 int ret;
873 888
874 *obj_size = ~0;
875 ret = exofs_get_io_state(&sbi->layout, &ios); 889 ret = exofs_get_io_state(&sbi->layout, &ios);
876 if (unlikely(ret)) { 890 if (unlikely(ret)) {
877 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__); 891 EXOFS_ERR("%s: exofs_get_io_state failed.\n", __func__);
@@ -882,8 +896,9 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
882 exofs_make_credential(oi->i_cred, &ios->obj); 896 exofs_make_credential(oi->i_cred, &ios->obj);
883 ios->cred = oi->i_cred; 897 ios->cred = oi->i_cred;
884 898
885 attrs[0] = g_attr_inode_data; 899 attrs[1].len = exofs_on_disk_inode_layout_size(sbi->layout.s_numdevs);
886 attrs[1] = g_attr_logical_length; 900 attrs[2].len = exofs_on_disk_inode_layout_size(sbi->layout.s_numdevs);
901
887 ios->in_attr = attrs; 902 ios->in_attr = attrs;
888 ios->in_attr_len = ARRAY_SIZE(attrs); 903 ios->in_attr_len = ARRAY_SIZE(attrs);
889 904
@@ -901,11 +916,42 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,
901 916
902 ret = extract_attr_from_ios(ios, &attrs[1]); 917 ret = extract_attr_from_ios(ios, &attrs[1]);
903 if (ret) { 918 if (ret) {
919 EXOFS_ERR("%s: extract_attr of inode_data failed\n", __func__);
920 goto out;
921 }
922 if (attrs[1].len) {
923 layout = attrs[1].val_ptr;
924 if (layout->gen_func != cpu_to_le16(LAYOUT_MOVING_WINDOW)) {
925 EXOFS_ERR("%s: unsupported files layout %d\n",
926 __func__, layout->gen_func);
927 ret = -ENOTSUPP;
928 goto out;
929 }
930 }
931
932 ret = extract_attr_from_ios(ios, &attrs[2]);
933 if (ret) {
934 EXOFS_ERR("%s: extract_attr of inode_data failed\n", __func__);
935 goto out;
936 }
937 if (attrs[2].len) {
938 layout = attrs[2].val_ptr;
939 if (layout->gen_func != cpu_to_le16(LAYOUT_MOVING_WINDOW)) {
940 EXOFS_ERR("%s: unsupported meta-data layout %d\n",
941 __func__, layout->gen_func);
942 ret = -ENOTSUPP;
943 goto out;
944 }
945 }
946
947 *obj_size = ~0;
948 ret = extract_attr_from_ios(ios, &attrs[3]);
949 if (ret) {
904 EXOFS_ERR("%s: extract_attr of logical_length failed\n", 950 EXOFS_ERR("%s: extract_attr of logical_length failed\n",
905 __func__); 951 __func__);
906 goto out; 952 goto out;
907 } 953 }
908 *obj_size = get_unaligned_be64(attrs[1].val_ptr); 954 *obj_size = get_unaligned_be64(attrs[3].val_ptr);
909 955
910out: 956out:
911 exofs_put_io_state(ios); 957 exofs_put_io_state(ios);