diff options
author | Ashish Pandey <aspandey@redhat.com> | 2017-12-05 11:03:42 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2017-12-05 15:46:53 +0000 |
commit | 1889e2b42917a996cef6958ee3880344028d9d9a (patch) | |
tree | 8488eb62701bb94257c5239b6d2c379dc3d3376e /xlators/cluster | |
parent | 4e798113229eab68e9e02364bb094a4ab8274c65 (diff) |
cluster/ec: Fix bugs in stripe-cache feature
1 - This patch fixes a bug in ec_update_stripe()
that prevented some stripes to be updated after a write.
2 - This patch also include code modification for the
case in which a file does not exist and we write on
unaligned offset and user size, the last stripe on
which "end" will fall should also be cached.
Change-Id: I069cb4be1c8d59c206e3b35a6991e1fbdbc9b474
BUG: 1520758
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/ec/src/ec-common.c | 2 | ||||
-rw-r--r-- | xlators/cluster/ec/src/ec-inode-write.c | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c index 29ab66f374c..8ddda9b1370 100644 --- a/xlators/cluster/ec/src/ec-common.c +++ b/xlators/cluster/ec/src/ec-common.c @@ -2507,7 +2507,7 @@ ec_update_stripe(ec_t *ec, ec_stripe_list_t *stripe_cache, ec_stripe_t *stripe, * size by the user, so we update the stripe if the write has * modified at least one byte (meaning ec has written the full * stripe). */ - if (base < fop->answer->op_ret) { + if (base < fop->answer->op_ret + fop->head) { memcpy(stripe->data, fop->vector[0].iov_base + base, ec->stripe_size); list_move_tail(&stripe->lru, &stripe_cache->lru); diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c index afdb50c826e..bf45a867971 100644 --- a/xlators/cluster/ec/src/ec-inode-write.c +++ b/xlators/cluster/ec/src/ec-inode-write.c @@ -2094,6 +2094,9 @@ void ec_writev_start(ec_fop_data_t *fop) } } else { memset(fop->vector[0].iov_base + fop->size - tail, 0, tail); + if (ec->stripe_cache) { + ec_add_stripe_in_cache (ec, fop); + } } } |