Skip to content

Commit

Permalink
core: BID bitwise structure and flags (object metadata)
Browse files Browse the repository at this point in the history
* part two, prev. commit: 054fecd

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Jun 19, 2024
1 parent 6d3aa4b commit 8e961d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/linit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion core/lom.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8e961d7

Please sign in to comment.