From 8e961d76473699d7206d4071bab99700c359eec6 Mon Sep 17 00:00:00 2001 From: Alex Aizman Date: Wed, 19 Jun 2024 14:43:48 -0400 Subject: [PATCH] core: BID bitwise structure and flags (object metadata) * part two, prev. commit: 054fecdc94fadc Signed-off-by: Alex Aizman --- core/linit.go | 2 +- core/lom.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/core/linit.go b/core/linit.go index 3c7d33898c..ca40e7c015 100644 --- a/core/linit.go +++ b/core/linit.go @@ -113,11 +113,11 @@ func (lom *LOM) String() string { } // allocates and copies metadata (in particular, atime and uname) +// NOTE: cloned lom.bid() == 0 is possible - copying/transforming scenarios func (lom *LOM) CloneMD(fqn string) *LOM { dst := AllocLOM("") *dst = *lom dst.md = lom.md - dst.md.bckID = 0 dst.md.copies = nil dst.FQN = fqn return dst diff --git a/core/lom.go b/core/lom.go index e4f959d466..9c0f73ac53 100644 --- a/core/lom.go +++ b/core/lom.go @@ -397,7 +397,10 @@ func (lom *LOM) Load(cacheit, locked bool) error { if err := lom.FromFS(); err != nil { return err } - lom.setbid(lom.Bprops().BID) // TODO -- FIXME: remove + if lom.bid() == 0 { + // copies, etc. + lom.setbid(lom.Bprops().BID) + } if err := lom._checkBucket(bmd); err != nil { return err } @@ -439,6 +442,10 @@ func (lom *LOM) LoadUnsafe() (err error) { // read and decode xattr; NOTE: fs.GetXattr* vs fs.SetXattr race possible and must be // either a) handled or b) benign from the caller's perspective if _, err = lom.lmfs(true); err == nil { + if lom.bid() == 0 { + // copies, etc. + lom.setbid(lom.Bprops().BID) + } err = lom._checkBucket(bmd) } return err