summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorSachin Prabhu <sprabhu@redhat.com>2017-12-08 15:24:26 +0530
committerRaghavendra G <rgowdapp@redhat.com>2017-12-13 05:37:43 +0000
commit429f2436b33793136836042ccc43ce4cfd7f89f3 (patch)
tree683d306e5e7633c149fc4c4a539927a0df4e26c3 /xlators
parent56e5fdae74845dfec0ff7ad0c8fee77695d36ad5 (diff)
quick-read: Discard cache for fallocate, zerofill and discard ops
The fallocate, zerofill and discard modify file data on the server thus rendering stale any cache held by the xlator on the client. BUG: 1524252 Change-Id: I432146c6390a0cd5869420c373f598da43915f3f Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/performance/quick-read/src/quick-read.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 5afc7ec74ad..e4f0885de2c 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -668,6 +668,41 @@ qr_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
return 0;
}
+static int
+qr_fallocate (call_frame_t *frame, xlator_t *this, fd_t *fd, int keep_size,
+ off_t offset, size_t len, dict_t *xdata)
+{
+ qr_inode_prune (this, fd->inode);
+
+ STACK_WIND (frame, default_fallocate_cbk,
+ FIRST_CHILD (this), FIRST_CHILD (this)->fops->fallocate,
+ fd, keep_size, offset, len, xdata);
+ return 0;
+}
+
+static int
+qr_discard (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ size_t len, dict_t *xdata)
+{
+ qr_inode_prune (this, fd->inode);
+
+ STACK_WIND (frame, default_discard_cbk,
+ FIRST_CHILD (this), FIRST_CHILD (this)->fops->discard,
+ fd, offset, len, xdata);
+ return 0;
+}
+
+static int
+qr_zerofill (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
+ off_t len, dict_t *xdata)
+{
+ qr_inode_prune (this, fd->inode);
+
+ STACK_WIND (frame, default_zerofill_cbk,
+ FIRST_CHILD (this), FIRST_CHILD (this)->fops->zerofill,
+ fd, offset, len, xdata);
+ return 0;
+}
int
qr_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
@@ -1128,7 +1163,10 @@ struct xlator_fops fops = {
.readv = qr_readv,
.writev = qr_writev,
.truncate = qr_truncate,
- .ftruncate = qr_ftruncate
+ .ftruncate = qr_ftruncate,
+ .fallocate = qr_fallocate,
+ .discard = qr_discard,
+ .zerofill = qr_zerofill
};
struct xlator_cbks cbks = {