Lines Matching defs:head

252 				      struct hmdfs_cache_file_head *head)
257 memset(head, 0, sizeof(*head));
258 head->magic = cpu_to_le32(HMDFS_STASH_FILE_HEAD_MAGIC);
259 head->ino = cpu_to_le64(ino);
260 head->size = cpu_to_le64(i_size_read(file_inode(cache->cache_file)));
263 head->blocks = cpu_to_le64(blocks);
264 head->path_offs = cpu_to_le32(cache->path_offs);
265 head->path_len = cpu_to_le32(cache->path_len);
266 head->path_cnt = cpu_to_le32(cache->path_cnt);
267 head->data_offs = cpu_to_le32(cache->data_offs);
269 head->crc_offset = cpu_to_le32(crc_offset);
270 head->crc32 = cpu_to_le32(crc32(0, head, crc_offset));
302 /* Write head */
307 hmdfs_err("stash peer 0x%x:0x%llx ino 0x%llx write head len %u err %zd",
1085 const struct hmdfs_cache_file_head *head)
1093 if (le32_to_cpu(head->magic) != HMDFS_STASH_FILE_HEAD_MAGIC) {
1097 le32_to_cpu(head->magic),
1102 crc_offset = le32_to_cpu(head->crc_offset);
1103 read_crc = le32_to_cpu(*((__le32 *)((char *)head + crc_offset)));
1104 crc = crc32(0, head, crc_offset);
1113 if (le64_to_cpu(head->ino) != ctx->inum) {
1117 le64_to_cpu(head->ino), ctx->inum);
1121 path_offs = (loff_t)le32_to_cpu(head->path_offs) <<
1127 le32_to_cpu(head->path_offs), i_size_read(inode));
1131 data_offs = (loff_t)le32_to_cpu(head->data_offs) <<
1137 le32_to_cpu(head->data_offs),
1138 le32_to_cpu(head->path_offs));
1145 le32_to_cpu(head->data_offs), i_size_read(inode));
1149 isize = le64_to_cpu(head->size);
1154 le64_to_cpu(head->size), i_size_read(inode));
1158 if (le32_to_cpu(head->path_cnt) < 1) {
1162 le32_to_cpu(head->path_cnt));
1172 struct hmdfs_cache_file_head head;
1180 memset(&head, 0, head_size);
1181 /* Read part head */
1184 sizeof(head.crc_offset);
1185 rd = kernel_read(ctx->src_filp, &head, read_size, &pos);
1188 hmdfs_err("peer 0x%x:0x%llx ino 0x%llx read part head err %d",
1192 head_crc_offset = le32_to_cpu(head.crc_offset);
1193 if (head_crc_offset + sizeof(head.crc32) < head_crc_offset ||
1194 head_crc_offset + sizeof(head.crc32) > head_size) {
1196 hmdfs_err("peer 0x%x:0x%llx ino 0x%llx got bad head: Too long crc_offset %u which exceeds head size %u",
1202 /* Read full head */
1204 read_size = le32_to_cpu(head.crc_offset) + sizeof(head.crc32);
1205 rd = kernel_read(ctx->src_filp, &head, read_size, &pos);
1208 hmdfs_err("peer 0x%x:0x%llx ino 0x%llx read full head err %d",
1213 err = hmdfs_verify_restore_file_head(ctx, &head);
1217 ctx->pages = le64_to_cpu(head.blocks) >>
1219 ctx->data_offs = le32_to_cpu(head.data_offs);
1221 read_size = min_t(unsigned int, le32_to_cpu(head.path_len), PATH_MAX);
1222 pos = (loff_t)le32_to_cpu(head.path_offs) << HMDFS_STASH_BLK_SHIFT;