summaryrefslogtreecommitdiffstats
path: root/xlators/features/shard/src/shard.h
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2018-04-12 15:47:00 +0530
committerKrutika Dhananjay <kdhananj@redhat.com>2018-06-20 15:14:56 +0530
commit0751039eadb23b8658423477aa81964b339b4f5e (patch)
treebd09f83a94840bfd8b8e8d02b80d5bc1666ed57d /xlators/features/shard/src/shard.h
parentcc2f2e7bfef6ca47e740c5ee6b4665ec2880f860 (diff)
features/shard: Perform shards deletion in the background
A synctask is created that would scan the indices from .shard/.remove_me, to delete the shards associated with the gfid corresponding to the index bname and the rate of deletion is controlled by the option features.shard-deletion-rate whose default value is 100. The task is launched on two accounts: 1. when shard receives its first-ever lookup on the volume 2. when a rename or unlink deleted an inode Change-Id: Ia83117230c9dd7d0d9cae05235644f8475e97bc3 updates: bz#1568521 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'xlators/features/shard/src/shard.h')
-rw-r--r--xlators/features/shard/src/shard.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/xlators/features/shard/src/shard.h b/xlators/features/shard/src/shard.h
index 1783ff6a003..5de098a7a44 100644
--- a/xlators/features/shard/src/shard.h
+++ b/xlators/features/shard/src/shard.h
@@ -130,9 +130,9 @@ shard_unlock_entrylk (call_frame_t *frame, xlator_t *this);
sizeof (*__bs)); \
if (__ret) { \
gf_msg (this->name, GF_LOG_WARNING, 0, \
- SHARD_MSG_DICT_SET_FAILED, "Failed to set key: %s " \
+ SHARD_MSG_DICT_OP_FAILED, "Failed to set key: %s " \
"on path %s", GF_XATTR_SHARD_BLOCK_SIZE, (loc)->path);\
- GF_FREE (__bs); \
+ GF_FREE (__bs); \
goto label; \
} \
\
@@ -144,7 +144,7 @@ shard_unlock_entrylk (call_frame_t *frame, xlator_t *this);
__size_attr, 8 * 4); \
if (__ret) { \
gf_msg (this->name, GF_LOG_WARNING, 0, \
- SHARD_MSG_DICT_SET_FAILED, "Failed to set key: %s " \
+ SHARD_MSG_DICT_OP_FAILED, "Failed to set key: %s " \
"on path %s", GF_XATTR_SHARD_FILE_SIZE, (loc)->path); \
GF_FREE (__size_attr); \
goto label; \
@@ -160,7 +160,7 @@ shard_unlock_entrylk (call_frame_t *frame, xlator_t *this);
local->op_ret = -1; \
local->op_errno = ENOMEM; \
gf_msg (this->name, GF_LOG_WARNING, 0, \
- SHARD_MSG_DICT_SET_FAILED, "Failed to set dict value:"\
+ SHARD_MSG_DICT_OP_FAILED, "Failed to set dict value:"\
" key:%s for %s.", GF_XATTR_SHARD_FILE_SIZE, \
uuid_utoa (gfid)); \
goto label; \
@@ -197,6 +197,12 @@ shard_unlock_entrylk (call_frame_t *frame, xlator_t *this);
} \
} while (0)
+typedef enum {
+ SHARD_FIRST_LOOKUP_PENDING = 0,
+ SHARD_FIRST_LOOKUP_IN_PROGRESS,
+ SHARD_FIRST_LOOKUP_DONE,
+} shard_first_lookup_state_t;
+
/* rm = "remove me" */
typedef struct shard_priv {
@@ -208,6 +214,8 @@ typedef struct shard_priv {
gf_lock_t lock;
int inode_count;
struct list_head ilist_head;
+ uint32_t deletion_rate;
+ shard_first_lookup_state_t first_lookup;
} shard_priv_t;
typedef struct {
@@ -303,6 +311,9 @@ typedef struct shard_local {
call_frame_t *main_frame;
call_frame_t *inodelk_frame;
call_frame_t *entrylk_frame;
+ uint32_t deletion_rate;
+ gf_boolean_t cleanup_required;
+ uuid_t base_gfid;
} shard_local_t;
typedef struct shard_inode_ctx {