diff options
author | Raghavendra G <raghavendra@zresearch.com> | 2009-07-09 00:29:06 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-07-16 00:37:48 -0700 |
commit | eb4d32ae6b30e5a6aaebf068cc07e7ad2c6ea6d2 (patch) | |
tree | a3b232e38eee1ef8c79087c488c4fea7290d97fe /xlators/performance/quick-read/src/quick-read.c | |
parent | 8a184d6f5674b3d5ec50eeaf089ded3c9c14300f (diff) |
quick-read: implement release and forget cbks.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'xlators/performance/quick-read/src/quick-read.c')
-rw-r--r-- | xlators/performance/quick-read/src/quick-read.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index 9c120ffcc..7bc912e3d 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -2075,6 +2075,53 @@ out: } +int32_t +qr_release (xlator_t *this, fd_t *fd) +{ + qr_fd_ctx_t *qr_fd_ctx = NULL; + int32_t ret = 0; + uint64_t value = 0; + + ret = fd_ctx_del (fd, this, &value); + if (ret == 0) { + qr_fd_ctx = (qr_fd_ctx_t *)(long) value; + if (qr_fd_ctx) { + qr_fd_ctx_free (qr_fd_ctx); + } + } + + return 0; +} + + +int32_t +qr_forget (xlator_t *this, inode_t *inode) +{ + qr_file_t *qr_file = NULL; + uint64_t value = 0; + int32_t ret = -1; + + ret = inode_ctx_del (inode, this, &value); + if (ret == 0) { + qr_file = (qr_file_t *)(long) value; + if (qr_file) { + LOCK (&qr_file->lock); + { + if (qr_file->xattr) { + dict_unref (qr_file->xattr); + qr_file->xattr = NULL; + } + } + UNLOCK (&qr_file->lock); + } + + FREE (qr_file); + } + + return 0; +} + + int32_t init (xlator_t *this) { @@ -2170,6 +2217,8 @@ struct xlator_mops mops = { struct xlator_cbks cbks = { + .forget = qr_forget, + .release = qr_release, }; struct volume_options options[] = { |