From 306cf00818e33412825bbf4f842ba1b3705d8d8f Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 29 Dec 2019 11:15:34 -0500 Subject: [PATCH] Update bcachefs sources to aae76fba15 bcachefs: Use KEY_TYPE_deleted whitouts for extents --- .bcachefs_revision | 2 +- libbcachefs/bkey.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.bcachefs_revision b/.bcachefs_revision index 7da3a91d..ead2d1be 100644 --- a/.bcachefs_revision +++ b/.bcachefs_revision @@ -1 +1 @@ -1569db10e2463f01b322f165b37b5ee784cfd7b8 +aae76fba150894dc6c8b21a58b110413531af287 diff --git a/libbcachefs/bkey.c b/libbcachefs/bkey.c index 494126ae..4d0c9129 100644 --- a/libbcachefs/bkey.c +++ b/libbcachefs/bkey.c @@ -173,7 +173,8 @@ static bool set_inc_field(struct pack_state *state, unsigned field, u64 v) if (bits > state->bits) { bits -= state->bits; - state->w |= v >> bits; + /* avoid shift by 64 if bits is 0 - bits is never 64 here: */ + state->w |= (v >> 1) >> (bits - 1); *state->p = state->w; state->p = next_word(state->p); @@ -182,10 +183,7 @@ static bool set_inc_field(struct pack_state *state, unsigned field, u64 v) } state->bits -= bits; - - EBUG_ON(!state->bits); - /* avoid shift by 64: */ - state->w |= (v << 1) << (state->bits - 1); + state->w |= v << state->bits; return true; } @@ -372,7 +370,7 @@ static bool set_inc_field_lossy(struct pack_state *state, unsigned field, u64 v) if (bits > state->bits) { bits -= state->bits; - state->w |= v >> bits; + state->w |= (v >> 1) >> (bits - 1); *state->p = state->w; state->p = next_word(state->p); @@ -381,7 +379,7 @@ static bool set_inc_field_lossy(struct pack_state *state, unsigned field, u64 v) } state->bits -= bits; - state->w |= (v << 1) << (state->bits - 1); + state->w |= v << state->bits; return ret; }