summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/cluster/dht/src/dht-common.c63
-rw-r--r--xlators/cluster/dht/src/dht-common.h7
-rw-r--r--xlators/cluster/dht/src/dht-helper.c6
-rw-r--r--xlators/cluster/dht/src/dht-rename.c6
4 files changed, 81 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index f5fd0bd7858..ee37d2f36af 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -26,6 +26,8 @@
int run_defrag = 0;
+
+
int dht_link2 (xlator_t *this, xlator_t *dst_node, call_frame_t *frame,
int ret);
@@ -37,6 +39,21 @@ int
dht_setxattr2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame,
int ret);
+
+/* Sets the blocks and size values to fixed values. This is to be called
+ * only for dirs. The caller is responsible for checking the type
+ */
+int32_t dht_set_fixed_dir_stat (struct iatt *stat)
+{
+ if (stat) {
+ stat->ia_blocks = DHT_DIR_STAT_BLOCKS;
+ stat->ia_size = DHT_DIR_STAT_SIZE;
+ return 0;
+ }
+ return -1;
+}
+
+
int
dht_aggregate_quota_xattr (dict_t *dst, char *key, data_t *value)
{
@@ -205,6 +222,7 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie,
}
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (lookup, frame, ret, local->op_errno, local->inode,
&local->stbuf, local->xattr, &local->postparent);
@@ -364,6 +382,7 @@ cleanup:
}
done:
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (lookup, main_frame, local->op_ret, local->op_errno,
local->inode, &local->stbuf, local->xattr,
&local->postparent);
@@ -714,6 +733,7 @@ unlock:
}
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
local->inode, &local->stbuf, local->xattr,
&local->postparent);
@@ -971,6 +991,7 @@ cont:
}
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
local->inode, &local->stbuf, local->xattr,
&local->postparent);
@@ -1041,6 +1062,8 @@ unwind:
dht_linkfile_attr_heal (frame, this);
+ dht_set_fixed_dir_stat (&local->postparent);
+
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
DHT_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
local->inode, &local->stbuf, local->xattr,
@@ -1506,6 +1529,7 @@ preset_layout:
}
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (lookup, frame, local->op_ret,
local->op_errno, local->inode,
&local->stbuf, local->xattr,
@@ -1542,6 +1566,7 @@ preset_layout:
}
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (lookup, frame, local->op_ret,
local->op_errno, local->inode,
&local->stbuf, local->xattr,
@@ -1562,6 +1587,7 @@ preset_layout:
unwind_hashed_and_cached:
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
local->loc.inode, &local->stbuf, local->xattr,
&local->postparent);
@@ -1907,6 +1933,7 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
unwind:
DHT_STRIP_PHASE1_FLAGS (stbuf);
+ dht_set_fixed_dir_stat (postparent);
DHT_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, stbuf, xattr,
postparent);
@@ -2153,6 +2180,7 @@ out:
}
DHT_STRIP_PHASE1_FLAGS (stbuf);
+ dht_set_fixed_dir_stat (postparent);
DHT_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, stbuf, xattr,
postparent);
err:
@@ -2468,7 +2496,8 @@ dht_unlink_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
unlock:
UNLOCK (&frame->lock);
-
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (unlink, frame, local->op_ret, local->op_errno,
&local->preparent, &local->postparent, xdata);
@@ -2534,6 +2563,8 @@ unlock:
}
}
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (unlink, frame, local->op_ret, local->op_errno,
&local->preparent, &local->postparent, xdata);
@@ -4708,6 +4739,8 @@ list:
currently possible only for non-directories, so for
directories don't set entry inodes */
if (IA_ISDIR(entry->d_stat.ia_type)) {
+ entry->d_stat.ia_blocks = DHT_DIR_STAT_BLOCKS;
+ entry->d_stat.ia_size = DHT_DIR_STAT_SIZE;
if (orig_entry->inode) {
dht_inode_ctx_time_update (orig_entry->inode,
this, &entry->d_stat,
@@ -5160,6 +5193,8 @@ out:
* See dht_iatt_merge for reference.
*/
DHT_STRIP_PHASE1_FLAGS (stbuf);
+ dht_set_fixed_dir_stat (postparent);
+ dht_set_fixed_dir_stat (preparent);
if (local && local->lock.locks) {
/* store op_errno for failure case*/
@@ -5772,6 +5807,8 @@ dht_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
DHT_STRIP_PHASE1_FLAGS (stbuf);
+ dht_set_fixed_dir_stat (preparent);
+ dht_set_fixed_dir_stat (postparent);
DHT_STACK_UNWIND (link, frame, op_ret, op_errno, inode, stbuf,
preparent, postparent, NULL);
@@ -5796,6 +5833,9 @@ dht_link2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
* pass on the original mode bits so the higher DHT layer
* can handle this.
*/
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
+
DHT_STACK_UNWIND (link, frame, local->op_ret, op_errno,
local->inode,
&local->stbuf, &local->preparent,
@@ -5813,6 +5853,8 @@ dht_link2 (xlator_t *this, xlator_t *subvol, call_frame_t *frame, int ret)
* migrating subvol, which could be the new hashed subvol */
if (local->link_subvol == subvol) {
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
DHT_STACK_UNWIND (link, frame, 0, 0, local->inode,
&local->stbuf, &local->preparent,
&local->postparent, NULL);
@@ -5856,6 +5898,8 @@ dht_link_linkfile_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
err:
DHT_STRIP_PHASE1_FLAGS (stbuf);
+ dht_set_fixed_dir_stat (preparent);
+ dht_set_fixed_dir_stat (postparent);
DHT_STACK_UNWIND (link, frame, op_ret, op_errno, inode, stbuf, preparent,
postparent, NULL);
@@ -5978,6 +6022,8 @@ dht_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
out:
DHT_STRIP_PHASE1_FLAGS (stbuf);
+ dht_set_fixed_dir_stat (preparent);
+ dht_set_fixed_dir_stat (postparent);
if (local && local->lock.locks) {
/* store op_errno for failure case*/
@@ -6488,6 +6534,9 @@ dht_mkdir_selfheal_cbk (call_frame_t *frame, void *cookie,
local = frame->local;
layout = local->selfheal.layout;
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
+
if (op_ret == 0) {
dht_layout_set (this, local->inode, layout);
@@ -6736,6 +6785,9 @@ dht_rmdir_selfheal_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local = frame->local;
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
+
DHT_STACK_UNWIND (rmdir, frame, local->op_ret, local->op_errno,
&local->preparent, &local->postparent, NULL);
@@ -6813,6 +6865,9 @@ unlock:
1);
}
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
+
DHT_STACK_UNWIND (rmdir, frame, local->op_ret,
local->op_errno, &local->preparent,
&local->postparent, NULL);
@@ -6915,6 +6970,9 @@ unlock:
}
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
+
DHT_STACK_UNWIND (rmdir, frame, local->op_ret,
local->op_errno, &local->preparent,
&local->postparent, NULL);
@@ -6982,6 +7040,9 @@ dht_rmdir_do (call_frame_t *frame, xlator_t *this)
return 0;
err:
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
+
DHT_STACK_UNWIND (rmdir, frame, local->op_ret, local->op_errno,
&local->preparent, &local->postparent, NULL);
return 0;
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h
index 6ba94ec8814..9238bf09a38 100644
--- a/xlators/cluster/dht/src/dht-common.h
+++ b/xlators/cluster/dht/src/dht-common.h
@@ -31,6 +31,9 @@
#define TIERING_MIGRATION_KEY "tiering.migration"
#define DHT_LAYOUT_HASH_INVALID 1
+#define DHT_DIR_STAT_BLOCKS 8
+#define DHT_DIR_STAT_SIZE 4096
+
#include <fnmatch.h>
typedef int (*dht_selfheal_dir_cbk_t) (call_frame_t *frame, void *cookie,
@@ -1168,4 +1171,8 @@ dht_fd_ctx_destroy (xlator_t *this, fd_t *fd);
int32_t
dht_release (xlator_t *this, fd_t *fd);
+
+
+int32_t
+dht_set_fixed_dir_stat (struct iatt *stat);
#endif/* _DHT_H */
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 79f6ab795f2..8e82eef697c 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -915,6 +915,10 @@ dht_iatt_merge (xlator_t *this, struct iatt *to,
to->ia_blksize = from->ia_blksize;
to->ia_blocks += from->ia_blocks;
+ if (IA_ISDIR (from->ia_type)) {
+ to->ia_blocks = DHT_DIR_STAT_BLOCKS;
+ to->ia_size = DHT_DIR_STAT_SIZE;
+ }
set_if_greater (to->ia_uid, from->ia_uid);
set_if_greater (to->ia_gid, from->ia_gid);
@@ -2257,6 +2261,8 @@ dht_heal_full_path_done (int op_ret, call_frame_t *heal_frame, void *data)
main_frame = local->main_frame;
local->main_frame = NULL;
+ dht_set_fixed_dir_stat (&local->postparent);
+
DHT_STACK_UNWIND (lookup, main_frame, 0, 0,
local->inode, &local->stbuf, local->xattr,
&local->postparent);
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index 80047264f0e..146faa1a257 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -157,6 +157,7 @@ unwind:
WIPE (&local->postparent);
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
+
DHT_STACK_UNWIND (rename, frame, local->op_ret, local->op_errno,
&local->stbuf, &local->preoldparent,
&local->postoldparent,
@@ -422,6 +423,11 @@ dht_rename_unlock_cbk (call_frame_t *frame, void *cookie,
local = frame->local;
DHT_STRIP_PHASE1_FLAGS (&local->stbuf);
+ dht_set_fixed_dir_stat (&local->preoldparent);
+ dht_set_fixed_dir_stat (&local->postoldparent);
+ dht_set_fixed_dir_stat (&local->preparent);
+ dht_set_fixed_dir_stat (&local->postparent);
+
DHT_STACK_UNWIND (rename, frame, local->op_ret, local->op_errno,
&local->stbuf, &local->preoldparent,
&local->postoldparent, &local->preparent,