Skip to contentSkip to conversation

BTRFS: Transpose parent_objectid and parent_gen in struct btrfs_fid

PATCH In review David Howells 3 participants 6 messages Mar 18, 2009 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BTRFS: Transpose parent_objectid and parent_gen in struct btrfs_fid

Transpose parent_objectid and parent_gen in struct btrfs_fid so that gen and parent_gen (both u32) are adjacent, thus packing nicely between the u64 members.

This would seem to be reasonable as the parent generation number is always used if the parent objectid is.

---

 fs/btrfs/export.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/btrfs/export.h +1 -1
index 074348a..319cc6e 100644
@@ -10,8 +10,8 @@ struct btrfs_fid {
 	u64 root_objectid;
 	u32 gen;
 
-	u64 parent_objectid;
 	u32 parent_gen;
+	u64 parent_objectid;
 
 	u64 parent_root_objectid;
 } __attribute__ ((packed));
#1 lore raw
Quoted 7 lines · David Howells

Transpose parent_objectid and parent_gen in struct btrfs_fid so that gen and parent_gen (both u32) are adjacent, thus packing nicely between the u64 members.

This would seem to be reasonable as the parent generation number is always used if the parent objectid is.

Won't this confuse any handles the clients already have if the server reboots with the new handle format?

-chris

#2 lore raw
Quoted 2 lines · Chris Mason

Won't this confuse any handles the clients already have if the server reboots with the new handle format?

Perhaps, but it's probably early enough in BTRFS's life to get away with it.

David

#3 lore raw
Quoted 6 lines · David Howells
Quoted 2 lines · Chris Mason

Won't this confuse any handles the clients already have if the server reboots with the new handle format?

Perhaps, but it's probably early enough in BTRFS's life to get away with it.

True. It's not that hard to handle compatibility if we really care, either.

But this struct is packed anyway -- we're not changing much on the wire; it's just a case of how efficient it is to load that single uint64_t from an unaligned location. Is that _really_ something we're ever going to notice?

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation
#4 lore raw
Quoted 4 lines · David Woodhouse

But this struct is packed anyway -- we're not changing much on the wire; it's just a case of how efficient it is to load that single uint64_t from an unaligned location. Is that _really_ something we're ever going to notice?

If the CPU doing the load/store throws a misalignment exception or just ignores the instruction because it's misaligned, it might make for interesting debugging.

David

#5 lore raw
Quoted 3 lines · David Howells

If the CPU doing the load/store throws a misalignment exception or just ignores the instruction because it's misaligned, it might make for interesting debugging.

That would require a 64-bit CPU which doesn't naturally handle unaligned loads, and a compiler bug.

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation