Skip to content

Commit 10615d7

Browse files
committed
Merge branch 'inode_readmask' of github.com:sbk173/glusterfs into inode_readmask
2 parents 4348d15 + e0c7efc commit 10615d7

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

libglusterfs/src/glusterfs/inode.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ struct _inode {
111111
struct list_head dentry_list; /* list of directory entries for this inode */
112112
struct list_head hash; /* hash table pointers */
113113
struct list_head list; /* active/lru/purge */
114+
uintptr_t read_mask;
114115

115116
struct _inode *ns_inode; /* This inode would point to namespace inode */
116117
bool in_invalidate_list; /* Set if inode is in table invalidate list */

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,9 @@ ec_manager_readv(ec_fop_data_t *fop, int32_t state)
13791379
if (ec->read_mask) {
13801380
fop->mask &= ec->read_mask;
13811381
}
1382+
if (fop->fd->inode->read_mask != 0){
1383+
fop->mask &= fop->fd->inode->read_mask;
1384+
}
13821385
ec_dispatch_min(fop);
13831386

13841387
return EC_STATE_PREPARE_ANSWER;

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,13 +710,29 @@ 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+
data_t *dict_data = NULL;
714+
char *mask_key = "user.readmask";
715+
int ret = 0;
716+
int op_ret = -1;
713717

714718
gf_msg_trace("ec", 0, "EC(SETXATTR) %p", frame);
715719

716720
VALIDATE_OR_GOTO(this, out);
717721
GF_VALIDATE_OR_GOTO(this->name, frame, out);
718722
GF_VALIDATE_OR_GOTO(this->name, this->private, out);
719723

724+
ret = dict_lookup(dict, mask_key, &dict_data);
725+
if(!ret && dict_data){
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;
734+
}
735+
720736
fop = ec_fop_data_allocate(frame, this, GF_FOP_SETXATTR, 0, target,
721737
fop_flags, ec_wind_setxattr, ec_manager_xattr,
722738
callback, data);
@@ -757,7 +773,7 @@ ec_setxattr(call_frame_t *frame, xlator_t *this, uintptr_t target,
757773

758774
ec_t *ec = fop->xl->private;
759775
int64_t val = 0;
760-
int ret = dict_get_int64(fop->dict, SQUOTA_LIMIT_KEY, &val);
776+
ret = dict_get_int64(fop->dict, SQUOTA_LIMIT_KEY, &val);
761777
if (IS_SUCCESS(ret)) {
762778
/* divide the total usage to priv->fragments */
763779
int64_t new_value = val / ec->fragments;
@@ -775,7 +791,7 @@ ec_setxattr(call_frame_t *frame, xlator_t *this, uintptr_t target,
775791
if (fop != NULL) {
776792
ec_manager(fop, error);
777793
} else {
778-
func(frame, NULL, this, -1, error, NULL);
794+
func(frame, NULL, this, op_ret, error, NULL);
779795
}
780796
}
781797

0 commit comments

Comments
 (0)