summaryrefslogtreecommitdiffstats
path: root/xlators/features/shard/src/shard.h
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-09-29 15:13:37 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-10-08 22:17:13 -0700
commit62851271df97c584b43a7b2458d6bccc97dee029 (patch)
treed79981e02fd25771695943f532e58cc6cbbb8c74 /xlators/features/shard/src/shard.h
parent4ad9bc5faca60528345f1e9c95c22bd8402162c0 (diff)
features/shard: Regulate memory consumption by individual shards' inode_t objects
Shard translator will now maintain an lru list of inodes associated with individual shards of constant size, and will make sure that at no point the number of these inodes will exceed the configured limit. This is to keep the memory consumption by the thousands of shards of every large file from exploding. Change-Id: I5e60eea5dcf3130257fb431ca70cfaba53cae7f3 BUG: 1252263 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/12254 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/features/shard/src/shard.h')
-rw-r--r--xlators/features/shard/src/shard.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/xlators/features/shard/src/shard.h b/xlators/features/shard/src/shard.h
index 69414bfe1b5..b3d9b795957 100644
--- a/xlators/features/shard/src/shard.h
+++ b/xlators/features/shard/src/shard.h
@@ -24,7 +24,7 @@
#define GF_XATTR_SHARD_FILE_SIZE "trusted.glusterfs.shard.file-size"
#define SHARD_ROOT_GFID "be318638-e8a0-4c6d-977d-7a937aa84806"
#define SHARD_INODE_LRU_LIMIT 4096
-
+#define SHARD_MAX_INODES 16384
/**
* Bit masks for the valid flag, which is used while updating ctx
**/
@@ -177,6 +177,9 @@ typedef struct shard_priv {
uint64_t block_size;
uuid_t dot_shard_gfid;
inode_t *dot_shard_inode;
+ gf_lock_t lock;
+ int inode_count;
+ struct list_head ilist_head;
} shard_priv_t;
typedef struct {
@@ -258,6 +261,12 @@ typedef struct shard_inode_ctx {
uint64_t block_size; /* The block size with which this inode is
sharded */
struct iatt stat;
+ /* The following members of inode ctx will be applicable only to the
+ * individual shards' ctx and never the base file ctx.
+ */
+ struct list_head ilist;
+ uuid_t base_gfid;
+ int block_num;
} shard_inode_ctx_t;
#endif /* __SHARD_H__ */