summaryrefslogtreecommitdiffstats
path: root/xlators/features/shard/src
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2016-03-08 15:44:04 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-03-11 11:10:30 -0800
commit0e048b309b64e574039fc1ebedb971791d43b5e1 (patch)
tree0b9adb61d7872a09113283f42b5e46e913efa559 /xlators/features/shard/src
parentdf7390c9d7db40dcd68cf1020b6248f5105ab8eb (diff)
features/shard: Implement discard fop
Change-Id: Ia5bd8d36b21a586df6556fbec3474892d5871229 BUG: 1261841 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/13657 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/shard/src')
-rw-r--r--xlators/features/shard/src/shard.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index 8e4443535e9..154411682f3 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -502,6 +502,10 @@ shard_common_inode_write_failure_unwind (glusterfs_fop_t fop,
SHARD_STACK_UNWIND (zerofill, frame, op_ret, op_errno,
NULL, NULL, NULL);
break;
+ case GF_FOP_DISCARD:
+ SHARD_STACK_UNWIND (discard, frame, op_ret, op_errno,
+ NULL, NULL, NULL);
+ break;
default:
gf_msg (THIS->name, GF_LOG_WARNING, 0, SHARD_MSG_INVALID_FOP,
"Invalid fop id = %d", fop);
@@ -531,6 +535,10 @@ shard_common_inode_write_success_unwind (glusterfs_fop_t fop,
SHARD_STACK_UNWIND (zerofill, frame, op_ret, 0, &local->prebuf,
&local->postbuf, local->xattr_rsp);
break;
+ case GF_FOP_DISCARD:
+ SHARD_STACK_UNWIND (discard, frame, op_ret, 0, &local->prebuf,
+ &local->postbuf, local->xattr_rsp);
+ break;
default:
gf_msg (THIS->name, GF_LOG_WARNING, 0, SHARD_MSG_INVALID_FOP,
"Invalid fop id = %d", fop);
@@ -3556,6 +3564,12 @@ shard_common_inode_write_wind (call_frame_t *frame, xlator_t *this,
FIRST_CHILD(this)->fops->zerofill, fd,
shard_offset, size, local->xattr_req);
break;
+ case GF_FOP_DISCARD:
+ STACK_WIND_COOKIE (frame, shard_common_inode_write_do_cbk, fd,
+ FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->discard, fd,
+ shard_offset, size, local->xattr_req);
+ break;
default:
gf_msg (this->name, GF_LOG_WARNING, 0, SHARD_MSG_INVALID_FOP,
"Invalid fop id = %d", local->fop);
@@ -4502,6 +4516,11 @@ shard_common_inode_write_begin (call_frame_t *frame, xlator_t *this,
FIRST_CHILD(this)->fops->zerofill,
fd, offset, len, xdata);
break;
+ case GF_FOP_DISCARD:
+ STACK_WIND_TAIL (frame, FIRST_CHILD(this),
+ FIRST_CHILD(this)->fops->discard,
+ fd, offset, len, xdata);
+ break;
default:
gf_msg (this->name, GF_LOG_WARNING, 0, SHARD_MSG_INVALID_FOP,
"Invalid fop id = %d", fop);
@@ -4614,12 +4633,10 @@ shard_zerofill (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
int
shard_discard (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
- size_t len, dict_t *xdata)
+ size_t len, dict_t *xdata)
{
- /* TBD */
- gf_msg (this->name, GF_LOG_INFO, ENOTSUP, SHARD_MSG_FOP_NOT_SUPPORTED,
- "discard called on %s.", uuid_utoa (fd->inode->gfid));
- SHARD_STACK_UNWIND (discard, frame, -1, ENOTSUP, NULL, NULL, NULL);
+ shard_common_inode_write_begin (frame, this, GF_FOP_DISCARD, fd, NULL,
+ 0, offset, 0, len, NULL, xdata);
return 0;
}