aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode_item.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_inode_item.c')
-rw-r--r--fs/xfs/xfs_inode_item.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index 7497a481b2f5..cd65a565b4fe 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -1084,3 +1084,52 @@ xfs_istale_done(
1084{ 1084{
1085 xfs_iflush_abort(iip->ili_inode); 1085 xfs_iflush_abort(iip->ili_inode);
1086} 1086}
1087
1088/*
1089 * convert an xfs_inode_log_format struct from either 32 or 64 bit versions
1090 * (which can have different field alignments) to the native version
1091 */
1092int
1093xfs_inode_item_format_convert(
1094 xfs_log_iovec_t *buf,
1095 xfs_inode_log_format_t *in_f)
1096{
1097 if (buf->i_len == sizeof(xfs_inode_log_format_32_t)) {
1098 xfs_inode_log_format_32_t *in_f32;
1099
1100 in_f32 = (xfs_inode_log_format_32_t *)buf->i_addr;
1101 in_f->ilf_type = in_f32->ilf_type;
1102 in_f->ilf_size = in_f32->ilf_size;
1103 in_f->ilf_fields = in_f32->ilf_fields;
1104 in_f->ilf_asize = in_f32->ilf_asize;
1105 in_f->ilf_dsize = in_f32->ilf_dsize;
1106 in_f->ilf_ino = in_f32->ilf_ino;
1107 /* copy biggest field of ilf_u */
1108 memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
1109 in_f32->ilf_u.ilfu_uuid.__u_bits,
1110 sizeof(uuid_t));
1111 in_f->ilf_blkno = in_f32->ilf_blkno;
1112 in_f->ilf_len = in_f32->ilf_len;
1113 in_f->ilf_boffset = in_f32->ilf_boffset;
1114 return 0;
1115 } else if (buf->i_len == sizeof(xfs_inode_log_format_64_t)){
1116 xfs_inode_log_format_64_t *in_f64;
1117
1118 in_f64 = (xfs_inode_log_format_64_t *)buf->i_addr;
1119 in_f->ilf_type = in_f64->ilf_type;
1120 in_f->ilf_size = in_f64->ilf_size;
1121 in_f->ilf_fields = in_f64->ilf_fields;
1122 in_f->ilf_asize = in_f64->ilf_asize;
1123 in_f->ilf_dsize = in_f64->ilf_dsize;
1124 in_f->ilf_ino = in_f64->ilf_ino;
1125 /* copy biggest field of ilf_u */
1126 memcpy(in_f->ilf_u.ilfu_uuid.__u_bits,
1127 in_f64->ilf_u.ilfu_uuid.__u_bits,
1128 sizeof(uuid_t));
1129 in_f->ilf_blkno = in_f64->ilf_blkno;
1130 in_f->ilf_len = in_f64->ilf_len;
1131 in_f->ilf_boffset = in_f64->ilf_boffset;
1132 return 0;
1133 }
1134 return EFSCORRUPTED;
1135}