Skip to content

Commit e0c7efc

Browse files
committed
read flow modified
1 parent 20a5f00 commit e0c7efc

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

xlators/cluster/ec/src/ec-inode-read.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,6 +1375,9 @@ ec_manager_readv(ec_fop_data_t *fop, int32_t state)
13751375
if (ec->read_mask) {
13761376
fop->mask &= ec->read_mask;
13771377
}
1378+
if (fop->fd->inode->read_mask != 0){
1379+
fop->mask &= fop->fd->inode->read_mask;
1380+
}
13781381
ec_dispatch_min(fop);
13791382

13801383
return EC_STATE_PREPARE_ANSWER;

xlators/cluster/ec/src/ec-inode-write.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -710,19 +710,27 @@ ec_setxattr(call_frame_t *frame, xlator_t *this, uintptr_t target,
710710
ec_cbk_t callback = {.setxattr = func};
711711
ec_fop_data_t *fop = NULL;
712712
int32_t error = ENOMEM;
713-
int ret = 0;
714713
data_t *dict_data = NULL;
715714
char *mask_key = "user.readmask";
715+
int ret = 0;
716+
int op_ret = -1;
716717

717718
gf_msg_trace("ec", 0, "EC(SETXATTR) %p", frame);
718719

719720
VALIDATE_OR_GOTO(this, out);
720721
GF_VALIDATE_OR_GOTO(this->name, frame, out);
721722
GF_VALIDATE_OR_GOTO(this->name, this->private, out);
722723

723-
ret = dict_lookup(dict, mask_key, &data);
724+
ret = dict_lookup(dict, mask_key, &dict_data);
724725
if(!ret && dict_data){
725-
726+
if(loc != NULL && loc->inode != NULL){
727+
loc->inode->read_mask = data_to_uint16(dict_data);
728+
}
729+
dict_deln(dict, mask_key, strlen(mask_key));
730+
dict_data = NULL;
731+
error = 0;
732+
op_ret = 0;
733+
goto out;
726734
}
727735

728736
fop = ec_fop_data_allocate(frame, this, GF_FOP_SETXATTR, 0, target,
@@ -765,7 +773,7 @@ ec_setxattr(call_frame_t *frame, xlator_t *this, uintptr_t target,
765773

766774
ec_t *ec = fop->xl->private;
767775
int64_t val = 0;
768-
int ret = dict_get_int64(fop->dict, SQUOTA_LIMIT_KEY, &val);
776+
ret = dict_get_int64(fop->dict, SQUOTA_LIMIT_KEY, &val);
769777
if (IS_SUCCESS(ret)) {
770778
/* divide the total usage to priv->fragments */
771779
int64_t new_value = val / ec->fragments;
@@ -783,7 +791,7 @@ ec_setxattr(call_frame_t *frame, xlator_t *this, uintptr_t target,
783791
if (fop != NULL) {
784792
ec_manager(fop, error);
785793
} else {
786-
func(frame, NULL, this, -1, error, NULL);
794+
func(frame, NULL, this, op_ret, error, NULL);
787795
}
788796
}
789797

0 commit comments

Comments
 (0)