Changeset 7968 for branches/Orange-Branch/src/proto/pvfs2-attr.h
- Timestamp:
- 09/03/09 17:24:49 (4 years ago)
- Files:
-
- 1 modified
-
branches/Orange-Branch/src/proto/pvfs2-attr.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/Orange-Branch/src/proto/pvfs2-attr.h
r7593 r7968 36 36 37 37 /* internal attribute masks for metadata objects */ 38 #define PVFS_ATTR_META_DIST (1 << 10) 39 #define PVFS_ATTR_META_DFILES (1 << 11) 38 #define PVFS_ATTR_META_DIST (1 << 10) 39 #define PVFS_ATTR_META_DFILES (1 << 11) 40 #define PVFS_ATTR_META_MIRROR_DFILES (1 << 13) 40 41 #define PVFS_ATTR_META_ALL \ 41 (PVFS_ATTR_META_DIST | PVFS_ATTR_META_DFILES )42 (PVFS_ATTR_META_DIST | PVFS_ATTR_META_DFILES | PVFS_ATTR_META_MIRROR_DFILES) 42 43 43 44 #define PVFS_ATTR_META_UNSTUFFED (1 << 12) 45 44 46 45 47 /* internal attribute masks for datafile objects */ … … 59 61 /* attributes that do not change once set */ 60 62 #define PVFS_STATIC_ATTR_MASK \ 61 (PVFS_ATTR_COMMON_TYPE|PVFS_ATTR_META_DIST|PVFS_ATTR_META_DFILES|PVFS_ATTR_META_ UNSTUFFED)63 (PVFS_ATTR_COMMON_TYPE|PVFS_ATTR_META_DIST|PVFS_ATTR_META_DFILES|PVFS_ATTR_META_MIRROR_DFILES|PVFS_ATTR_META_UNSTUFFED) 62 64 63 65 /* extended hint attributes for a metafile object */ … … 83 85 uint32_t dfile_count; 84 86 87 /* list of mirrored datafiles */ 88 PVFS_handle *mirror_dfile_array; 89 uint32_t mirror_copies_count; 90 85 91 int32_t stuffed_size; 86 92 … … 96 102 (x)->dist_size = PINT_DIST_PACK_SIZE((x)->dist); \ 97 103 } while (0) 98 #define encode_PVFS_metafile_attr_dfiles(pptr,x) do { int dfiles_i; \ 99 encode_uint32_t(pptr, &(x)->dfile_count); \ 100 encode_skip4(pptr,); \ 101 for (dfiles_i=0; dfiles_i<(x)->dfile_count; dfiles_i++) \ 102 encode_PVFS_handle(pptr, &(x)->dfile_array[dfiles_i]); \ 103 encode_PVFS_metafile_hint(pptr, &(x)->hint); \ 104 } while (0) 105 #define decode_PVFS_metafile_attr_dfiles(pptr,x) do { int dfiles_i; \ 106 decode_uint32_t(pptr, &(x)->dfile_count); \ 107 decode_skip4(pptr,); \ 108 (x)->dfile_array = decode_malloc((x)->dfile_count \ 109 * sizeof(*(x)->dfile_array)); \ 110 for (dfiles_i=0; dfiles_i<(x)->dfile_count; dfiles_i++) \ 111 decode_PVFS_handle(pptr, &(x)->dfile_array[dfiles_i]); \ 112 decode_PVFS_metafile_hint(pptr, &(x)->hint); \ 104 #define encode_PVFS_metafile_attr_mirror_dfiles(pptr,x) do { \ 105 int dfiles_i, copy_i, handle_i; \ 106 encode_uint32_t(pptr, &(x)->mirror_copies_count); \ 107 encode_skip4(pptr,); \ 108 for (copy_i=0; copy_i<(x)->mirror_copies_count; copy_i++) \ 109 for (dfiles_i=0; dfiles_i<(x)->dfile_count; dfiles_i++) \ 110 { \ 111 handle_i = (copy_i * (x)->dfile_count) + dfiles_i; \ 112 encode_PVFS_handle(pptr, &(x)->mirror_dfile_array[handle_i]); \ 113 } \ 114 } while (0) 115 #define decode_PVFS_metafile_attr_mirror_dfiles(pptr,x) do { \ 116 int dfiles_i, copy_i, handle_i; \ 117 decode_uint32_t(pptr, &(x)->mirror_copies_count); \ 118 decode_skip4(pptr,); \ 119 (x)->mirror_dfile_array = decode_malloc((x)->dfile_count * \ 120 (x)->mirror_copies_count * \ 121 sizeof(PVFS_handle)); \ 122 for (copy_i=0; copy_i<(x)->mirror_copies_count; copy_i++) \ 123 for (dfiles_i=0; dfiles_i<(x)->dfile_count; dfiles_i++) \ 124 { \ 125 handle_i = (copy_i * (x)->dfile_count) + dfiles_i; \ 126 decode_PVFS_handle(pptr, &(x)->mirror_dfile_array[handle_i]); \ 127 } \ 128 } while (0) 129 #define encode_PVFS_metafile_attr_dfiles(pptr,x) do { \ 130 int dfiles_i; \ 131 encode_uint32_t(pptr, &(x)->dfile_count); \ 132 encode_skip4(pptr,); \ 133 for (dfiles_i=0; dfiles_i<(x)->dfile_count; dfiles_i++) \ 134 encode_PVFS_handle(pptr, &(x)->dfile_array[dfiles_i]); \ 135 encode_PVFS_metafile_hint(pptr, &(x)->hint); \ 136 } while (0) 137 #define decode_PVFS_metafile_attr_dfiles(pptr,x) do { \ 138 int dfiles_i; \ 139 decode_uint32_t(pptr, &(x)->dfile_count); \ 140 decode_skip4(pptr,); \ 141 (x)->dfile_array = decode_malloc((x)->dfile_count \ 142 * sizeof(*(x)->dfile_array)); \ 143 for (dfiles_i=0; dfiles_i<(x)->dfile_count; dfiles_i++) \ 144 decode_PVFS_handle(pptr, &(x)->dfile_array[dfiles_i]); \ 145 decode_PVFS_metafile_hint(pptr, &(x)->hint); \ 113 146 } while (0) 114 147 #endif … … 221 254 if ((x)->mask & PVFS_ATTR_META_DFILES) \ 222 255 encode_PVFS_metafile_attr_dfiles(pptr, &(x)->u.meta); \ 256 if ((x)->mask & PVFS_ATTR_META_MIRROR_DFILES) \ 257 encode_PVFS_metafile_attr_mirror_dfiles(pptr, &(x)->u.meta); \ 223 258 if ((x)->mask & PVFS_ATTR_DATA_SIZE) \ 224 259 encode_PVFS_datafile_attr(pptr, &(x)->u.data); \ 225 260 if ((x)->mask & PVFS_ATTR_SYMLNK_TARGET) \ 226 261 encode_PVFS_symlink_attr(pptr, &(x)->u.sym); \ 227 if (((x)->mask & PVFS_ATTR_DIR_DIRENT_COUNT) || ((x)->mask & PVFS_ATTR_DIR_HINT)) \ 262 if (((x)->mask & PVFS_ATTR_DIR_DIRENT_COUNT) || \ 263 ((x)->mask & PVFS_ATTR_DIR_HINT)) \ 228 264 encode_PVFS_directory_attr(pptr, &(x)->u.dir); \ 229 265 } while (0) … … 248 284 if ((x)->mask & PVFS_ATTR_META_DFILES) \ 249 285 decode_PVFS_metafile_attr_dfiles(pptr, &(x)->u.meta); \ 286 if ((x)->mask & PVFS_ATTR_META_MIRROR_DFILES) \ 287 decode_PVFS_metafile_attr_mirror_dfiles(pptr, &(x)->u.meta); \ 250 288 if ((x)->mask & PVFS_ATTR_DATA_SIZE) \ 251 289 decode_PVFS_datafile_attr(pptr, &(x)->u.data); \ 252 290 if ((x)->mask & PVFS_ATTR_SYMLNK_TARGET) \ 253 291 decode_PVFS_symlink_attr(pptr, &(x)->u.sym); \ 254 if (((x)->mask & PVFS_ATTR_DIR_DIRENT_COUNT) || ((x)->mask & PVFS_ATTR_DIR_HINT)) \ 292 if (((x)->mask & PVFS_ATTR_DIR_DIRENT_COUNT) || \ 293 ((x)->mask & PVFS_ATTR_DIR_HINT)) \ 255 294 decode_PVFS_directory_attr(pptr, &(x)->u.dir); \ 256 295 } while (0) 257 296 #endif 258 /* attr buffer needs room for larger of symlink path, meta fields or dir hints: an attrib 259 * structure can never hold information for not more than a symlink or a metafile or a dir object */ 297 /* attr buffer needs room for larger of symlink path, meta fields or 298 * dir hints: an attrib structure can never hold information for not more 299 * than a symlink or a metafile or a dir object 300 */ 260 301 #define extra_size_PVFS_object_attr_dir (PVFS_REQ_LIMIT_DIST_BYTES + \ 261 302 PVFS_REQ_LIMIT_DIST_NAME + roundup8(sizeof(PVFS_directory_attr))) 262 303 263 /* room for distribution, stuffed_size, and dfilearray */304 /* room for distribution, stuffed_size, dfile array, and mirror_dfile_array */ 264 305 #define extra_size_PVFS_object_attr_meta (PVFS_REQ_LIMIT_DIST_BYTES + \ 265 sizeof(int32_t) + \ 266 PVFS_REQ_LIMIT_DFILE_COUNT * sizeof(PVFS_handle)) 306 sizeof(int32_t) + \ 307 (PVFS_REQ_LIMIT_DFILE_COUNT * sizeof(PVFS_handle)) + \ 308 (PVFS_REQ_LIMIT_MIRROR_DFILE_COUNT * sizeof(PVFS_handle))) 267 309 268 310 #define extra_size_PVFS_object_attr_symlink (PVFS_REQ_LIMIT_PATH_NAME_BYTES)
