BTRFS: Transpose parent_objectid and parent_gen in struct btrfs_fid
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
@@ -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));
Quoted 7 lines · David Howells
Transpose
parent_objectidandparent_genin structbtrfs_fidso that gen andparent_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
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
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
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_tfrom 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
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