"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "xlators/cluster/afr/src/afr-inode-write.c" between
glusterfs-8.4.tar.gz and glusterfs-8.5.tar.gz

About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x.

afr-inode-write.c  (glusterfs-8.4):afr-inode-write.c  (glusterfs-8.5)
skipping to change at line 39 skipping to change at line 39
static void static void
__afr_inode_write_finalize(call_frame_t *frame, xlator_t *this) __afr_inode_write_finalize(call_frame_t *frame, xlator_t *this)
{ {
int i = 0; int i = 0;
int ret = 0; int ret = 0;
int read_subvol = 0; int read_subvol = 0;
struct iatt *stbuf = NULL; struct iatt *stbuf = NULL;
afr_local_t *local = NULL; afr_local_t *local = NULL;
afr_private_t *priv = NULL; afr_private_t *priv = NULL;
afr_lock_t *lock = NULL;
afr_read_subvol_args_t args = { afr_read_subvol_args_t args = {
0, 0,
}; };
local = frame->local; local = frame->local;
priv = this->private; priv = this->private;
GF_VALIDATE_OR_GOTO(this->name, local->inode, out); GF_VALIDATE_OR_GOTO(this->name, local->inode, out);
if (local->update_num_inodelks &&
local->transaction.type == AFR_DATA_TRANSACTION) {
lock = &local->inode_ctx->lock[local->transaction.type];
lock->num_inodelks = local->num_inodelks;
}
/*This code needs to stay till DHT sends fops on linked /*This code needs to stay till DHT sends fops on linked
* inodes*/ * inodes*/
if (!inode_is_linked(local->inode)) { if (!inode_is_linked(local->inode)) {
for (i = 0; i < priv->child_count; i++) { for (i = 0; i < priv->child_count; i++) {
if (!local->replies[i].valid) if (!local->replies[i].valid)
continue; continue;
if (local->replies[i].op_ret == -1) if (local->replies[i].op_ret == -1)
continue; continue;
if (!gf_uuid_is_null(local->replies[i].poststat.ia_gfid)) { if (!gf_uuid_is_null(local->replies[i].poststat.ia_gfid)) {
gf_uuid_copy(args.gfid, local->replies[i].poststat.ia_gfid); gf_uuid_copy(args.gfid, local->replies[i].poststat.ia_gfid);
skipping to change at line 131 skipping to change at line 138
return; return;
} }
static void static void
__afr_inode_write_fill(call_frame_t *frame, xlator_t *this, int child_index, __afr_inode_write_fill(call_frame_t *frame, xlator_t *this, int child_index,
int op_ret, int op_errno, struct iatt *prebuf, int op_ret, int op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xattr, dict_t *xdata) struct iatt *postbuf, dict_t *xattr, dict_t *xdata)
{ {
afr_local_t *local = NULL; afr_local_t *local = NULL;
afr_private_t *priv = NULL; afr_private_t *priv = NULL;
int num_inodelks = 0;
local = frame->local; local = frame->local;
priv = this->private; priv = this->private;
local->replies[child_index].valid = 1; local->replies[child_index].valid = 1;
if (AFR_IS_ARBITER_BRICK(priv, child_index) && op_ret == 1) if (AFR_IS_ARBITER_BRICK(priv, child_index) && op_ret == 1)
op_ret = iov_length(local->cont.writev.vector, op_ret = iov_length(local->cont.writev.vector,
local->cont.writev.count); local->cont.writev.count);
local->replies[child_index].op_ret = op_ret; local->replies[child_index].op_ret = op_ret;
local->replies[child_index].op_errno = op_errno; local->replies[child_index].op_errno = op_errno;
if (xdata) if (xdata) {
local->replies[child_index].xdata = dict_ref(xdata); local->replies[child_index].xdata = dict_ref(xdata);
if (dict_get_int32_sizen(xdata, GLUSTERFS_INODELK_COUNT,
&num_inodelks) == 0) {
if (num_inodelks > local->num_inodelks) {
local->num_inodelks = num_inodelks;
local->update_num_inodelks = _gf_true;
}
}
}
if (op_ret >= 0) { if (op_ret >= 0) {
if (prebuf) if (prebuf)
local->replies[child_index].prestat = *prebuf; local->replies[child_index].prestat = *prebuf;
if (postbuf) if (postbuf)
local->replies[child_index].poststat = *postbuf; local->replies[child_index].poststat = *postbuf;
if (xattr) if (xattr)
local->replies[child_index].xattr = dict_ref(xattr); local->replies[child_index].xattr = dict_ref(xattr);
} else { } else {
afr_transaction_fop_failed(frame, this, child_index); afr_transaction_fop_failed(frame, this, child_index);
skipping to change at line 280 skipping to change at line 296
void void
afr_inode_write_fill(call_frame_t *frame, xlator_t *this, int child_index, afr_inode_write_fill(call_frame_t *frame, xlator_t *this, int child_index,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf, int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata) struct iatt *postbuf, dict_t *xdata)
{ {
int ret = 0; int ret = 0;
afr_local_t *local = frame->local; afr_local_t *local = frame->local;
uint32_t open_fd_count = 0; uint32_t open_fd_count = 0;
uint32_t write_is_append = 0; uint32_t write_is_append = 0;
int32_t num_inodelks = 0;
LOCK(&frame->lock); LOCK(&frame->lock);
{ {
__afr_inode_write_fill(frame, this, child_index, op_ret, op_errno, __afr_inode_write_fill(frame, this, child_index, op_ret, op_errno,
prebuf, postbuf, NULL, xdata); prebuf, postbuf, NULL, xdata);
if (op_ret == -1 || !xdata) if (op_ret == -1 || !xdata)
goto unlock; goto unlock;
write_is_append = 0; write_is_append = 0;
ret = dict_get_uint32(xdata, GLUSTERFS_WRITE_IS_APPEND, ret = dict_get_uint32(xdata, GLUSTERFS_WRITE_IS_APPEND,
skipping to change at line 302 skipping to change at line 317
if (ret || !write_is_append) if (ret || !write_is_append)
local->append_write = _gf_false; local->append_write = _gf_false;
ret = dict_get_uint32(xdata, GLUSTERFS_ACTIVE_FD_COUNT, &open_fd_count); ret = dict_get_uint32(xdata, GLUSTERFS_ACTIVE_FD_COUNT, &open_fd_count);
if (ret < 0) if (ret < 0)
goto unlock; goto unlock;
if (open_fd_count > local->open_fd_count) { if (open_fd_count > local->open_fd_count) {
local->open_fd_count = open_fd_count; local->open_fd_count = open_fd_count;
local->update_open_fd_count = _gf_true; local->update_open_fd_count = _gf_true;
} }
ret = dict_get_int32_sizen(xdata, GLUSTERFS_INODELK_COUNT,
&num_inodelks);
if (ret < 0)
goto unlock;
if (num_inodelks > local->num_inodelks) {
local->num_inodelks = num_inodelks;
local->update_num_inodelks = _gf_true;
}
} }
unlock: unlock:
UNLOCK(&frame->lock); UNLOCK(&frame->lock);
} }
void void
afr_process_post_writev(call_frame_t *frame, xlator_t *this) afr_process_post_writev(call_frame_t *frame, xlator_t *this)
{ {
afr_local_t *local = NULL; afr_local_t *local = NULL;
afr_lock_t *lock = NULL;
local = frame->local; local = frame->local;
if (!local->stable_write && !local->append_write) if (!local->stable_write && !local->append_write)
/* An appended write removes the necessity to /* An appended write removes the necessity to
fsync() the file. This is because self-heal fsync() the file. This is because self-heal
has the logic to check for larger file when has the logic to check for larger file when
the xattrs are not reliably pointing at the xattrs are not reliably pointing at
a stale file. a stale file.
*/ */
afr_fd_report_unstable_write(this, local); afr_fd_report_unstable_write(this, local);
__afr_inode_write_finalize(frame, this); __afr_inode_write_finalize(frame, this);
afr_writev_handle_short_writes(frame, this); afr_writev_handle_short_writes(frame, this);
if (local->update_open_fd_count) if (local->update_open_fd_count)
local->inode_ctx->open_fd_count = local->open_fd_count; local->inode_ctx->open_fd_count = local->open_fd_count;
if (local->update_num_inodelks &&
local->transaction.type == AFR_DATA_TRANSACTION) {
lock = &local->inode_ctx->lock[local->transaction.type];
lock->num_inodelks = local->num_inodelks;
}
} }
int int
afr_writev_wind_cbk(call_frame_t *frame, void *cookie, xlator_t *this, afr_writev_wind_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct iatt *prebuf, int32_t op_ret, int32_t op_errno, struct iatt *prebuf,
struct iatt *postbuf, dict_t *xdata) struct iatt *postbuf, dict_t *xdata)
{ {
call_frame_t *fop_frame = NULL; call_frame_t *fop_frame = NULL;
int child_index = (long)cookie; int child_index = (long)cookie;
int call_count = -1; int call_count = -1;
skipping to change at line 2534 skipping to change at line 2534
local->transaction.disable_delayed_post_op = _gf_true; local->transaction.disable_delayed_post_op = _gf_true;
} }
} }
} else { } else {
local->xdata_req = dict_new(); local->xdata_req = dict_new();
} }
if (!local->xdata_req) if (!local->xdata_req)
goto out; goto out;
if (dict_set_str_sizen(local->xdata_req, GLUSTERFS_INODELK_DOM_COUNT,
this->name)) {
op_errno = ENOMEM;
goto out;
}
local->fd = fd_ref(fd); local->fd = fd_ref(fd);
ret = afr_set_inode_local(this, local, fd->inode); ret = afr_set_inode_local(this, local, fd->inode);
if (ret) if (ret)
goto out; goto out;
local->op = GF_FOP_FSYNC; local->op = GF_FOP_FSYNC;
local->cont.fsync.datasync = datasync; local->cont.fsync.datasync = datasync;
if (afr_fd_has_witnessed_unstable_write(this, fd->inode)) { if (afr_fd_has_witnessed_unstable_write(this, fd->inode)) {
/* don't care. we only wanted to CLEAR the bit */ /* don't care. we only wanted to CLEAR the bit */
 End of changes. 10 change blocks. 
17 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)