"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xlators/cluster/afr/src/afr-common.c" between
glusterfs-7.5.tar.gz and glusterfs-7.6.tar.gz

About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 7.x (latest version).

afr-common.c  (glusterfs-7.5):afr-common.c  (glusterfs-7.6)
skipping to change at line 285 skipping to change at line 285
switch (txn_type) { switch (txn_type) {
case AFR_METADATA_TRANSACTION: case AFR_METADATA_TRANSACTION:
if ((metadatamap_old != 0) && (metadatamap == 0) && (count == 1)) { if ((metadatamap_old != 0) && (metadatamap == 0) && (count == 1)) {
index = gf_bits_index(tmp_map); index = gf_bits_index(tmp_map);
local->transaction.in_flight_sb_errno = local->replies[index] local->transaction.in_flight_sb_errno = local->replies[index]
.op_errno; .op_errno;
local->transaction.in_flight_sb = _gf_true; local->transaction.in_flight_sb = _gf_true;
metadatamap |= (1 << index); metadatamap |= (1 << index);
} }
if (metadatamap_old != metadatamap) { if (metadatamap_old != metadatamap) {
event = 0; __afr_inode_need_refresh_set(inode, this);
} }
break; break;
case AFR_DATA_TRANSACTION: case AFR_DATA_TRANSACTION:
if ((datamap_old != 0) && (datamap == 0) && (count == 1)) { if ((datamap_old != 0) && (datamap == 0) && (count == 1)) {
index = gf_bits_index(tmp_map); index = gf_bits_index(tmp_map);
local->transaction.in_flight_sb_errno = local->replies[index] local->transaction.in_flight_sb_errno = local->replies[index]
.op_errno; .op_errno;
local->transaction.in_flight_sb = _gf_true; local->transaction.in_flight_sb = _gf_true;
datamap |= (1 << index); datamap |= (1 << index);
} }
if (datamap_old != datamap) if (datamap_old != datamap)
event = 0; __afr_inode_need_refresh_set(inode, this);
break; break;
default: default:
break; break;
} }
val = ((uint64_t)metadatamap) | (((uint64_t)datamap) << 16) | val = ((uint64_t)metadatamap) | (((uint64_t)datamap) << 16) |
(((uint64_t)event) << 32); (((uint64_t)event) << 32);
if (txn_type == AFR_DATA_TRANSACTION) if (txn_type == AFR_DATA_TRANSACTION)
skipping to change at line 462 skipping to change at line 462
(((uint64_t)event) << 32); (((uint64_t)event) << 32);
ctx->read_subvol = val; ctx->read_subvol = val;
ret = 0; ret = 0;
out: out:
return ret; return ret;
} }
int int
__afr_inode_event_gen_reset_small(inode_t *inode, xlator_t *this)
{
int ret = -1;
uint16_t datamap = 0;
uint16_t metadatamap = 0;
uint32_t event = 0;
uint64_t val = 0;
afr_inode_ctx_t *ctx = NULL;
ret = __afr_inode_ctx_get(this, inode, &ctx);
if (ret)
return ret;
val = ctx->read_subvol;
metadatamap = (val & 0x000000000000ffff) >> 0;
datamap = (val & 0x00000000ffff0000) >> 16;
event = 0;
val = ((uint64_t)metadatamap) | (((uint64_t)datamap) << 16) |
(((uint64_t)event) << 32);
ctx->read_subvol = val;
return ret;
}
int
__afr_inode_read_subvol_get(inode_t *inode, xlator_t *this, unsigned char *data, __afr_inode_read_subvol_get(inode_t *inode, xlator_t *this, unsigned char *data,
unsigned char *metadata, int *event_p) unsigned char *metadata, int *event_p)
{ {
afr_private_t *priv = NULL; afr_private_t *priv = NULL;
int ret = -1; int ret = -1;
priv = this->private; priv = this->private;
if (priv->child_count <= 16) if (priv->child_count <= 16)
ret = __afr_inode_read_subvol_get_small(inode, this, data, metadata, ret = __afr_inode_read_subvol_get_small(inode, this, data, metadata,
skipping to change at line 560 skipping to change at line 532
goto out; goto out;
ctx->spb_choice = spb_choice; ctx->spb_choice = spb_choice;
ret = 0; ret = 0;
out: out:
return ret; return ret;
} }
int int
__afr_inode_event_gen_reset(inode_t *inode, xlator_t *this)
{
afr_private_t *priv = NULL;
int ret = -1;
priv = this->private;
if (priv->child_count <= 16)
ret = __afr_inode_event_gen_reset_small(inode, this);
else
ret = -1;
return ret;
}
int
afr_inode_read_subvol_get(inode_t *inode, xlator_t *this, unsigned char *data, afr_inode_read_subvol_get(inode_t *inode, xlator_t *this, unsigned char *data,
unsigned char *metadata, int *event_p) unsigned char *metadata, int *event_p)
{ {
int ret = -1; int ret = -1;
GF_VALIDATE_OR_GOTO(this->name, inode, out); GF_VALIDATE_OR_GOTO(this->name, inode, out);
LOCK(&inode->lock); LOCK(&inode->lock);
{ {
ret = __afr_inode_read_subvol_get(inode, this, data, metadata, event_p); ret = __afr_inode_read_subvol_get(inode, this, data, metadata, event_p);
skipping to change at line 724 skipping to change at line 680
} }
unlock: unlock:
UNLOCK(&inode->lock); UNLOCK(&inode->lock);
if (event_gen1 != event_gen2) if (event_gen1 != event_gen2)
need_refresh = _gf_true; need_refresh = _gf_true;
out: out:
return need_refresh; return need_refresh;
} }
static int int
afr_inode_need_refresh_set(inode_t *inode, xlator_t *this) __afr_inode_need_refresh_set(inode_t *inode, xlator_t *this)
{ {
int ret = -1; int ret = -1;
afr_inode_ctx_t *ctx = NULL; afr_inode_ctx_t *ctx = NULL;
GF_VALIDATE_OR_GOTO(this->name, inode, out); ret = __afr_inode_ctx_get(this, inode, &ctx);
if (ret == 0) {
LOCK(&inode->lock);
{
ret = __afr_inode_ctx_get(this, inode, &ctx);
if (ret)
goto unlock;
ctx->need_refresh = _gf_true; ctx->need_refresh = _gf_true;
} }
unlock:
UNLOCK(&inode->lock);
out:
return ret; return ret;
} }
int int
afr_inode_event_gen_reset(inode_t *inode, xlator_t *this) afr_inode_need_refresh_set(inode_t *inode, xlator_t *this)
{ {
int ret = -1; int ret = -1;
GF_VALIDATE_OR_GOTO(this->name, inode, out); GF_VALIDATE_OR_GOTO(this->name, inode, out);
LOCK(&inode->lock); LOCK(&inode->lock);
{ {
ret = __afr_inode_event_gen_reset(inode, this); ret = __afr_inode_need_refresh_set(inode, this);
} }
UNLOCK(&inode->lock); UNLOCK(&inode->lock);
out: out:
return ret; return ret;
} }
int int
afr_spb_choice_timeout_cancel(xlator_t *this, inode_t *inode) afr_spb_choice_timeout_cancel(xlator_t *this, inode_t *inode)
{ {
afr_inode_ctx_t *ctx = NULL; afr_inode_ctx_t *ctx = NULL;
skipping to change at line 1188 skipping to change at line 1136
if (err) if (err)
goto refresh_done; goto refresh_done;
if (local->op == GF_FOP_LOOKUP) if (local->op == GF_FOP_LOOKUP)
goto refresh_done; goto refresh_done;
ret = afr_inode_get_readable(frame, inode, this, local->readable, ret = afr_inode_get_readable(frame, inode, this, local->readable,
&event_generation, local->transaction.type); &event_generation, local->transaction.type);
if (ret == -EIO || (local->is_read_txn && !event_generation)) { if (ret == -EIO) {
/* No readable subvolume even after refresh ==> splitbrain.*/ /* No readable subvolume even after refresh ==> splitbrain.*/
if (!priv->fav_child_policy) { if (!priv->fav_child_policy) {
err = EIO; err = EIO;
goto refresh_done; goto refresh_done;
} }
read_subvol = afr_sh_get_fav_by_policy(this, local->replies, inode, read_subvol = afr_sh_get_fav_by_policy(this, local->replies, inode,
NULL); NULL);
if (read_subvol == -1) { if (read_subvol == -1) {
err = EIO; err = EIO;
goto refresh_done; goto refresh_done;
skipping to change at line 2452 skipping to change at line 2400
to the same GFID to the same GFID
*/ */
gf_uuid_copy(args.gfid, read_gfid); gf_uuid_copy(args.gfid, read_gfid);
args.ia_type = ia_type; args.ia_type = ia_type;
ret = afr_replies_interpret(frame, this, local->inode, NULL); ret = afr_replies_interpret(frame, this, local->inode, NULL);
read_subvol = afr_read_subvol_decide(local->inode, this, &args, read_subvol = afr_read_subvol_decide(local->inode, this, &args,
readable); readable);
if (read_subvol == -1) if (read_subvol == -1)
goto cant_interpret; goto cant_interpret;
if (ret) { if (ret) {
afr_inode_event_gen_reset(local->inode, this); afr_inode_need_refresh_set(local->inode, this);
dict_del_sizen(local->replies[read_subvol].xdata, GF_CONTENT_KEY); dict_del_sizen(local->replies[read_subvol].xdata, GF_CONTENT_KEY);
} }
} else { } else {
cant_interpret: cant_interpret:
afr_attempt_readsubvol_set(frame, this, success_replies, readable, afr_attempt_readsubvol_set(frame, this, success_replies, readable,
&read_subvol); &read_subvol);
if (read_subvol == -1) { if (read_subvol == -1) {
goto error; goto error;
} }
} }
skipping to change at line 3008 skipping to change at line 2956
return 0; return 0;
} }
static void static void
afr_discover_unwind(call_frame_t *frame, xlator_t *this) afr_discover_unwind(call_frame_t *frame, xlator_t *this)
{ {
afr_private_t *priv = NULL; afr_private_t *priv = NULL;
afr_local_t *local = NULL; afr_local_t *local = NULL;
int read_subvol = -1; int read_subvol = -1;
int ret = 0;
unsigned char *data_readable = NULL; unsigned char *data_readable = NULL;
unsigned char *success_replies = NULL; unsigned char *success_replies = NULL;
priv = this->private; priv = this->private;
local = frame->local; local = frame->local;
data_readable = alloca0(priv->child_count); data_readable = alloca0(priv->child_count);
success_replies = alloca0(priv->child_count); success_replies = alloca0(priv->child_count);
afr_fill_success_replies(local, priv, success_replies); afr_fill_success_replies(local, priv, success_replies);
if (AFR_COUNT(success_replies, priv->child_count) > 0) if (AFR_COUNT(success_replies, priv->child_count) > 0)
skipping to change at line 3029 skipping to change at line 2978
if (local->op_ret < 0) { if (local->op_ret < 0) {
local->op_ret = -1; local->op_ret = -1;
local->op_errno = afr_final_errno(frame->local, this->private); local->op_errno = afr_final_errno(frame->local, this->private);
goto error; goto error;
} }
if (!afr_has_quorum(success_replies, this, frame)) if (!afr_has_quorum(success_replies, this, frame))
goto unwind; goto unwind;
afr_replies_interpret(frame, this, local->inode, NULL); ret = afr_replies_interpret(frame, this, local->inode, NULL);
if (ret) {
afr_inode_need_refresh_set(local->inode, this);
}
read_subvol = afr_read_subvol_decide(local->inode, this, NULL, read_subvol = afr_read_subvol_decide(local->inode, this, NULL,
data_readable); data_readable);
unwind: unwind:
afr_attempt_readsubvol_set(frame, this, success_replies, data_readable, afr_attempt_readsubvol_set(frame, this, success_replies, data_readable,
&read_subvol); &read_subvol);
if (read_subvol == -1) if (read_subvol == -1)
goto error; goto error;
skipping to change at line 3285 skipping to change at line 3237
local->xattr_req = dict_ref(xattr_req); local->xattr_req = dict_ref(xattr_req);
if (gf_uuid_is_null(loc->inode->gfid)) { if (gf_uuid_is_null(loc->inode->gfid)) {
afr_discover_do(frame, this, 0); afr_discover_do(frame, this, 0);
return 0; return 0;
} }
afr_read_subvol_get(loc->inode, this, NULL, NULL, &event, afr_read_subvol_get(loc->inode, this, NULL, NULL, &event,
AFR_DATA_TRANSACTION, NULL); AFR_DATA_TRANSACTION, NULL);
if (afr_is_inode_refresh_reqd(loc->inode, this, event, afr_discover_do(frame, this, 0);
local->event_generation))
afr_inode_refresh(frame, this, loc->inode, NULL, afr_discover_do);
else
afr_discover_do(frame, this, 0);
return 0; return 0;
out: out:
AFR_STACK_UNWIND(lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL); AFR_STACK_UNWIND(lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL);
return 0; return 0;
} }
int int
afr_lookup_do(call_frame_t *frame, xlator_t *this, int err) afr_lookup_do(call_frame_t *frame, xlator_t *this, int err)
{ {
skipping to change at line 3430 skipping to change at line 3378
ret = dict_get_gfuuid(local->xattr_req, "gfid-req", ret = dict_get_gfuuid(local->xattr_req, "gfid-req",
&local->cont.lookup.gfid_req); &local->cont.lookup.gfid_req);
if (ret == 0) { if (ret == 0) {
dict_del_sizen(local->xattr_req, "gfid-req"); dict_del_sizen(local->xattr_req, "gfid-req");
} }
} }
afr_read_subvol_get(loc->parent, this, NULL, NULL, &event, afr_read_subvol_get(loc->parent, this, NULL, NULL, &event,
AFR_DATA_TRANSACTION, NULL); AFR_DATA_TRANSACTION, NULL);
if (afr_is_inode_refresh_reqd(loc->inode, this, event, afr_lookup_do(frame, this, 0);
local->event_generation))
afr_inode_refresh(frame, this, loc->parent, NULL, afr_lookup_do);
else
afr_lookup_do(frame, this, 0);
return 0; return 0;
out: out:
AFR_STACK_UNWIND(lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL); AFR_STACK_UNWIND(lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL);
return 0; return 0;
} }
void void
_afr_cleanup_fd_ctx(afr_fd_ctx_t *fd_ctx) _afr_cleanup_fd_ctx(afr_fd_ctx_t *fd_ctx)
 End of changes. 15 change blocks. 
74 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)