summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/inode.c32
-rw-r--r--libglusterfs/src/inode.h5
-rw-r--r--libglusterfs/src/xlator.h4
3 files changed, 40 insertions, 1 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index a8958fa3bcc..1ed897ef5ec 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -344,6 +344,38 @@ __inode_destroy (inode_t *inode)
mem_put (inode);
}
+void
+inode_ctx_merge (fd_t *fd, inode_t *inode, inode_t *linked_inode)
+{
+ int index = 0;
+ xlator_t *xl = NULL;
+ xlator_t *old_THIS = NULL;
+
+ if (!fd || !inode || !linked_inode) {
+ gf_log_callingfn (THIS->name, GF_LOG_WARNING, "invalid inode");
+ return;
+ }
+
+ if (!inode->_ctx || !linked_inode->_ctx) {
+ gf_log_callingfn (THIS->name, GF_LOG_WARNING,
+ "invalid inode context");
+ return;
+ }
+
+ for (; index < inode->table->ctxcount; index++) {
+ if (inode->_ctx[index].xl_key) {
+ xl = (xlator_t *)(long) inode->_ctx[index].xl_key;
+
+ old_THIS = THIS;
+ THIS = xl;
+ if (xl->cbks->ictxmerge)
+ xl->cbks->ictxmerge (xl, fd,
+ inode, linked_inode);
+ THIS = old_THIS;
+ }
+ }
+}
+
static void
__inode_activate (inode_t *inode)
{
diff --git a/libglusterfs/src/inode.h b/libglusterfs/src/inode.h
index 5c550bc648b..f7ca1925aac 100644
--- a/libglusterfs/src/inode.h
+++ b/libglusterfs/src/inode.h
@@ -34,7 +34,7 @@ typedef struct _dentry dentry_t;
#include "xlator.h"
#include "iatt.h"
#include "uuid.h"
-
+#include "fd.h"
struct _inode_table {
pthread_mutex_t lock;
@@ -266,4 +266,7 @@ __inode_table_set_lru_limit (inode_table_t *table, uint32_t lru_limit);
void
inode_table_set_lru_limit (inode_table_t *table, uint32_t lru_limit);
+void
+inode_ctx_merge (fd_t *fd, inode_t *inode, inode_t *linked_inode);
+
#endif /* _INODE_H */
diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h
index 5a71ceb3f31..5a0b114d6a8 100644
--- a/libglusterfs/src/xlator.h
+++ b/libglusterfs/src/xlator.h
@@ -796,6 +796,9 @@ typedef int32_t (*cbk_invalidate_t)(xlator_t *this, inode_t *inode);
typedef int32_t (*cbk_client_t)(xlator_t *this, client_t *client);
+typedef void (*cbk_ictxmerge_t) (xlator_t *this, fd_t *fd,
+ inode_t *inode, inode_t *linked_inode);
+
struct xlator_cbks {
cbk_forget_t forget;
cbk_release_t release;
@@ -803,6 +806,7 @@ struct xlator_cbks {
cbk_invalidate_t invalidate;
cbk_client_t client_destroy;
cbk_client_t client_disconnect;
+ cbk_ictxmerge_t ictxmerge;
};
typedef int32_t (*dumpop_priv_t) (xlator_t *this);