name->dos.change_time += name->st.st_ctim.tv_nsec / 100;
#endif
name->dos.attrib = dos_mode_from_stat(pvfs, &name->st);
- name->dos.alloc_size = name->st.st_size;
+ name->dos.alloc_size = pvfs_round_alloc_size(pvfs, name->st.st_size);
name->dos.nlink = name->st.st_nlink;
name->dos.ea_size = 0;
name->dos.file_id = (((uint64_t)name->st.st_dev)<<32) | name->st.st_ino;
mode |= S_IXUSR | S_IXGRP | S_IXOTH;
}
- if (!(attrib & FILE_ATTRIBUTE_READONLY)) {
+ if (!(attrib & FILE_ATTRIBUTE_READONLY) ||
+ (pvfs->flags & PVFS_FLAG_XATTR_ENABLE)) {
mode |= S_IWUSR;
}
if (newstats.dos.alloc_size < newstats.st.st_size) {
newstats.st.st_size = newstats.dos.alloc_size;
}
+ newstats.dos.alloc_size = pvfs_round_alloc_size(pvfs,
+ newstats.dos.alloc_size);
break;
case RAW_SFILEINFO_END_OF_FILE_INFO:
if (newstats.dos.alloc_size < newstats.st.st_size) {
newstats.st.st_size = newstats.dos.alloc_size;
}
+ newstats.dos.alloc_size = pvfs_round_alloc_size(pvfs,
+ newstats.dos.alloc_size);
break;
case RAW_SFILEINFO_END_OF_FILE_INFO:
for (i=0;i<streams->num_streams;i++) {
struct xattr_DosStream *s = &streams->streams[i];
if (StrCaseCmp(s->name, name->stream_name) == 0) {
- name->dos.alloc_size = s->alloc_size;
+ name->dos.alloc_size = pvfs_round_alloc_size(pvfs, s->alloc_size);
name->st.st_size = s->size;
name->stream_exists = True;
talloc_free(streams);
struct xattr_DosStream *s = &streams->streams[i];
if (StrCaseCmp(s->name, name->stream_name) == 0) {
s->size = size;
- s->alloc_size = size;
+ s->alloc_size = pvfs_round_alloc_size(pvfs, size);
break;
}
}
s->flags = XATTR_STREAM_FLAG_INTERNAL;
s->size = size;
- s->alloc_size = size;
+ s->alloc_size = pvfs_round_alloc_size(pvfs, size);
s->name = name->stream_name;
}
return value;
}
+
+
+/*
+ file allocation size rounding. This is required to pass ifstest
+*/
+uint64_t pvfs_round_alloc_size(struct pvfs_state *pvfs, uint64_t size)
+{
+ const uint64_t round_value = 511;
+ if (size == 0) return 0;
+ return (size + round_value) & ~round_value;
+}
name->dos.attrib = pvfs_attrib_normalise(info1->attrib);
name->dos.ea_size = info1->ea_size;
if (name->st.st_size == info1->size) {
- name->dos.alloc_size = info1->alloc_size;
+ name->dos.alloc_size =
+ pvfs_round_alloc_size(pvfs, info1->alloc_size);
}
if (info1->create_time != 0) {
name->dos.create_time = info1->create_time;