diff options
-rw-r--r-- | libglusterfs/src/call-stub.c | 414 | ||||
-rw-r--r-- | libglusterfs/src/call-stub.h | 124 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.c | 29 | ||||
-rw-r--r-- | libglusterfs/src/defaults.c | 156 | ||||
-rw-r--r-- | libglusterfs/src/defaults.h | 27 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 7 | ||||
-rw-r--r-- | libglusterfs/src/protocol.h | 54 | ||||
-rw-r--r-- | libglusterfs/src/xlator.c | 5 | ||||
-rw-r--r-- | libglusterfs/src/xlator.h | 72 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-data.c | 33 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 5 | ||||
-rw-r--r-- | xlators/performance/write-behind/src/write-behind.c | 42 |
12 files changed, 58 insertions, 910 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index a56ed95f02d..cdbbcfae1f9 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -198,194 +198,6 @@ out: } -call_stub_t * -fop_chmod_stub (call_frame_t *frame, - fop_chmod_t fn, - loc_t *loc, - mode_t mode) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - GF_VALIDATE_OR_GOTO ("call-stub", loc, out); - - stub = stub_new (frame, 1, GF_FOP_CHMOD); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.chmod.fn = fn; - loc_copy (&stub->args.chmod.loc, loc); - stub->args.chmod.mode = mode; -out: - return stub; -} - - -call_stub_t * -fop_chmod_cbk_stub (call_frame_t *frame, - fop_chmod_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 0, GF_FOP_CHMOD); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.chmod_cbk.fn = fn; - stub->args.chmod_cbk.op_ret = op_ret; - stub->args.chmod_cbk.op_errno = op_errno; - if (buf) - stub->args.chmod_cbk.buf = *buf; -out: - return stub; -} - - -call_stub_t * -fop_fchmod_stub (call_frame_t *frame, - fop_fchmod_t fn, - fd_t *fd, - mode_t mode) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 1, GF_FOP_FCHMOD); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.fchmod.fn = fn; - if (fd) - stub->args.fchmod.fd = fd_ref (fd); - stub->args.fchmod.mode = mode; -out: - return stub; -} - - -call_stub_t * -fop_fchmod_cbk_stub (call_frame_t *frame, - fop_fchmod_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 0, GF_FOP_FCHMOD); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.fchmod_cbk.fn = fn; - stub->args.fchmod_cbk.op_ret = op_ret; - stub->args.fchmod_cbk.op_errno = op_errno; - if (buf) - stub->args.fchmod_cbk.buf = *buf; -out: - return stub; -} - - -call_stub_t * -fop_chown_stub (call_frame_t *frame, - fop_chown_t fn, - loc_t *loc, - uid_t uid, - gid_t gid) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - GF_VALIDATE_OR_GOTO ("call-stub", loc, out); - - stub = stub_new (frame, 1, GF_FOP_CHOWN); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.chown.fn = fn; - loc_copy (&stub->args.chown.loc, loc); - stub->args.chown.uid = uid; - stub->args.chown.gid = gid; -out: - return stub; -} - - -call_stub_t * -fop_chown_cbk_stub (call_frame_t *frame, - fop_chown_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 0, GF_FOP_CHOWN); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.chown_cbk.fn = fn; - stub->args.chown_cbk.op_ret = op_ret; - stub->args.chown_cbk.op_errno = op_errno; - if (buf) - stub->args.chown_cbk.buf = *buf; -out: - return stub; -} - - -call_stub_t * -fop_fchown_stub (call_frame_t *frame, - fop_fchown_t fn, - fd_t *fd, - uid_t uid, - gid_t gid) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 1, GF_FOP_FCHOWN); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.fchown.fn = fn; - if (fd) - stub->args.fchown.fd = fd_ref (fd); - stub->args.fchown.uid = uid; - stub->args.fchown.gid = gid; -out: - return stub; -} - - -call_stub_t * -fop_fchown_cbk_stub (call_frame_t *frame, - fop_fchown_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 0, GF_FOP_FCHOWN); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.fchown_cbk.fn = fn; - stub->args.fchown_cbk.op_ret = op_ret; - stub->args.fchown_cbk.op_errno = op_errno; - if (buf) - stub->args.fchown_cbk.buf = *buf; -out: - return stub; -} - - /* truncate */ call_stub_t * @@ -488,53 +300,6 @@ out: call_stub_t * -fop_utimens_stub (call_frame_t *frame, - fop_utimens_t fn, - loc_t *loc, - struct timespec tv[2]) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - GF_VALIDATE_OR_GOTO ("call-stub", loc, out); - - stub = stub_new (frame, 1, GF_FOP_UTIMENS); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.utimens.fn = fn; - loc_copy (&stub->args.utimens.loc, loc); - stub->args.utimens.tv[0] = tv[0]; - stub->args.utimens.tv[1] = tv[1]; -out: - return stub; -} - - -call_stub_t * -fop_utimens_cbk_stub (call_frame_t *frame, - fop_utimens_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 0, GF_FOP_UTIMENS); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.utimens_cbk.fn = fn; - stub->args.utimens_cbk.op_ret = op_ret; - stub->args.utimens_cbk.op_errno = op_errno; - if (buf) - stub->args.utimens_cbk.buf = *buf; -out: - return stub; -} - - -call_stub_t * fop_access_stub (call_frame_t *frame, fop_access_t fn, loc_t *loc, @@ -2688,24 +2453,6 @@ call_resume_wind (call_stub_t *stub) } break; - case GF_FOP_CHMOD: - { - stub->args.chmod.fn (stub->frame, - stub->frame->this, - &stub->args.chmod.loc, - stub->args.chmod.mode); - } - break; - - case GF_FOP_CHOWN: - { - stub->args.chown.fn (stub->frame, - stub->frame->this, - &stub->args.chown.loc, - stub->args.chown.uid, - stub->args.chown.gid); - break; - } case GF_FOP_TRUNCATE: { stub->args.truncate.fn (stub->frame, @@ -2919,35 +2666,7 @@ call_resume_wind (call_stub_t *stub) break; } - case GF_FOP_UTIMENS: - { - stub->args.utimens.fn (stub->frame, - stub->frame->this, - &stub->args.utimens.loc, - stub->args.utimens.tv); - break; - } - - break; - case GF_FOP_FCHMOD: - { - stub->args.fchmod.fn (stub->frame, - stub->frame->this, - stub->args.fchmod.fd, - stub->args.fchmod.mode); - break; - } - - case GF_FOP_FCHOWN: - { - stub->args.fchown.fn (stub->frame, - stub->frame->this, - stub->args.fchown.fd, - stub->args.fchown.uid, - stub->args.fchown.gid); - break; - } case GF_FOP_LOOKUP: { @@ -3322,40 +3041,6 @@ call_resume_unwind (call_stub_t *stub) break; } - case GF_FOP_CHMOD: - { - if (!stub->args.chmod_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.chmod_cbk.op_ret, - stub->args.chmod_cbk.op_errno, - &stub->args.chmod_cbk.buf); - else - stub->args.chmod_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.chmod_cbk.op_ret, - stub->args.chmod_cbk.op_errno, - &stub->args.chmod_cbk.buf); - break; - } - - case GF_FOP_CHOWN: - { - if (!stub->args.chown_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.chown_cbk.op_ret, - stub->args.chown_cbk.op_errno, - &stub->args.chown_cbk.buf); - else - stub->args.chown_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.chown_cbk.op_ret, - stub->args.chown_cbk.op_errno, - &stub->args.chown_cbk.buf); - break; - } - case GF_FOP_TRUNCATE: { if (!stub->args.truncate_cbk.fn) @@ -3738,60 +3423,6 @@ call_resume_unwind (call_stub_t *stub) break; } - case GF_FOP_UTIMENS: - { - if (!stub->args.utimens_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.utimens_cbk.op_ret, - stub->args.utimens_cbk.op_errno, - &stub->args.utimens_cbk.buf); - else - stub->args.utimens_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.utimens_cbk.op_ret, - stub->args.utimens_cbk.op_errno, - &stub->args.utimens_cbk.buf); - - break; - } - - - break; - case GF_FOP_FCHMOD: - { - if (!stub->args.fchmod_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fchmod_cbk.op_ret, - stub->args.fchmod_cbk.op_errno, - &stub->args.fchmod_cbk.buf); - else - stub->args.fchmod_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fchmod_cbk.op_ret, - stub->args.fchmod_cbk.op_errno, - &stub->args.fchmod_cbk.buf); - break; - } - - case GF_FOP_FCHOWN: - { - if (!stub->args.fchown_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.fchown_cbk.op_ret, - stub->args.fchown_cbk.op_errno, - &stub->args.fchown_cbk.buf); - else - stub->args.fchown_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.fchown_cbk.op_ret, - stub->args.fchown_cbk.op_errno, - &stub->args.fchown_cbk.buf); - break; - } - case GF_FOP_LOOKUP: { if (!stub->args.lookup_cbk.fn) @@ -4118,17 +3749,6 @@ call_stub_destroy_wind (call_stub_t *stub) } break; - case GF_FOP_CHMOD: - { - loc_wipe (&stub->args.chmod.loc); - } - break; - - case GF_FOP_CHOWN: - { - loc_wipe (&stub->args.chown.loc); - break; - } case GF_FOP_TRUNCATE: { loc_wipe (&stub->args.truncate.loc); @@ -4299,25 +3919,6 @@ call_stub_destroy_wind (call_stub_t *stub) fd_unref (stub->args.fentrylk.fd); break; } - case GF_FOP_UTIMENS: - { - loc_wipe (&stub->args.utimens.loc); - break; - } - break; - case GF_FOP_FCHMOD: - { - if (stub->args.fchmod.fd) - fd_unref (stub->args.fchmod.fd); - break; - } - - case GF_FOP_FCHOWN: - { - if (stub->args.fchown.fd) - fd_unref (stub->args.fchown.fd); - break; - } case GF_FOP_LOOKUP: { @@ -4485,12 +4086,6 @@ call_stub_destroy_unwind (call_stub_t *stub) } break; - case GF_FOP_CHMOD: - break; - - case GF_FOP_CHOWN: - break; - case GF_FOP_TRUNCATE: break; @@ -4592,15 +4187,6 @@ call_stub_destroy_unwind (call_stub_t *stub) case GF_FOP_FENTRYLK: break; - case GF_FOP_UTIMENS: - break; - - case GF_FOP_FCHMOD: - break; - - case GF_FOP_FCHOWN: - break; - case GF_FOP_LOOKUP: { if (stub->args.lookup_cbk.inode) diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index ae414026fe4..649f9c64a8c 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -73,56 +73,6 @@ typedef struct { struct stat buf; } fstat_cbk; - /* chmod */ - struct { - fop_chmod_t fn; - loc_t loc; - mode_t mode; - } chmod; - struct { - fop_chmod_cbk_t fn; - int32_t op_ret, op_errno; - struct stat buf; - } chmod_cbk; - - /* fchmod */ - struct { - fop_fchmod_t fn; - fd_t *fd; - mode_t mode; - } fchmod; - struct { - fop_fchmod_cbk_t fn; - int32_t op_ret, op_errno; - struct stat buf; - } fchmod_cbk; - - /* chown */ - struct { - fop_chown_t fn; - loc_t loc; - uid_t uid; - gid_t gid; - } chown; - struct { - fop_chown_cbk_t fn; - int32_t op_ret, op_errno; - struct stat buf; - } chown_cbk; - - /* fchown */ - struct { - fop_fchown_t fn; - fd_t *fd; - uid_t uid; - gid_t gid; - } fchown; - struct { - fop_fchown_cbk_t fn; - int32_t op_ret, op_errno; - struct stat buf; - } fchown_cbk; - /* truncate */ struct { fop_truncate_t fn; @@ -149,18 +99,6 @@ typedef struct { struct stat postbuf; } ftruncate_cbk; - /* utimens */ - struct { - fop_utimens_t fn; - loc_t loc; - struct timespec tv[2]; - } utimens; - struct { - fop_utimens_cbk_t fn; - int32_t op_ret, op_errno; - struct stat buf; - } utimens_cbk; - /* access */ struct { fop_access_t fn; @@ -739,55 +677,6 @@ fop_fstat_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno, struct stat *buf); -call_stub_t * -fop_chmod_stub (call_frame_t *frame, - fop_chmod_t fn, - loc_t *loc, - mode_t mode); -call_stub_t * -fop_chmod_cbk_stub (call_frame_t *frame, - fop_chmod_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); -call_stub_t * -fop_fchmod_stub (call_frame_t *frame, - fop_fchmod_t fn, - fd_t *fd, - mode_t mode); -call_stub_t * -fop_fchmod_cbk_stub (call_frame_t *frame, - fop_fchmod_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); -call_stub_t * -fop_chown_stub (call_frame_t *frame, - fop_chown_t fn, - loc_t *loc, - uid_t uid, - gid_t gid); - -call_stub_t * -fop_chown_cbk_stub (call_frame_t *frame, - fop_chown_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); - -call_stub_t * -fop_fchown_stub (call_frame_t *frame, - fop_fchown_t fn, - fd_t *fd, - uid_t uid, - gid_t gid); - -call_stub_t * -fop_fchown_cbk_stub (call_frame_t *frame, - fop_fchown_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); call_stub_t * fop_truncate_stub (call_frame_t *frame, @@ -818,19 +707,6 @@ fop_ftruncate_cbk_stub (call_frame_t *frame, struct stat *postbuf); call_stub_t * -fop_utimens_stub (call_frame_t *frame, - fop_utimens_t fn, - loc_t *loc, - struct timespec tv[2]); - -call_stub_t * -fop_utimens_cbk_stub (call_frame_t *frame, - fop_utimens_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); - -call_stub_t * fop_access_stub (call_frame_t *frame, fop_access_t fn, loc_t *loc, diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 59ac5386e4a..30c92d43a2d 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -179,37 +179,32 @@ gf_global_variable_init() gf_fop_list[GF_FOP_SYMLINK] = "SYMLINK"; gf_fop_list[GF_FOP_RENAME] = "RENAME"; gf_fop_list[GF_FOP_LINK] = "LINK"; - gf_fop_list[GF_FOP_CHMOD] = "CHMOD"; - gf_fop_list[GF_FOP_CHOWN] = "CHOWN"; /* 10 */ gf_fop_list[GF_FOP_TRUNCATE] = "TRUNCATE"; - gf_fop_list[GF_FOP_OPEN] = "OPEN"; + gf_fop_list[GF_FOP_OPEN] = "OPEN"; /* 10 */ gf_fop_list[GF_FOP_READ] = "READ"; gf_fop_list[GF_FOP_WRITE] = "WRITE"; - gf_fop_list[GF_FOP_STATFS] = "STATFS"; /* 15 */ + gf_fop_list[GF_FOP_STATFS] = "STATFS"; gf_fop_list[GF_FOP_FLUSH] = "FLUSH"; - gf_fop_list[GF_FOP_FSYNC] = "FSYNC"; + gf_fop_list[GF_FOP_FSYNC] = "FSYNC"; /* 15 */ gf_fop_list[GF_FOP_SETXATTR] = "SETXATTR"; - gf_fop_list[GF_FOP_GETXATTR] = "GETXATTR"; /* 20 */ + gf_fop_list[GF_FOP_GETXATTR] = "GETXATTR"; gf_fop_list[GF_FOP_REMOVEXATTR] = "REMOVEXATTR"; gf_fop_list[GF_FOP_OPENDIR] = "OPENDIR"; - gf_fop_list[GF_FOP_GETDENTS] = "GETDENTS"; - gf_fop_list[GF_FOP_FSYNCDIR] = "FSYNCDIR"; /* 25 */ + gf_fop_list[GF_FOP_GETDENTS] = "GETDENTS"; /* 20 */ + gf_fop_list[GF_FOP_FSYNCDIR] = "FSYNCDIR"; gf_fop_list[GF_FOP_ACCESS] = "ACCESS"; gf_fop_list[GF_FOP_CREATE] = "CREATE"; gf_fop_list[GF_FOP_FTRUNCATE] = "FTRUNCATE"; - gf_fop_list[GF_FOP_FSTAT] = "FSTAT"; - gf_fop_list[GF_FOP_LK] = "LK"; /* 30 */ - gf_fop_list[GF_FOP_UTIMENS] = "UTIMENS"; - gf_fop_list[GF_FOP_FCHMOD] = "FCHMOD"; - gf_fop_list[GF_FOP_FCHOWN] = "FCHOWN"; + gf_fop_list[GF_FOP_FSTAT] = "FSTAT"; /* 25 */ + gf_fop_list[GF_FOP_LK] = "LK"; gf_fop_list[GF_FOP_LOOKUP] = "LOOKUP"; - gf_fop_list[GF_FOP_SETDENTS] = "SETDENTS"; /* 35 */ + gf_fop_list[GF_FOP_SETDENTS] = "SETDENTS"; gf_fop_list[GF_FOP_READDIR] = "READDIR"; - gf_fop_list[GF_FOP_INODELK] = "INODELK"; + gf_fop_list[GF_FOP_INODELK] = "INODELK"; /* 30 */ gf_fop_list[GF_FOP_FINODELK] = "FINODELK"; gf_fop_list[GF_FOP_ENTRYLK] = "ENTRYLK"; - gf_fop_list[GF_FOP_FENTRYLK] = "FENTRYLK"; /* 40 */ - gf_fop_list[GF_FOP_CHECKSUM] = "CHECKSUM"; /* 41 */ + gf_fop_list[GF_FOP_FENTRYLK] = "FENTRYLK"; /* 35 */ + gf_fop_list[GF_FOP_CHECKSUM] = "CHECKSUM"; /* 36 */ gf_fop_list[GF_FOP_XATTROP] = "XATTROP"; gf_fop_list[GF_FOP_FXATTROP] = "FXATTROP"; gf_fop_list[GF_FOP_LOCK_NOTIFY] = "LOCK_NOTIFY"; diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index 89c010cd39e..053b8fb388a 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -106,131 +106,6 @@ default_stat (call_frame_t *frame, } static int32_t -default_chmod_cbk (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - STACK_UNWIND (frame, - op_ret, - op_errno, - buf); - return 0; -} - -int32_t -default_chmod (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - mode_t mode) -{ - STACK_WIND (frame, - default_chmod_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->chmod, - loc, - mode); - return 0; -} - - -static int32_t -default_fchmod_cbk (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - STACK_UNWIND (frame, - op_ret, - op_errno, - buf); - return 0; -} - -int32_t -default_fchmod (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - mode_t mode) -{ - STACK_WIND (frame, - default_fchmod_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->fchmod, - fd, - mode); - return 0; -} - -static int32_t -default_chown_cbk (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - STACK_UNWIND (frame, - op_ret, - op_errno, - buf); - return 0; -} - -int32_t -default_chown (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - uid_t uid, - gid_t gid) -{ - STACK_WIND (frame, - default_chown_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->chown, - loc, - uid, - gid); - return 0; -} - -static int32_t -default_fchown_cbk (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - STACK_UNWIND (frame, - op_ret, - op_errno, - buf); - return 0; -} - -int32_t -default_fchown (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - uid_t uid, - gid_t gid) -{ - STACK_WIND (frame, - default_fchown_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->fchown, - fd, - uid, - gid); - return 0; -} - -static int32_t default_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -294,37 +169,6 @@ default_ftruncate (call_frame_t *frame, return 0; } -int32_t -default_utimens_cbk (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf) -{ - STACK_UNWIND (frame, - op_ret, - op_errno, - buf); - return 0; -} - - -int32_t -default_utimens (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - struct timespec tv[2]) -{ - STACK_WIND (frame, - default_utimens_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->utimens, - loc, - tv); - return 0; -} - static int32_t default_access_cbk (call_frame_t *frame, void *cookie, diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index 6ef9cf571dd..7e9dee17c8b 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -71,28 +71,6 @@ int32_t default_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd); -int32_t default_chmod (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - mode_t mode); - -int32_t default_fchmod (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - mode_t mode); - -int32_t default_chown (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - uid_t uid, - gid_t gid); - -int32_t default_fchown (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - uid_t uid, - gid_t gid); - int32_t default_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, @@ -103,11 +81,6 @@ int32_t default_ftruncate (call_frame_t *frame, fd_t *fd, off_t offset); -int32_t default_utimens (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - struct timespec tv[2]); - int32_t default_access (call_frame_t *frame, xlator_t *this, loc_t *loc, diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index bea33f81ac7..2bc21b0f56f 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -86,10 +86,8 @@ typedef enum { GF_FOP_SYMLINK, GF_FOP_RENAME, GF_FOP_LINK, - GF_FOP_CHMOD, - GF_FOP_CHOWN, /* 10 */ GF_FOP_TRUNCATE, - GF_FOP_OPEN, + GF_FOP_OPEN, /* 10 */ GF_FOP_READ, GF_FOP_WRITE, GF_FOP_STATFS, /* 15 */ @@ -106,9 +104,6 @@ typedef enum { GF_FOP_FTRUNCATE, GF_FOP_FSTAT, GF_FOP_LK, - GF_FOP_UTIMENS, - GF_FOP_FCHMOD, /* 30 */ - GF_FOP_FCHOWN, GF_FOP_LOOKUP, GF_FOP_SETDENTS, GF_FOP_READDIR, diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h index f163d0ed4de..38eaadc62b6 100644 --- a/libglusterfs/src/protocol.h +++ b/libglusterfs/src/protocol.h @@ -54,7 +54,7 @@ struct gf_stat { uint32_t blksize; uint32_t atime; uint32_t atime_nsec; - uint32_t mtime; + uint32_t mtime ; uint32_t mtime_nsec; uint32_t ctime; uint32_t ctime_nsec; @@ -434,28 +434,6 @@ typedef struct { struct gf_stat postparent; } __attribute__((packed)) gf_fop_link_rsp_t; - -typedef struct { - uint64_t ino; - uint32_t mode; - char path[0]; -} __attribute__((packed)) gf_fop_chmod_req_t; -typedef struct { - struct gf_stat stat; -} __attribute__((packed)) gf_fop_chmod_rsp_t; - - -typedef struct { - uint64_t ino; - uint32_t uid; - uint32_t gid; - char path[0]; -} __attribute__((packed)) gf_fop_chown_req_t; -typedef struct { - struct gf_stat stat; -} __attribute__((packed)) gf_fop_chown_rsp_t; - - typedef struct { uint64_t ino; uint64_t offset; @@ -754,36 +732,6 @@ typedef struct { } __attribute__((packed)) gf_fop_fentrylk_rsp_t; typedef struct { - uint64_t ino; - struct gf_timespec tv[2]; - char path[0]; -} __attribute__((packed)) gf_fop_utimens_req_t; -typedef struct { - struct gf_stat stat; -} __attribute__((packed)) gf_fop_utimens_rsp_t; - -typedef struct { - uint64_t ino; - uint64_t fd; - uint32_t mode; -} __attribute__((packed)) gf_fop_fchmod_req_t; -typedef struct { - struct gf_stat stat; -} __attribute__((packed)) gf_fop_fchmod_rsp_t; - - -typedef struct { - uint64_t ino; - int64_t fd; - uint32_t uid; - uint32_t gid; -} __attribute__((packed)) gf_fop_fchown_req_t; -typedef struct { - struct gf_stat stat; -} __attribute__((packed)) gf_fop_fchown_rsp_t; - - -typedef struct { uint64_t ino; /* NOTE: used only in case of 'root' lookup */ uint64_t par; uint32_t flags; diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 879ddd76d70..20ee3da4ab6 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -66,10 +66,7 @@ fill_defaults (xlator_t *xl) SET_DEFAULT_FOP (symlink); SET_DEFAULT_FOP (rename); SET_DEFAULT_FOP (link); - SET_DEFAULT_FOP (chmod); - SET_DEFAULT_FOP (chown); SET_DEFAULT_FOP (truncate); - SET_DEFAULT_FOP (utimens); SET_DEFAULT_FOP (readv); SET_DEFAULT_FOP (writev); SET_DEFAULT_FOP (statfs); @@ -93,8 +90,6 @@ fill_defaults (xlator_t *xl) SET_DEFAULT_FOP (entrylk); SET_DEFAULT_FOP (fentrylk); SET_DEFAULT_FOP (lookup); - SET_DEFAULT_FOP (fchown); - SET_DEFAULT_FOP (fchmod); SET_DEFAULT_FOP (setdents); SET_DEFAULT_FOP (getdents); SET_DEFAULT_FOP (checksum); diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index f71d5dea9bd..3bacf3c72e6 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -189,34 +189,6 @@ typedef int32_t (*fop_fstat_cbk_t) (call_frame_t *frame, int32_t op_errno, struct stat *buf); -typedef int32_t (*fop_chmod_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); - -typedef int32_t (*fop_fchmod_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); - -typedef int32_t (*fop_chown_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); - -typedef int32_t (*fop_fchown_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); - typedef int32_t (*fop_truncate_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, @@ -233,13 +205,6 @@ typedef int32_t (*fop_ftruncate_cbk_t) (call_frame_t *frame, struct stat *prebuf, struct stat *postbuf); -typedef int32_t (*fop_utimens_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct stat *buf); - typedef int32_t (*fop_access_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, @@ -537,28 +502,6 @@ typedef int32_t (*fop_fstat_t) (call_frame_t *frame, xlator_t *this, fd_t *fd); -typedef int32_t (*fop_chmod_t) (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - mode_t mode); - -typedef int32_t (*fop_fchmod_t) (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - mode_t mode); - -typedef int32_t (*fop_chown_t) (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - uid_t uid, - gid_t gid); - -typedef int32_t (*fop_fchown_t) (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - uid_t uid, - gid_t gid); - typedef int32_t (*fop_truncate_t) (call_frame_t *frame, xlator_t *this, loc_t *loc, @@ -569,11 +512,6 @@ typedef int32_t (*fop_ftruncate_t) (call_frame_t *frame, fd_t *fd, off_t offset); -typedef int32_t (*fop_utimens_t) (call_frame_t *frame, - xlator_t *this, - loc_t *loc, - struct timespec tv[2]); - typedef int32_t (*fop_access_t) (call_frame_t *frame, xlator_t *this, loc_t *loc, @@ -800,13 +738,8 @@ struct xlator_fops { fop_lookup_t lookup; fop_stat_t stat; fop_fstat_t fstat; - fop_chmod_t chmod; - fop_fchmod_t fchmod; - fop_chown_t chown; - fop_fchown_t fchown; fop_truncate_t truncate; fop_ftruncate_t ftruncate; - fop_utimens_t utimens; fop_access_t access; fop_readlink_t readlink; fop_mknod_t mknod; @@ -852,13 +785,8 @@ struct xlator_fops { fop_lookup_cbk_t lookup_cbk; fop_stat_cbk_t stat_cbk; fop_fstat_cbk_t fstat_cbk; - fop_chmod_cbk_t chmod_cbk; - fop_fchmod_cbk_t fchmod_cbk; - fop_chown_cbk_t chown_cbk; - fop_fchown_cbk_t fchown_cbk; fop_truncate_cbk_t truncate_cbk; fop_ftruncate_cbk_t ftruncate_cbk; - fop_utimens_cbk_t utimens_cbk; fop_access_cbk_t access_cbk; fop_readlink_cbk_t readlink_cbk; fop_mknod_cbk_t mknod_cbk; diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 5300f0a7528..66aa01dc271 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -106,8 +106,8 @@ afr_sh_data_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int -afr_sh_data_utimes_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) +afr_sh_data_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *statpre, struct stat *statpost) { afr_sh_data_flush_cbk (frame, cookie, this, op_ret, op_errno); @@ -126,8 +126,9 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this) int call_count = 0; int source = 0; int active_sinks = 0; + int32_t valid = 0; - struct timespec ts[2]; + struct stat stbuf = {0,}; local = frame->local; sh = &local->self_heal; @@ -136,16 +137,18 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this) source = sh->source; active_sinks = sh->active_sinks; + valid |= (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME); + #ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC - ts[0] = sh->buf[source].st_atim; - ts[1] = sh->buf[source].st_mtim; + stbuf.st_atim = sh->buf[source].st_atim; + stbuf.st_mtim = sh->buf[source].st_mtim; #elif HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC - ts[0] = sh->buf[source].st_atimespec; - ts[1] = sh->buf[source].st_mtimespec; + stbuf.st_atimespec = sh->buf[source].st_atimespec; + stbuf.st_mtimespec = sh->buf[source].st_mtimespec; #else - ts[0].tv_sec = sh->buf[source].st_atime; - ts[1].tv_sec = sh->buf[source].st_mtime; + stbuf.st_atime = sh->buf[source].st_atime; + stbuf.st_mtime = sh->buf[source].st_mtime; #endif if (!sh->healing_fd) { @@ -168,11 +171,11 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this) sh->healing_fd); call_count--; - STACK_WIND_COOKIE (frame, afr_sh_data_utimes_cbk, + STACK_WIND_COOKIE (frame, afr_sh_data_setattr_cbk, (void *) (long) sh->source, priv->children[sh->source], - priv->children[sh->source]->fops->utimens, - &local->loc, ts); + priv->children[sh->source]->fops->setattr, + &local->loc, &stbuf, valid); call_count--; @@ -192,11 +195,11 @@ afr_sh_data_close (call_frame_t *frame, xlator_t *this) call_count--; - STACK_WIND_COOKIE (frame, afr_sh_data_utimes_cbk, + STACK_WIND_COOKIE (frame, afr_sh_data_setattr_cbk, (void *) (long) i, priv->children[i], - priv->children[i]->fops->utimens, - &local->loc, ts); + priv->children[i]->fops->setattr, + &local->loc, &stbuf, valid); if (!--call_count) break; diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index babcbae8c26..6e69e53d776 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -2596,14 +2596,9 @@ struct xlator_fops fops = { .readv = afr_readv, /* inode write */ - .chmod = afr_chmod, - .chown = afr_chown, - .fchmod = afr_fchmod, - .fchown = afr_fchown, .writev = afr_writev, .truncate = afr_truncate, .ftruncate = afr_ftruncate, - .utimens = afr_utimens, .setxattr = afr_setxattr, .setattr = afr_setattr, .fsetattr = afr_fsetattr, diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 29ae081c351..478202638e6 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -1040,8 +1040,8 @@ unwind: int32_t -wb_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct stat *buf) +wb_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct stat *statpre, struct stat *statpost) { wb_local_t *local = NULL; wb_request_t *request = NULL; @@ -1062,7 +1062,7 @@ wb_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } - STACK_UNWIND (frame, op_ret, op_errno, buf); + STACK_UNWIND (frame, op_ret, op_errno, statpre, statpost); if (request) { wb_request_unref (request); @@ -1097,23 +1097,24 @@ wb_utimens_cbk (call_frame_t *frame, void *cookie, xlator_t *this, static int32_t -wb_utimens_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct timespec tv[2]) +wb_setattr_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, + struct stat *stbuf, int32_t valid) { STACK_WIND (frame, - wb_utimens_cbk, + wb_setattr_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->utimens, + FIRST_CHILD(this)->fops->setattr, loc, - tv); + stbuf, + valid); return 0; } int32_t -wb_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct timespec tv[2]) +wb_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, + struct stat *stbuf, int32_t valid) { wb_file_t *file = NULL; fd_t *iter_fd = NULL; @@ -1123,6 +1124,15 @@ wb_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc, wb_request_t *request = NULL; int32_t ret = -1, op_errno = EINVAL; + if (!(valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME))) { + STACK_WIND (frame, + wb_setattr_cbk, + FIRST_CHILD (this), + FIRST_CHILD (this)->fops->setattr, + loc, stbuf, valid); + goto out; + } + if (loc->inode) { /* FIXME: fd_lookup extends life of fd till the execution @@ -1150,7 +1160,7 @@ wb_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc, frame->local = local; if (file) { - stub = fop_utimens_stub (frame, wb_utimens_helper, loc, tv); + stub = fop_setattr_stub (frame, wb_setattr_helper, loc, stbuf, valid); if (stub == NULL) { op_errno = ENOMEM; goto unwind; @@ -1169,11 +1179,11 @@ wb_utimens (call_frame_t *frame, xlator_t *this, loc_t *loc, } } else { STACK_WIND (frame, - wb_utimens_cbk, + wb_setattr_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->utimens, + FIRST_CHILD(this)->fops->setattr, loc, - tv); + stbuf, valid); } return 0; @@ -1183,7 +1193,7 @@ unwind: if (stub) { call_stub_destroy (stub); } - +out: return 0; } @@ -2482,7 +2492,7 @@ struct xlator_fops fops = { .fstat = wb_fstat, .truncate = wb_truncate, .ftruncate = wb_ftruncate, - .utimens = wb_utimens, + .setattr = wb_setattr, }; struct xlator_mops mops = { |