diff options
23 files changed, 9 insertions, 2644 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 17d8c810603..ae67f59dc58 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -1139,65 +1139,6 @@ out: call_stub_t * -fop_getdents_stub (call_frame_t *frame, - fop_getdents_t fn, - fd_t *fd, - size_t size, - off_t off, - int32_t flag) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 1, GF_FOP_GETDENTS); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.getdents.fn = fn; - stub->args.getdents.size = size; - stub->args.getdents.off = off; - if (fd) - stub->args.getdents.fd = fd_ref (fd); - stub->args.getdents.flag = flag; -out: - return stub; -} - - -call_stub_t * -fop_getdents_cbk_stub (call_frame_t *frame, - fop_getdents_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - dir_entry_t *entries, - int32_t count) - -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 0, GF_FOP_GETDENTS); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.getdents_cbk.fn = fn; - stub->args.getdents_cbk.op_ret = op_ret; - stub->args.getdents_cbk.op_errno = op_errno; - if (op_ret >= 0) { - stub->args.getdents_cbk.entries.next = entries->next; - /* FIXME: are entries not needed in the caller after - * creating stub? */ - entries->next = NULL; - } - - stub->args.getdents_cbk.count = count; -out: - return stub; -} - - - -call_stub_t * fop_fsyncdir_stub (call_frame_t *frame, fop_fsyncdir_t fn, fd_t *fd, @@ -1768,55 +1709,6 @@ fop_fentrylk_cbk_stub (call_frame_t *frame, fop_fentrylk_cbk_t fn, call_stub_t * -fop_setdents_stub (call_frame_t *frame, - fop_setdents_t fn, - fd_t *fd, - int32_t flags, - dir_entry_t *entries, - int32_t count) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 1, GF_FOP_SETDENTS); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - if (fd) - stub->args.setdents.fd = fd_ref (fd); - stub->args.setdents.fn = fn; - stub->args.setdents.flags = flags; - stub->args.setdents.count = count; - if (entries) { - stub->args.setdents.entries.next = entries->next; - entries->next = NULL; - } -out: - return stub; -} - -call_stub_t * -fop_setdents_cbk_stub (call_frame_t *frame, - fop_setdents_cbk_t fn, - int32_t op_ret, - int32_t op_errno) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 0, GF_FOP_SETDENTS); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.setdents_cbk.fn = fn; - stub->args.setdents_cbk.op_ret = op_ret; - stub->args.setdents_cbk.op_errno = op_errno; -out: - return stub; - -} - -call_stub_t * fop_readdirp_cbk_stub (call_frame_t *frame, fop_readdirp_cbk_t fn, int32_t op_ret, @@ -2141,90 +2033,6 @@ fop_fxattrop_stub (call_frame_t *frame, call_stub_t * -fop_lock_notify_cbk_stub (call_frame_t *frame, fop_lock_notify_cbk_t fn, - int32_t op_ret, int32_t op_errno) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 0, GF_FOP_LOCK_NOTIFY); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.lock_notify_cbk.fn = fn; - stub->args.lock_notify_cbk.op_ret = op_ret; - stub->args.lock_notify_cbk.op_errno = op_errno; - -out: - return stub; -} - - -call_stub_t * -fop_lock_notify_stub (call_frame_t *frame, fop_lock_notify_t fn, - loc_t *loc, int32_t timeout) -{ - call_stub_t *stub = NULL; - - if (!frame) - return NULL; - - stub = stub_new (frame, 1, GF_FOP_LOCK_NOTIFY); - if (!stub) - return NULL; - - stub->args.lock_notify.fn = fn; - - loc_copy (&stub->args.lock_notify.loc, loc); - - stub->args.lock_notify.timeout = timeout; - - return stub; -} - - -call_stub_t * -fop_lock_fnotify_cbk_stub (call_frame_t *frame, fop_lock_fnotify_cbk_t fn, - int32_t op_ret, int32_t op_errno) -{ - call_stub_t *stub = NULL; - - GF_VALIDATE_OR_GOTO ("call-stub", frame, out); - - stub = stub_new (frame, 0, GF_FOP_LOCK_FNOTIFY); - GF_VALIDATE_OR_GOTO ("call-stub", stub, out); - - stub->args.lock_fnotify_cbk.fn = fn; - stub->args.lock_fnotify_cbk.op_ret = op_ret; - stub->args.lock_fnotify_cbk.op_errno = op_errno; - -out: - return stub; -} - - -call_stub_t * -fop_lock_fnotify_stub (call_frame_t *frame, fop_lock_fnotify_t fn, - fd_t *fd, int32_t timeout) -{ - call_stub_t *stub = NULL; - - if (!frame) - return NULL; - - stub = stub_new (frame, 1, GF_FOP_LOCK_FNOTIFY); - if (!stub) - return NULL; - - stub->args.lock_fnotify.fn = fn; - - stub->args.lock_fnotify.fd = fd_ref (fd); - stub->args.lock_fnotify.timeout = timeout; - - return stub; -} - -call_stub_t * fop_setattr_cbk_stub (call_frame_t *frame, fop_setattr_cbk_t fn, int32_t op_ret, @@ -2564,17 +2372,6 @@ call_resume_wind (call_stub_t *stub) break; } - case GF_FOP_GETDENTS: - { - stub->args.getdents.fn (stub->frame, - stub->frame->this, - stub->args.getdents.fd, - stub->args.getdents.size, - stub->args.getdents.off, - stub->args.getdents.flag); - break; - } - case GF_FOP_FSYNCDIR: { stub->args.fsyncdir.fn (stub->frame, @@ -2677,17 +2474,6 @@ call_resume_wind (call_stub_t *stub) break; } - case GF_FOP_SETDENTS: - { - stub->args.setdents.fn (stub->frame, - stub->frame->this, - stub->args.setdents.fd, - stub->args.setdents.flags, - &stub->args.setdents.entries, - stub->args.setdents.count); - break; - } - case GF_FOP_CHECKSUM: { stub->args.checksum.fn (stub->frame, @@ -2747,22 +2533,6 @@ call_resume_wind (call_stub_t *stub) break; } - case GF_FOP_LOCK_NOTIFY: - { - stub->args.lock_notify.fn (stub->frame, - stub->frame->this, - &stub->args.lock_notify.loc, - stub->args.lock_notify.timeout); - break; - } - case GF_FOP_LOCK_FNOTIFY: - { - stub->args.lock_fnotify.fn (stub->frame, - stub->frame->this, - stub->args.lock_fnotify.fd, - stub->args.lock_fnotify.timeout); - break; - } case GF_FOP_SETATTR: { stub->args.setattr.fn (stub->frame, @@ -3255,25 +3025,6 @@ call_resume_unwind (call_stub_t *stub) break; } - case GF_FOP_GETDENTS: - { - if (!stub->args.getdents_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.getdents_cbk.op_ret, - stub->args.getdents_cbk.op_errno, - &stub->args.getdents_cbk.entries, - stub->args.getdents_cbk.count); - else - stub->args.getdents_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.getdents_cbk.op_ret, - stub->args.getdents_cbk.op_errno, - &stub->args.getdents_cbk.entries, - stub->args.getdents_cbk.count); - break; - } - case GF_FOP_FSYNCDIR: { if (!stub->args.fsyncdir_cbk.fn) @@ -3452,20 +3203,6 @@ call_resume_unwind (call_stub_t *stub) break; } - case GF_FOP_SETDENTS: - { - if (!stub->args.setdents_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.setdents_cbk.op_ret, - stub->args.setdents_cbk.op_errno); - else - stub->args.setdents_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.setdents_cbk.op_ret, - stub->args.setdents_cbk.op_errno); - break; - } case GF_FOP_CHECKSUM: { @@ -3596,34 +3333,6 @@ call_resume_unwind (call_stub_t *stub) break; } - case GF_FOP_LOCK_NOTIFY: - { - if (!stub->args.lock_notify_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.lock_notify_cbk.op_ret, - stub->args.lock_notify_cbk.op_errno); - else - stub->args.lock_notify_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.lock_notify_cbk.op_ret, - stub->args.lock_notify_cbk.op_errno); - break; - } - case GF_FOP_LOCK_FNOTIFY: - { - if (!stub->args.lock_fnotify_cbk.fn) - STACK_UNWIND (stub->frame, - stub->args.lock_fnotify_cbk.op_ret, - stub->args.lock_fnotify_cbk.op_errno); - else - stub->args.lock_fnotify_cbk.fn (stub->frame, - stub->frame->cookie, - stub->frame->this, - stub->args.lock_fnotify_cbk.op_ret, - stub->args.lock_fnotify_cbk.op_errno); - break; - } case GF_FOP_SETATTR: { if (!stub->args.setattr_cbk.fn) @@ -3839,13 +3548,6 @@ call_stub_destroy_wind (call_stub_t *stub) break; } - case GF_FOP_GETDENTS: - { - if (stub->args.getdents.fd) - fd_unref (stub->args.getdents.fd); - break; - } - case GF_FOP_FSYNCDIR: { if (stub->args.fsyncdir.fd) @@ -3928,21 +3630,6 @@ call_stub_destroy_wind (call_stub_t *stub) break; } - case GF_FOP_SETDENTS: - { - dir_entry_t *entry, *next; - if (stub->args.setdents.fd) - fd_unref (stub->args.setdents.fd); - entry = stub->args.setdents.entries.next; - while (entry) { - next = entry->next; - FREE (entry->name); - FREE (entry); - entry = next; - } - break; - } - case GF_FOP_CHECKSUM: { loc_wipe (&stub->args.checksum.loc); @@ -3983,17 +3670,6 @@ call_stub_destroy_wind (call_stub_t *stub) dict_unref (stub->args.fxattrop.xattr); break; } - case GF_FOP_LOCK_NOTIFY: - { - loc_wipe (&stub->args.lock_notify.loc); - break; - } - case GF_FOP_LOCK_FNOTIFY: - { - if (stub->args.lock_fnotify.fd) - fd_unref (stub->args.lock_fnotify.fd); - break; - } case GF_FOP_SETATTR: { loc_wipe (&stub->args.setattr.loc); @@ -4144,22 +3820,6 @@ call_stub_destroy_unwind (call_stub_t *stub) } break; - case GF_FOP_GETDENTS: - { - dir_entry_t *tmp = NULL, *entries = NULL; - - entries = &stub->args.getdents_cbk.entries; - if (stub->args.getdents_cbk.op_ret >= 0) { - while (entries->next) { - tmp = entries->next; - entries->next = entries->next->next; - FREE (tmp->name); - FREE (tmp); - } - } - } - break; - case GF_FOP_FSYNCDIR: break; @@ -4197,9 +3857,6 @@ call_stub_destroy_unwind (call_stub_t *stub) } break; - case GF_FOP_SETDENTS: - break; - case GF_FOP_CHECKSUM: { if (stub->args.checksum_cbk.op_ret >= 0) { diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 3160e9dd066..afc5b13e9a2 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -324,35 +324,6 @@ typedef struct { fd_t *fd; } opendir_cbk; - /* getdents */ - struct { - fop_getdents_t fn; - fd_t *fd; - size_t size; - off_t off; - int32_t flag; - } getdents; - struct { - fop_getdents_cbk_t fn; - int32_t op_ret; - int32_t op_errno; - dir_entry_t entries; - int32_t count; - } getdents_cbk; - - /* setdents */ - struct { - fop_setdents_t fn; - fd_t *fd; - int32_t flags; - dir_entry_t entries; - int32_t count; - } setdents; - struct { - fop_setdents_cbk_t fn; - int32_t op_ret; - int32_t op_errno; - } setdents_cbk; /* fsyncdir */ struct { @@ -587,28 +558,6 @@ typedef struct { dict_t *xattr; } fxattrop_cbk; - struct { - fop_lock_notify_t fn; - loc_t loc; - int32_t timeout; - } lock_notify; - struct { - fop_lock_notify_cbk_t fn; - int32_t op_ret; - int32_t op_errno; - } lock_notify_cbk; - - struct { - fop_lock_fnotify_t fn; - fd_t *fd; - int32_t timeout; - } lock_fnotify; - struct { - fop_lock_fnotify_cbk_t fn; - int32_t op_ret; - int32_t op_errno; - } lock_fnotify_cbk; - /* setattr */ struct { fop_setattr_t fn; @@ -945,36 +894,6 @@ fop_opendir_cbk_stub (call_frame_t *frame, fd_t *fd); call_stub_t * -fop_getdents_stub (call_frame_t *frame, - fop_getdents_t fn, - fd_t *fd, - size_t size, - off_t off, - int32_t flag); - -call_stub_t * -fop_getdents_cbk_stub (call_frame_t *frame, - fop_getdents_cbk_t fn, - int32_t op_ret, - int32_t op_errno, - dir_entry_t *entries, - int32_t count); - -call_stub_t * -fop_setdents_stub (call_frame_t *frame, - fop_setdents_t fn, - fd_t *fd, - int32_t flags, - dir_entry_t *entries, - int32_t count); - -call_stub_t * -fop_setdents_cbk_stub (call_frame_t *frame, - fop_setdents_cbk_t fn, - int32_t op_ret, - int32_t op_errno); - -call_stub_t * fop_fsyncdir_stub (call_frame_t *frame, fop_fsyncdir_t fn, fd_t *fd, @@ -1194,30 +1113,6 @@ fop_fxattrop_stub_cbk_stub (call_frame_t *frame, int32_t op_errno); call_stub_t * -fop_lock_notify_stub_cbk_stub (call_frame_t *frame, - fop_lock_notify_cbk_t fn, - int32_t op_ret, - int32_t op_errno); - -call_stub_t * -fop_lock_notify_stub (call_frame_t *frame, - fop_lock_notify_t fn, - loc_t *loc, - int32_t timeout); - -call_stub_t * -fop_lock_fnotify_stub_cbk_stub (call_frame_t *frame, - fop_lock_fnotify_cbk_t fn, - int32_t op_ret, - int32_t op_errno); - -call_stub_t * -fop_lock_fnotify_stub (call_frame_t *frame, - fop_lock_fnotify_t fn, - fd_t *fd, - int32_t timeout); - -call_stub_t * fop_setattr_stub (call_frame_t *frame, fop_setattr_t fn, loc_t *loc, diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 31727adf813..984ad0794a3 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -205,7 +205,6 @@ gf_global_variable_init() 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"; /* 20 */ gf_fop_list[GF_FOP_FSYNCDIR] = "FSYNCDIR"; gf_fop_list[GF_FOP_ACCESS] = "ACCESS"; gf_fop_list[GF_FOP_CREATE] = "CREATE"; @@ -213,7 +212,6 @@ gf_global_variable_init() 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"; gf_fop_list[GF_FOP_READDIR] = "READDIR"; gf_fop_list[GF_FOP_INODELK] = "INODELK"; /* 30 */ gf_fop_list[GF_FOP_FINODELK] = "FINODELK"; @@ -222,8 +220,6 @@ gf_global_variable_init() 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"; - gf_fop_list[GF_FOP_LOCK_FNOTIFY]= "LOCK_FNOTIFY"; gf_fop_list[GF_FOP_FSETXATTR] = "FSETXATTR"; gf_fop_list[GF_FOP_FGETXATTR] = "FGETXATTR"; gf_fop_list[GF_FOP_RCHECKSUM] = "RCHECKSUM"; @@ -233,7 +229,6 @@ gf_global_variable_init() gf_mop_list[GF_MOP_SETVOLUME] = "SETVOLUME"; /* 0 */ gf_mop_list[GF_MOP_GETVOLUME] = "GETVOLUME"; /* 1 */ - gf_mop_list[GF_MOP_STATS] = "STATS"; gf_mop_list[GF_MOP_SETSPEC] = "SETSPEC"; gf_mop_list[GF_MOP_GETSPEC] = "GETSPEC"; gf_mop_list[GF_MOP_LOG] = "LOG"; diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index ab88e024c3a..a007beb4559 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -706,77 +706,6 @@ default_opendir (call_frame_t *frame, return 0; } - -static int32_t -default_getdents_cbk (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - dir_entry_t *entries, - int32_t count) -{ - STACK_UNWIND (frame, - op_ret, - op_errno, - entries, - count); - return 0; -} - -int32_t -default_getdents (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - size_t size, - off_t offset, - int32_t flag) -{ - STACK_WIND (frame, - default_getdents_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->getdents, - fd, - size, - offset, - flag); - return 0; -} - - -static int32_t -default_setdents_cbk (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno) -{ - STACK_UNWIND (frame, - op_ret, - op_errno); - return 0; -} - -int32_t -default_setdents (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - int32_t flags, - dir_entry_t *entries, - int32_t count) -{ - STACK_WIND (frame, - default_setdents_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->setdents, - fd, - flags, - entries, - count); - return 0; -} - - static int32_t default_fsyncdir_cbk (call_frame_t *frame, void *cookie, @@ -1171,35 +1100,6 @@ default_fentrylk (call_frame_t *frame, xlator_t *this, /* Management operations */ static int32_t -default_stats_cbk (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct xlator_stats *stats) -{ - STACK_UNWIND (frame, - op_ret, - op_errno, - stats); - return 0; -} - - -int32_t -default_stats (call_frame_t *frame, - xlator_t *this, - int32_t flags) -{ - STACK_WIND (frame, - default_stats_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->mops->stats, - flags); - return 0; -} - -static int32_t default_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -1379,49 +1279,6 @@ default_readdirp (call_frame_t *frame, return 0; } -int32_t -default_lock_notify_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - STACK_UNWIND (frame, op_ret, op_errno); - return 0; -} - - -int32_t -default_lock_fnotify_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - STACK_UNWIND (frame, op_ret, op_errno); - return 0; -} - - -int32_t -default_lock_notify (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t timeout) -{ - STACK_WIND (frame, - default_lock_notify_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->lock_notify, - loc, timeout); - return 0; -} - - -int32_t -default_lock_fnotify (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t timeout) -{ - STACK_WIND (frame, - default_lock_notify_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->lock_fnotify, - fd, timeout); - return 0; -} - /* notify */ int diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index daab88919a1..d98fa02cf51 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -33,10 +33,6 @@ /* Management Operations */ -int32_t default_stats (call_frame_t *frame, - xlator_t *this, - int32_t flags); - int32_t default_getspec (call_frame_t *frame, xlator_t *this, const char *key, @@ -164,13 +160,6 @@ int32_t default_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd); -int32_t default_getdents (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - size_t size, - off_t offset, - int32_t flag); - int32_t default_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, @@ -239,13 +228,6 @@ int32_t default_readdirp (call_frame_t *frame, fd_t *fd, size_t size, off_t off); -int32_t default_setdents (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - int32_t flags, - dir_entry_t *entries, - int32_t count); - int32_t default_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, @@ -258,15 +240,6 @@ int32_t default_fxattrop (call_frame_t *frame, gf_xattrop_flags_t flags, dict_t *dict); -int32_t -default_lock_notify (call_frame_t *frame, xlator_t *this, - loc_t *loc, int32_t timeout); - -int32_t -default_lock_fnotify (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t timeout); - - int32_t default_notify (xlator_t *this, int32_t event, void *data, diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 464c4302570..4abde409b92 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -100,7 +100,6 @@ typedef enum { GF_FOP_GETXATTR, GF_FOP_REMOVEXATTR,/* 20 */ GF_FOP_OPENDIR, - GF_FOP_GETDENTS, GF_FOP_FSYNCDIR, GF_FOP_ACCESS, GF_FOP_CREATE, /* 25 */ @@ -108,7 +107,6 @@ typedef enum { GF_FOP_FSTAT, GF_FOP_LK, GF_FOP_LOOKUP, - GF_FOP_SETDENTS, GF_FOP_READDIR, GF_FOP_INODELK, /* 35 */ GF_FOP_FINODELK, @@ -117,8 +115,6 @@ typedef enum { GF_FOP_CHECKSUM, GF_FOP_XATTROP, /* 40 */ GF_FOP_FXATTROP, - GF_FOP_LOCK_NOTIFY, - GF_FOP_LOCK_FNOTIFY, GF_FOP_FGETXATTR, GF_FOP_FSETXATTR, /* 45 */ GF_FOP_RCHECKSUM, @@ -132,7 +128,6 @@ typedef enum { typedef enum { GF_MOP_SETVOLUME, /* 0 */ GF_MOP_GETVOLUME, /* 1 */ - GF_MOP_STATS, GF_MOP_SETSPEC, GF_MOP_GETSPEC, GF_MOP_PING, /* 5 */ @@ -187,13 +182,6 @@ typedef enum { } entrylk_type; typedef enum { - GF_GET_ALL = 1, - GF_GET_DIR_ONLY, - GF_GET_SYMLINK_ONLY, - GF_GET_REGULAR_FILES_ONLY, -} glusterfs_getdents_flags_t; - -typedef enum { GF_XATTROP_ADD_ARRAY, } gf_xattrop_flags_t; diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h index 829d3fa83db..f8e03da2708 100644 --- a/libglusterfs/src/protocol.h +++ b/libglusterfs/src/protocol.h @@ -838,31 +838,6 @@ typedef struct { char dict[0]; } __attribute__((packed)) gf_fop_lookup_rsp_t; - -typedef struct { - uint64_t ino; - uint64_t gen; - int64_t fd; - uint32_t flags; - uint32_t count; - char buf[0]; -} __attribute__((packed)) gf_fop_setdents_req_t; -typedef struct { } __attribute__((packed)) gf_fop_setdents_rsp_t; - -typedef struct { - uint64_t ino; - uint64_t gen; - int64_t fd; - uint64_t offset; - uint32_t size; - uint32_t flags; -} __attribute__((packed)) gf_fop_getdents_req_t; -typedef struct { - uint32_t count; - char buf[0]; -} __attribute__((packed)) gf_fop_getdents_rsp_t; - - typedef struct { uint64_t ino; uint64_t gen; @@ -906,44 +881,6 @@ typedef struct { unsigned char strong_checksum[0]; } __attribute__((packed)) gf_fop_rchecksum_rsp_t; - -typedef struct { - uint64_t ino; - uint64_t gen; - int32_t timeout; -} __attribute__((packed)) gf_fop_lock_notify_req_t; -typedef struct { } __attribute__((packed)) gf_fop_lock_notify_rsp_t; - - -typedef struct { - int64_t fd; - int32_t timeout; -} __attribute__((packed)) gf_fop_lock_fnotify_req_t; -typedef struct { } __attribute__((packed)) gf_fop_lock_fnotify_rsp_t; - - -typedef struct { - char name[0]; -} __attribute__((packed)) gf_mop_lock_req_t; -typedef struct {} __attribute__((packed)) gf_mop_lock_rsp_t; - -typedef struct { - char name[0]; -} __attribute__((packed)) gf_mop_unlock_req_t; -typedef struct {} __attribute__((packed)) gf_mop_unlock_rsp_t; - -typedef struct { - char pattern[0]; -} __attribute__((packed)) gf_mop_listlocks_req_t; -typedef struct {} __attribute__((packed)) gf_mop_listlocks_rsp_t; - -typedef struct { - uint32_t flags; -} __attribute__((packed)) gf_mop_stats_req_t; -typedef struct { - char buf[0]; -} __attribute__((packed)) gf_mop_stats_rsp_t; - typedef struct { uint32_t flags; uint32_t keylen; diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index bc36173d142..ffa1d94e431 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -90,19 +90,14 @@ fill_defaults (xlator_t *xl) SET_DEFAULT_FOP (entrylk); SET_DEFAULT_FOP (fentrylk); SET_DEFAULT_FOP (lookup); - SET_DEFAULT_FOP (setdents); - SET_DEFAULT_FOP (getdents); SET_DEFAULT_FOP (checksum); SET_DEFAULT_FOP (rchecksum); SET_DEFAULT_FOP (xattrop); SET_DEFAULT_FOP (fxattrop); - SET_DEFAULT_FOP (lock_notify); - SET_DEFAULT_FOP (lock_fnotify); SET_DEFAULT_FOP (setattr); SET_DEFAULT_FOP (fsetattr); SET_DEFAULT_MOP (log); - SET_DEFAULT_MOP (stats); SET_DEFAULT_CBK (release); SET_DEFAULT_CBK (releasedir); diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index 4b9b3e9cebd..8cde2ed31c3 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -84,27 +84,6 @@ struct _loc { inode_t *parent; }; - -struct xlator_stats { - uint64_t nr_files; /* Number of files open via this xlator */ - uint64_t free_disk; /* Mega bytes */ - uint64_t total_disk_size; /* Mega Bytes */ - uint64_t disk_usage; /* Mega bytes */ - uint64_t disk_speed; /* MHz or Mbps */ - uint64_t nr_clients; /* Number of client nodes */ - uint64_t write_usage; - uint64_t read_usage; /* add more stats here */ -}; - - - -typedef int32_t (*mop_stats_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - struct xlator_stats *stats); - typedef int32_t (*mop_getspec_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, @@ -136,9 +115,6 @@ typedef int32_t (*mop_setvolume_t) (call_frame_t *frame, xlator_t *this, const char *volume); -typedef int32_t (*mop_stats_t) (call_frame_t *frame, - xlator_t *this, - int32_t flags); typedef int32_t (*mop_getspec_t) (call_frame_t *frame, xlator_t *this, @@ -160,12 +136,10 @@ typedef int32_t (*fop_rchecksum_t) (call_frame_t *frame, int32_t len); struct xlator_mops { - mop_stats_t stats; mop_getspec_t getspec; mop_log_t log; mop_log_cbk_t log_cbk; - mop_stats_cbk_t stats_cbk; mop_getspec_cbk_t getspec_cbk; }; @@ -348,14 +322,6 @@ typedef int32_t (*fop_opendir_cbk_t) (call_frame_t *frame, int32_t op_errno, fd_t *fd); -typedef int32_t (*fop_getdents_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno, - dir_entry_t *entries, - int32_t count); - typedef int32_t (*fop_fsyncdir_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, @@ -432,12 +398,6 @@ typedef int32_t (*fop_fentrylk_cbk_t) (call_frame_t *frame, int32_t op_ret, int32_t op_errno); -typedef int32_t (*fop_setdents_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno); - typedef int32_t (*fop_readdir_cbk_t) (call_frame_t *frame, void *cookie, xlator_t *this, @@ -466,17 +426,6 @@ typedef int32_t (*fop_fxattrop_cbk_t) (call_frame_t *frame, int32_t op_errno, dict_t *xattr); -typedef int32_t (*fop_lock_notify_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno); - -typedef int32_t (*fop_lock_fnotify_cbk_t) (call_frame_t *frame, - void *cookie, - xlator_t *this, - int32_t op_ret, - int32_t op_errno); typedef int32_t (*fop_setattr_cbk_t) (call_frame_t *frame, void *cookie, @@ -612,13 +561,6 @@ typedef int32_t (*fop_opendir_t) (call_frame_t *frame, loc_t *loc, fd_t *fd); -typedef int32_t (*fop_getdents_t) (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - size_t size, - off_t offset, - int32_t flag); - typedef int32_t (*fop_fsyncdir_t) (call_frame_t *frame, xlator_t *this, fd_t *fd, @@ -687,13 +629,6 @@ typedef int32_t (*fop_fentrylk_t) (call_frame_t *frame, const char *basename, entrylk_cmd cmd, entrylk_type type); -typedef int32_t (*fop_setdents_t) (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - int32_t flags, - dir_entry_t *entries, - int32_t count); - typedef int32_t (*fop_readdir_t) (call_frame_t *frame, xlator_t *this, fd_t *fd, @@ -718,14 +653,6 @@ typedef int32_t (*fop_fxattrop_t) (call_frame_t *frame, gf_xattrop_flags_t optype, dict_t *xattr); -typedef int32_t (*fop_lock_notify_t) (call_frame_t *frame, - xlator_t *this, loc_t *loc, - int32_t timeout); - -typedef int32_t (*fop_lock_fnotify_t) (call_frame_t *frame, - xlator_t *this, fd_t *fd, - int32_t timeout); - typedef int32_t (*fop_setattr_t) (call_frame_t *frame, xlator_t *this, loc_t *loc, @@ -775,14 +702,10 @@ struct xlator_fops { fop_finodelk_t finodelk; fop_entrylk_t entrylk; fop_fentrylk_t fentrylk; - fop_setdents_t setdents; - fop_getdents_t getdents; fop_checksum_t checksum; fop_rchecksum_t rchecksum; fop_xattrop_t xattrop; fop_fxattrop_t fxattrop; - fop_lock_notify_t lock_notify; - fop_lock_fnotify_t lock_fnotify; fop_setattr_t setattr; fop_fsetattr_t fsetattr; @@ -822,14 +745,10 @@ struct xlator_fops { fop_finodelk_cbk_t finodelk_cbk; fop_entrylk_cbk_t entrylk_cbk; fop_fentrylk_cbk_t fentrylk_cbk; - fop_setdents_cbk_t setdents_cbk; - fop_getdents_cbk_t getdents_cbk; fop_checksum_cbk_t checksum_cbk; fop_rchecksum_cbk_t rchecksum_cbk; fop_xattrop_cbk_t xattrop_cbk; fop_fxattrop_cbk_t fxattrop_cbk; - fop_lock_notify_cbk_t lock_notify_cbk; - fop_lock_fnotify_cbk_t lock_fnotify_cbk; fop_setattr_cbk_t setattr_cbk; fop_fsetattr_cbk_t fsetattr_cbk; }; diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c index 91b9850b39b..384e9c98d0c 100644 --- a/xlators/cluster/afr/src/afr-dir-read.c +++ b/xlators/cluster/afr/src/afr-dir-read.c @@ -719,50 +719,6 @@ afr_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, return 0; } -int32_t -afr_getdents_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, int32_t op_errno, - dir_entry_t *entry, int32_t count) -{ - afr_private_t * priv = NULL; - afr_local_t * local = NULL; - xlator_t ** children = NULL; - - int unwind = 1; - int last_tried = -1; - int this_try = -1; - - priv = this->private; - children = priv->children; - - local = frame->local; - - if (op_ret == -1) { - last_tried = local->cont.getdents.last_tried; - - if (all_tried (last_tried, priv->child_count)) { - goto out; - } - - this_try = ++local->cont.getdents.last_tried; - unwind = 0; - - STACK_WIND (frame, afr_getdents_cbk, - children[this_try], - children[this_try]->fops->getdents, - local->fd, local->cont.getdents.size, - local->cont.getdents.offset, local->cont.getdents.flag); - } - -out: - if (unwind) { - AFR_STACK_UNWIND (getdents, frame, op_ret, op_errno, - entry, count); - } - - return 0; -} - int32_t afr_releasedir (xlator_t *this, fd_t *fd) @@ -771,59 +727,3 @@ afr_releasedir (xlator_t *this, fd_t *fd) return 0; } - - -int32_t -afr_getdents (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t offset, int32_t flag) -{ - afr_private_t * priv = NULL; - xlator_t ** children = NULL; - int call_child = 0; - afr_local_t *local = NULL; - - int32_t op_ret = -1; - int32_t op_errno = 0; - - VALIDATE_OR_GOTO (frame, out); - VALIDATE_OR_GOTO (this, out); - VALIDATE_OR_GOTO (this->private, out); - - priv = this->private; - children = priv->children; - - ALLOC_OR_GOTO (local, afr_local_t, out); - - call_child = afr_first_up_child (priv); - if (call_child == -1) { - op_errno = ENOTCONN; - gf_log (this->name, GF_LOG_DEBUG, - "no child is up."); - goto out; - } - - local->cont.getdents.last_tried = call_child; - - local->fd = fd_ref (fd); - - local->cont.getdents.size = size; - local->cont.getdents.offset = offset; - local->cont.getdents.flag = flag; - - frame->local = local; - - STACK_WIND (frame, afr_getdents_cbk, - children[call_child], children[call_child]->fops->getdents, - fd, size, offset, flag); - - op_ret = 0; -out: - if (op_ret == -1) { - AFR_STACK_UNWIND (getdents, frame, op_ret, op_errno, - NULL, 0); - } - - return 0; -} - - diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 14d3e28c451..9d7e74e7871 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -2007,144 +2007,3 @@ out: /* }}} */ -/* {{{ setdents */ - -int32_t -afr_setdents_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - afr_local_t * local = NULL; - afr_private_t * priv = NULL; - - int call_count = -1; - int child_index = (long) cookie; - - local = frame->local; - priv = this->private; - - LOCK (&frame->lock); - { - if (afr_fop_failed (op_ret, op_errno)) - afr_transaction_fop_failed (frame, this, child_index); - - if ((op_ret != -1) && (local->success_count == 0)) { - local->op_ret = op_ret; - local->success_count++; - } - - local->op_errno = op_errno; - } - UNLOCK (&frame->lock); - - call_count = afr_frame_return (frame); - - if (call_count == 0) { - local->transaction.resume (frame, this); - } - - return 0; -} - - -int32_t -afr_setdents_wind (call_frame_t *frame, xlator_t *this) -{ - afr_local_t *local = NULL; - afr_private_t *priv = NULL; - - int call_count = -1; - int i = 0; - - local = frame->local; - priv = this->private; - - call_count = afr_up_children_count (priv->child_count, local->child_up); - - if (call_count == 0) { - local->transaction.resume (frame, this); - return 0; - } - - local->call_count = call_count; - - for (i = 0; i < priv->child_count; i++) { - if (local->child_up[i]) { - STACK_WIND_COOKIE (frame, afr_setdents_wind_cbk, - (void *) (long) i, - priv->children[i], - priv->children[i]->fops->setdents, - local->fd, local->cont.setdents.flags, - local->cont.setdents.entries, - local->cont.setdents.count); - - if (!--call_count) - break; - } - } - - return 0; -} - - -int32_t -afr_setdents_done (call_frame_t *frame, xlator_t *this) -{ - afr_local_t * local = frame->local; - - AFR_STACK_UNWIND (setdents, frame, local->op_ret, local->op_errno); - - return 0; -} - - -int32_t -afr_setdents (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t flags, dir_entry_t *entries, int32_t count) -{ - afr_private_t * priv = NULL; - afr_local_t * local = NULL; - - int ret = -1; - - int op_ret = -1; - int op_errno = 0; - - VALIDATE_OR_GOTO (frame, out); - VALIDATE_OR_GOTO (this, out); - VALIDATE_OR_GOTO (this->private, out); - - priv = this->private; - - ALLOC_OR_GOTO (local, afr_local_t, out); - - ret = AFR_LOCAL_INIT (local, priv); - if (ret < 0) { - op_errno = -ret; - goto out; - } - - frame->local = local; - - local->fd = fd_ref (fd); - - local->cont.setdents.flags = flags; - local->cont.setdents.entries = entries; - local->cont.setdents.count = count; - - local->transaction.fop = afr_setdents_wind; - local->transaction.done = afr_setdents_done; - - local->transaction.basename = NULL; - - afr_transaction (frame, this, AFR_ENTRY_TRANSACTION); - - op_ret = 0; -out: - if (op_ret == -1) { - AFR_STACK_UNWIND (setdents, frame, op_ret, op_errno); - } - - return 0; -} - -/* }}} */ diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index b7fbbd09c50..18cff07663c 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -3033,7 +3033,6 @@ struct xlator_fops fops = { .opendir = afr_opendir, .readdir = afr_readdir, .readdirp = afr_readdirp, - .getdents = afr_getdents, /* dir write */ .create = afr_create, @@ -3044,7 +3043,6 @@ struct xlator_fops fops = { .link = afr_link, .symlink = afr_symlink, .rename = afr_rename, - .setdents = afr_setdents, }; diff --git a/xlators/cluster/map/src/map.c b/xlators/cluster/map/src/map.c index 17de0c0954f..09d22b5d690 100644 --- a/xlators/cluster/map/src/map.c +++ b/xlators/cluster/map/src/map.c @@ -905,23 +905,6 @@ map_checksum_cbk (call_frame_t *frame, } -int32_t -map_lock_notify_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - STACK_UNWIND (frame, op_ret, op_errno); - return 0; -} - - -int32_t -map_lock_fnotify_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - STACK_UNWIND (frame, op_ret, op_errno); - return 0; -} - /* Fops starts here */ int32_t diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index a7fad23da81..eb5a154d5ee 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -2559,50 +2559,6 @@ stripe_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, } /** - * stripe_writedir - - */ -int32_t -stripe_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t flags, dir_entry_t *entries, int32_t count) -{ - stripe_local_t *local = NULL; - stripe_private_t *priv = NULL; - xlator_list_t *trav = NULL; - int32_t op_errno = 1; - - VALIDATE_OR_GOTO (frame, err); - VALIDATE_OR_GOTO (this, err); - VALIDATE_OR_GOTO (fd, err); - VALIDATE_OR_GOTO (fd->inode, err); - - priv = this->private; - trav = this->children; - - /* Initialization */ - local = CALLOC (1, sizeof (stripe_local_t)); - if (!local) { - op_errno = ENOMEM; - goto err; - } - local->op_ret = -1; - frame->local = local; - local->call_count = priv->child_count; - - while (trav) { - STACK_WIND (frame, stripe_common_cbk, trav->xlator, - trav->xlator->fops->setdents, fd, flags, entries, - count); - trav = trav->next; - } - - return 0; - err: - STACK_UNWIND (frame, -1, op_errno); - return 0; -} - - -/** * stripe_flush - */ int32_t @@ -3273,91 +3229,6 @@ stripe_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, /* Management operations */ -/** - * stripe_stats_cbk - Add all the fields received from different clients. - * Once all the clients return, send stats to above layer. - * - */ -int32_t -stripe_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct xlator_stats *stats) -{ - int32_t callcnt = 0; - stripe_local_t *local = NULL; - call_frame_t *prev = NULL; - - prev = cookie; - local = frame->local; - - LOCK(&frame->lock); - { - callcnt = --local->call_count; - - if (op_ret == -1) { - gf_log (this->name, GF_LOG_DEBUG, - "%s returned error %s", - prev->this->name, strerror (op_errno)); - local->op_ret = -1; - local->op_errno = op_errno; - } - if (op_ret == 0) { - if (local->op_ret == -2) { - /* This is to make sure this is the - first time */ - local->stats = *stats; - local->op_ret = 0; - } else { - local->stats.nr_files += stats->nr_files; - local->stats.free_disk += stats->free_disk; - local->stats.disk_usage += stats->disk_usage; - local->stats.nr_clients += stats->nr_clients; - } - } - } - UNLOCK (&frame->lock); - - if (!callcnt) { - STACK_UNWIND (frame, local->op_ret, local->op_errno, - &local->stats); - } - - return 0; -} - -/** - * stripe_stats - - */ -int32_t -stripe_stats (call_frame_t *frame, xlator_t *this, int32_t flags) -{ - stripe_local_t *local = NULL; - xlator_list_t *trav = NULL; - stripe_private_t *priv = NULL; - int32_t op_errno = 1; - - priv = this->private; - trav = this->children; - - local = CALLOC (1, sizeof (stripe_local_t)); - if (!local) { - op_errno = ENOMEM; - goto err; - } - frame->local = local; - local->op_ret = -2; /* to be used as a flag in _cbk */ - local->call_count = priv->child_count; - - while (trav) { - STACK_WIND (frame, stripe_stats_cbk, trav->xlator, - trav->xlator->mops->stats, flags); - trav = trav->next; - } - return 0; - err: - STACK_UNWIND (frame, -1, op_errno, NULL); - return 0; -} - int32_t stripe_release (xlator_t *this, fd_t *fd) { @@ -3674,12 +3545,10 @@ struct xlator_fops fops = { .setattr = stripe_setattr, .fsetattr = stripe_fsetattr, .lookup = stripe_lookup, - .setdents = stripe_setdents, .mknod = stripe_mknod, }; struct xlator_mops mops = { - .stats = stripe_stats, }; struct xlator_cbks cbks = { diff --git a/xlators/cluster/stripe/src/stripe.h b/xlators/cluster/stripe/src/stripe.h index 738727e9586..23ee4546d60 100644 --- a/xlators/cluster/stripe/src/stripe.h +++ b/xlators/cluster/stripe/src/stripe.h @@ -114,7 +114,6 @@ struct stripe_local { struct readv_replies *replies; struct statvfs statvfs_buf; dir_entry_t *entry; - struct xlator_stats stats; int8_t revalidate; int8_t failed; diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 931e9dc96a1..434965b5c1a 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -124,9 +124,6 @@ sys_error_t error_no_list[] = { [ERR_READDIRP] = { .error_no_count = 5, .error_no = {EINVAL,EACCES,EBADF, EMFILE,ENOENT}}, - [ERR_GETDENTS] = { .error_no_count = 5, - .error_no = {EBADF,EFAULT,EINVAL, - ENOENT,ENOTDIR}}, [ERR_FSYNCDIR] = { .error_no_count = 4, .error_no = {EBADF,EIO,EROFS,EINVAL}}, [ERR_ACCESS] = { .error_no_count = 8, @@ -144,9 +141,6 @@ sys_error_t error_no_list[] = { [ERR_LK] = { .error_no_count = 4, .error_no = {EACCES,EFAULT,ENOENT, EINTR}}, - [ERR_SETDENTS] = { .error_no_count = 4, - .error_no = {EACCES,EBADF,EINTR, - ENAMETOOLONG}}, [ERR_CHECKSUM] = { .error_no_count = 4, .error_no = {EACCES,EBADF, ENAMETOOLONG,EINTR}}, @@ -180,9 +174,6 @@ sys_error_t error_no_list[] = { ENAMETOOLONG,ENOENT, ENOMEM,ENOTDIR,EPERM, EROFS,EBADF,EIO}}, - [ERR_STATS] = { .error_no_count = 4, - .error_no = {EACCES,EBADF,ENAMETOOLONG, - EINTR}}, [ERR_GETSPEC] = { .error_no_count = 4, .error_no = {EACCES,EBADF,ENAMETOOLONG, EINTR}} @@ -304,8 +295,6 @@ get_fop_int (char **op_no_str) return ERR_READDIR; else if (!strcmp ((*op_no_str), "readdirp")) return ERR_READDIRP; - else if (!strcmp ((*op_no_str), "getdents")) - return ERR_GETDENTS; else if (!strcmp ((*op_no_str), "fsyncdir")) return ERR_FSYNCDIR; else if (!strcmp ((*op_no_str), "access")) @@ -316,8 +305,6 @@ get_fop_int (char **op_no_str) return ERR_FSTAT; else if (!strcmp ((*op_no_str), "lk")) return ERR_LK; - else if (!strcmp ((*op_no_str), "setdents")) - return ERR_SETDENTS; else if (!strcmp ((*op_no_str), "checksum")) return ERR_CHECKSUM; else if (!strcmp ((*op_no_str), "xattrop")) @@ -336,8 +323,6 @@ get_fop_int (char **op_no_str) return ERR_SETATTR; else if (!strcmp ((*op_no_str), "fsetattr")) return ERR_FSETATTR; - else if (!strcmp ((*op_no_str), "stats")) - return ERR_STATS; else if (!strcmp ((*op_no_str), "getspec")) return ERR_GETSPEC; else @@ -1280,83 +1265,6 @@ error_gen_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) return 0; } - -int -error_gen_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dir_entry_t *entries, - int32_t count) -{ - STACK_UNWIND_STRICT (getdents, frame, op_ret, op_errno, entries, - count); - return 0; -} - - -int -error_gen_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t offset, int32_t flag) -{ - int op_errno = 0; - eg_t *egp = NULL; - int enable = 1; - - egp = this->private; - enable = egp->enable[ERR_GETDENTS]; - - if (enable) - op_errno = error_gen (this, ERR_GETDENTS); - - if (op_errno) { - GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); - STACK_UNWIND_STRICT (getdents, frame, -1, op_errno, NULL, 0); - return 0; - } - - STACK_WIND (frame, error_gen_getdents_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->getdents, - fd, size, offset, flag); - return 0; -} - - -int -error_gen_setdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - STACK_UNWIND_STRICT (setdents, frame, op_ret, op_errno); - return 0; -} - - -int -error_gen_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t flags, dir_entry_t *entries, int32_t count) -{ - int op_errno = 0; - eg_t *egp = NULL; - int enable = 1; - - egp = this->private; - enable = egp->enable[ERR_SETDENTS]; - - if (enable) - op_errno = error_gen (this, ERR_SETDENTS); - - if (op_errno) { - GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); - STACK_UNWIND_STRICT (setdents, frame, -1, op_errno); - return 0; - } - - STACK_WIND (frame, error_gen_setdents_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->setdents, - fd, flags, entries, count); - return 0; -} - - int error_gen_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) @@ -1815,42 +1723,6 @@ error_gen_fentrylk (call_frame_t *frame, xlator_t *this, /* Management operations */ -int -error_gen_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct xlator_stats *stats) -{ - STACK_UNWIND (frame, op_ret, op_errno, stats); - return 0; -} - - -int -error_gen_stats (call_frame_t *frame, xlator_t *this, int32_t flags) -{ - int op_errno = 0; - eg_t *egp = NULL; - int enable = 1; - - egp = this->private; - enable = egp->enable[ERR_STATS]; - - if (enable) - op_errno = error_gen (this, ERR_STATS); - - if (op_errno) { - GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); - STACK_UNWIND (frame, -1, op_errno, NULL); - return 0; - } - - STACK_WIND (frame, error_gen_stats_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->mops->stats, - flags); - return 0; -} - int error_gen_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -2154,13 +2026,11 @@ struct xlator_fops fops = { .opendir = error_gen_opendir, .readdir = error_gen_readdir, .readdirp = error_gen_readdirp, - .getdents = error_gen_getdents, .fsyncdir = error_gen_fsyncdir, .access = error_gen_access, .ftruncate = error_gen_ftruncate, .fstat = error_gen_fstat, .lk = error_gen_lk, - .setdents = error_gen_setdents, .lookup_cbk = error_gen_lookup_cbk, .checksum = error_gen_checksum, .xattrop = error_gen_xattrop, @@ -2174,7 +2044,6 @@ struct xlator_fops fops = { }; struct xlator_mops mops = { - .stats = error_gen_stats, .getspec = error_gen_getspec, }; diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index eecca0a72b9..fa0c8891e7c 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -462,14 +462,6 @@ io_stats_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int -io_stats_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - dir_entry_t *entries, int32_t count) -{ - STACK_UNWIND_STRICT (getdents, frame, op_ret, op_errno, entries, count); - return 0; -} int @@ -731,15 +723,6 @@ io_stats_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int -io_stats_setdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - STACK_UNWIND_STRICT (setdents, frame, op_ret, op_errno); - return 0; -} - - -int io_stats_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { @@ -1246,21 +1229,6 @@ io_stats_opendir (call_frame_t *frame, xlator_t *this, return 0; } - -int -io_stats_getdents (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t offset, int32_t flag) -{ - BUMP_FOP (GETDENTS); - - STACK_WIND (frame, io_stats_getdents_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->getdents, - fd, size, offset, flag); - return 0; -} - - int io_stats_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset) @@ -1377,21 +1345,6 @@ io_stats_lk (call_frame_t *frame, xlator_t *this, int -io_stats_setdents (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t flags, - dir_entry_t *entries, int32_t count) -{ - BUMP_FOP (SETDENTS); - - STACK_WIND (frame, io_stats_setdents_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->setdents, - fd, flags, entries, count); - return 0; -} - - -int io_stats_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, uint8_t *fchecksum, uint8_t *dchecksum) @@ -1416,26 +1369,6 @@ io_stats_checksum (call_frame_t *frame, xlator_t *this, } -int -io_stats_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct xlator_stats *stats) -{ - STACK_UNWIND (frame, op_ret, op_errno, stats); - return 0; -} - - -int -io_stats_stats (call_frame_t *frame, xlator_t *this, int32_t flags) -{ - STACK_WIND (frame, io_stats_stats_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->mops->stats, - flags); - - return 0; -} - int io_stats_release (xlator_t *this, fd_t *fd) @@ -1576,8 +1509,6 @@ struct xlator_fops fops = { .finodelk = io_stats_finodelk, .entrylk = io_stats_entrylk, .lookup = io_stats_lookup, - .setdents = io_stats_setdents, - .getdents = io_stats_getdents, .checksum = io_stats_checksum, .xattrop = io_stats_xattrop, .fxattrop = io_stats_fxattrop, @@ -1586,7 +1517,6 @@ struct xlator_fops fops = { }; struct xlator_mops mops = { - .stats = io_stats_stats, }; struct xlator_cbks cbks = { diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c index a9e580c0e92..5d1d342db88 100644 --- a/xlators/debug/trace/src/trace.c +++ b/xlators/debug/trace/src/trace.c @@ -271,21 +271,6 @@ trace_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int -trace_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dir_entry_t *entries, - int32_t count) -{ - if (trace_fop_names[GF_FOP_GETDENTS].enabled) { - gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (op_ret=%d, op_errno=%d, count=%d)", - frame->root->unique, op_ret, op_errno, count); - } - - STACK_UNWIND_STRICT (getdents, frame, op_ret, op_errno, entries, count); - return 0; -} - int trace_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -1112,20 +1097,6 @@ trace_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -int -trace_setdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - if (trace_fop_names[GF_FOP_SETDENTS].enabled) { - gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": op_ret=%d, op_errno=%d", - frame->root->unique, op_ret, op_errno); - } - - STACK_UNWIND_STRICT (setdents, frame, op_ret, op_errno); - return 0; -} - int trace_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, @@ -1801,25 +1772,6 @@ trace_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) return 0; } - -int -trace_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t offset, int32_t flag) -{ - if (trace_fop_names[GF_FOP_GETDENTS].enabled) { - gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (fd=%p, size=%"GF_PRI_SIZET", offset=%"PRId64", flag=0x%x)", - frame->root->unique, fd, size, offset, flag); - } - - STACK_WIND (frame, trace_getdents_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->getdents, - fd, size, offset, flag); - return 0; -} - - int trace_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset) @@ -1951,24 +1903,6 @@ trace_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int -trace_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t flags, dir_entry_t *entries, int32_t count) -{ - if (trace_fop_names[GF_FOP_SETDENTS].enabled) { - gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (*fd=%p, flags=%d, count=%d", - frame->root->unique, fd, flags, count); - } - - STACK_WIND (frame, trace_setdents_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->setdents, - fd, flags, entries, count); - return 0; -} - - -int trace_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, uint8_t *fchecksum, uint8_t *dchecksum) @@ -2000,36 +1934,6 @@ trace_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag) } -int -trace_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct xlator_stats *stats) -{ - gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": op_ret (%d), op_errno(%d)", - frame->root->unique, op_ret, op_errno); - - STACK_UNWIND (frame, op_ret, op_errno, stats); - return 0; -} - - -int -trace_stats (call_frame_t *frame, xlator_t *this, int32_t flags) -{ - gf_log (this->name, GF_LOG_NORMAL, - "%"PRId64": (flags=%d)", - frame->root->unique, flags); - - STACK_WIND (frame, trace_stats_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->mops->stats, - flags); - - return 0; -} - - void enable_all_calls (int enabled) { @@ -2185,8 +2089,6 @@ struct xlator_fops fops = { .finodelk = trace_finodelk, .entrylk = trace_entrylk, .lookup = trace_lookup, - .setdents = trace_setdents, - .getdents = trace_getdents, .checksum = trace_checksum, .xattrop = trace_xattrop, .fxattrop = trace_fxattrop, @@ -2195,7 +2097,6 @@ struct xlator_fops fops = { }; struct xlator_mops mops = { - .stats = trace_stats, }; struct xlator_cbks cbks = { diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c index b3777cb76cd..c54042130e8 100644 --- a/xlators/performance/stat-prefetch/src/stat-prefetch.c +++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c @@ -3107,138 +3107,6 @@ out: return 0; } - -int32_t -sp_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, - dir_entry_t *entries, int32_t count) -{ - sp_fd_ctx_t *fd_ctx = NULL; - sp_cache_t *cache = NULL; - uint64_t value = 0; - int32_t ret = 0; - inode_t *parent = NULL; - char *name = NULL; - dir_entry_t *trav = NULL; - - ret = fd_ctx_get (fd, this, &value); - if (ret == -1) { - errno = EINVAL; - goto unwind; - } - - fd_ctx = (void *)(long)value; - name = fd_ctx->name; - parent = fd_ctx->parent_inode; - - cache = sp_get_cache_inode (this, parent, frame->root->pid); - if (cache) { - sp_cache_remove_entry (cache, name, 0); - sp_cache_unref (cache); - } - - cache = sp_get_cache_fd (this, fd); - if (cache) { - for (trav = entries->next; trav; trav = trav->next) { - sp_cache_remove_entry (cache, trav->name, 0); - } - sp_cache_unref (cache); - } - - STACK_WIND (frame, sp_err_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->setdents, fd, flags, entries, - count); - return 0; - -unwind: - SP_STACK_UNWIND (setdents, frame, -1, errno); - return 0; -} - - -int32_t -sp_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dir_entry_t *entries, - int32_t count) -{ - dir_entry_t *trav = NULL; - sp_local_t *local = NULL; - sp_cache_t *cache = NULL; - - if (op_ret == -1) { - goto out; - } - - local = frame->local; - if ((local == NULL) || (local->fd == NULL)) { - op_ret = -1; - op_errno = EINVAL; - goto out; - } - - cache = sp_get_cache_fd (this, local->fd); - if (cache) { - for (trav = entries->next; trav; trav = trav->next) { - if (IA_ISLNK (trav->buf.ia_type)) { - sp_cache_remove_entry (cache, trav->name, 0); - } - } - - sp_cache_unref (cache); - } - -out: - SP_STACK_UNWIND (getdents, frame, op_ret, op_errno, entries, count); - return 0; -} - - -int32_t -sp_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset, int32_t flags) -{ - sp_fd_ctx_t *fd_ctx = NULL; - sp_cache_t *cache = NULL; - uint64_t value = 0; - int32_t ret = 0; - inode_t *parent = NULL; - char *name = NULL; - sp_local_t *local = NULL; - - ret = fd_ctx_get (fd, this, &value); - if (ret == -1) { - errno = EINVAL; - goto unwind; - } - - fd_ctx = (void *)(long)value; - name = fd_ctx->name; - parent = fd_ctx->parent_inode; - - cache = sp_get_cache_inode (this, parent, frame->root->pid); - if (cache) { - sp_cache_remove_entry (cache, name, 0); - sp_cache_unref (cache); - } - - local = CALLOC (1, sizeof (*local)); - if (local == NULL) { - gf_log (this->name, GF_LOG_ERROR, "out of memory"); - goto unwind; - } - - local->fd = fd; - frame->local = local; - - STACK_WIND (frame, sp_getdents_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->getdents, fd, size, offset, flags); - return 0; - -unwind: - SP_STACK_UNWIND (getdents, frame, -1, errno, NULL, -1); - return 0; -} - - int32_t sp_checksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, uint8_t *file_checksum, @@ -3904,8 +3772,6 @@ struct xlator_fops fops = { .rename = sp_rename, .setxattr = sp_setxattr, .removexattr = sp_removexattr, - .setdents = sp_setdents, - .getdents = sp_getdents, .checksum = sp_checksum, .xattrop = sp_xattrop, .fxattrop = sp_fxattrop, diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c index f50182a6bd1..36a31c5c918 100644 --- a/xlators/protocol/client/src/client-protocol.c +++ b/xlators/protocol/client/src/client-protocol.c @@ -2377,75 +2377,6 @@ unwind: } - -/** - * client_readdir - readdir function for client protocol - * @frame: call frame - * @this: this translator structure - * - * external reference through client_protocol_xlator->fops->readdir - */ - -int -client_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t offset, int32_t flag) -{ - gf_hdr_common_t *hdr = NULL; - gf_fop_getdents_req_t *req = NULL; - size_t hdrlen = 0; - int64_t remote_fd = -1; - int ret = -1; - client_fd_ctx_t *fdctx = NULL; - client_conf_t *conf = NULL; - - conf = this->private; - - pthread_mutex_lock (&conf->mutex); - { - fdctx = this_fd_get_ctx (fd, this); - } - pthread_mutex_unlock (&conf->mutex); - - if (fdctx == NULL) { - gf_log (this->name, GF_LOG_TRACE, - "(%"PRId64"): failed to get fd ctx. EBADFD", - fd->inode->ino); - STACK_UNWIND (frame, -1, EBADFD, NULL); - return 0; - } - - if (fdctx->remote_fd == -1) { - gf_log (this->name, GF_LOG_TRACE, - "(%"PRId64"): failed to get fd ctx. EBADFD", - fd->inode->ino); - STACK_UNWIND (frame, -1, EBADFD, NULL); - } - - remote_fd = fdctx->remote_fd; - hdrlen = gf_hdr_len (req, 0); - hdr = gf_hdr_new (req, 0); - GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind); - - req = gf_param (hdr); - GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind); - - req->fd = hton64 (remote_fd); - req->size = hton32 (size); - req->offset = hton64 (offset); - req->flags = hton32 (flag); - - ret = protocol_client_xfer (frame, this, - CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_GETDENTS, - hdr, hdrlen, NULL, 0, NULL); - - return 0; -unwind: - STACK_UNWIND (frame, -1, EINVAL, NULL, 0); - return 0; -} - - /** * client_readdirp - readdirp function for client protocol * @frame: call frame @@ -3368,157 +3299,6 @@ unwind: int -client_setdents (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, - dir_entry_t *entries, int32_t count) -{ - gf_hdr_common_t *hdr = NULL; - gf_fop_setdents_req_t *req = NULL; - int64_t remote_fd = 0; - char *ptr = NULL; - dir_entry_t *trav = NULL; - uint32_t len = 0; - int32_t buf_len = 0; - int32_t ret = -1; - int32_t op_ret = -1; - int32_t op_errno = EINVAL; - int32_t vec_count = 0; - size_t hdrlen = -1; - struct iovec vector[1]; - struct iobref *iobref = NULL; - struct iobuf *iobuf = NULL; - client_fd_ctx_t *fdctx = NULL; - client_conf_t *conf = NULL; - - GF_VALIDATE_OR_GOTO (this->name, fd, unwind); - - conf = this->private; - - pthread_mutex_lock (&conf->mutex); - { - fdctx = this_fd_get_ctx (fd, this); - } - pthread_mutex_unlock (&conf->mutex); - - if (fdctx == NULL) { - gf_log (this->name, GF_LOG_DEBUG, - "(%"PRId64"): failed to get fd ctx. EBADFD", - fd->inode->ino); - op_errno = EBADFD; - goto unwind; - } - - if (fdctx->remote_fd == -1) { - gf_log (this->name, GF_LOG_DEBUG, - "(%"PRId64"): failed to get fd ctx. EBADFD", - fd->inode->ino); - op_errno = EBADFD; - goto unwind; - } - - remote_fd = fdctx->remote_fd; - GF_VALIDATE_OR_GOTO (this->name, entries, unwind); - GF_VALIDATE_OR_GOTO (this->name, count, unwind); - - trav = entries->next; - while (trav) { - len += strlen (trav->name); - len += 1; - len += strlen (trav->link); - len += 1; - len += 256; // max possible for statbuf; - trav = trav->next; - } - iobuf = iobuf_get (this->ctx->iobuf_pool); - GF_VALIDATE_OR_GOTO (this->name, iobuf, unwind); - - ptr = iobuf->ptr; - - trav = entries->next; - while (trav) { - int32_t this_len = 0; - char *tmp_buf = NULL; - struct iatt *stbuf = &trav->buf; - { - /* Convert the stat buf to string */ - uint64_t dev = stbuf->ia_gen; - uint64_t ino = stbuf->ia_ino; - uint32_t mode = st_mode_from_ia (stbuf->ia_prot, stbuf->ia_type); - uint32_t nlink = stbuf->ia_nlink; - uint32_t uid = stbuf->ia_uid; - uint32_t gid = stbuf->ia_gid; - uint64_t rdev = stbuf->ia_rdev; - uint64_t size = stbuf->ia_size; - uint32_t blksize = stbuf->ia_blksize; - uint64_t blocks = stbuf->ia_blocks; - - uint32_t atime = stbuf->ia_atime; - uint32_t mtime = stbuf->ia_mtime; - uint32_t ctime = stbuf->ia_ctime; - - uint32_t atime_nsec = stbuf->ia_atime_nsec; - uint32_t mtime_nsec = stbuf->ia_mtime_nsec; - uint32_t ctime_nsec = stbuf->ia_ctime_nsec; - - ret = asprintf (&tmp_buf, GF_STAT_PRINT_FMT_STR, - dev, ino, mode, nlink, uid, gid, - rdev, size, blksize, blocks, - atime, atime_nsec, mtime, mtime_nsec, - ctime, ctime_nsec); - if (-1 == ret) { - gf_log (this->name, GF_LOG_ERROR, - "asprintf failed while setting stat " - "buf to string"); - STACK_UNWIND (frame, -1, ENOMEM); - return 0; - } - } - this_len = sprintf (ptr, "%s/%s%s\n", - trav->name, tmp_buf, trav->link); - - FREE (tmp_buf); - trav = trav->next; - ptr += this_len; - } - buf_len = strlen (iobuf->ptr); - - hdrlen = gf_hdr_len (req, 0); - hdr = gf_hdr_new (req, 0); - GF_VALIDATE_OR_GOTO (this->name, hdr, unwind); - - req = gf_param (hdr); - - req->fd = hton64 (remote_fd); - req->flags = hton32 (flags); - req->count = hton32 (count); - - iobref = iobref_new (); - iobref_add (iobref, iobuf); - - ret = protocol_client_xfer (frame, this, - CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_FOP_REQUEST, GF_FOP_SETDENTS, - hdr, hdrlen, vector, vec_count, iobref); - - if (iobref) - iobref_unref (iobref); - - if (iobuf) - iobuf_unref (iobuf); - - return ret; -unwind: - - if (iobref) - iobref_unref (iobref); - - if (iobuf) - iobuf_unref (iobuf); - - STACK_UNWIND (frame, op_ret, op_errno); - return 0; -} - -int client_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf, int32_t valid) { @@ -3766,45 +3546,6 @@ client_release (xlator_t *this, fd_t *fd) * MGMT_OPS */ -/** - * client_stats - stats function for client protocol - * @frame: call frame - * @this: this translator structure - * @flags: - * - * external reference through client_protocol_xlator->mops->stats - */ - -int -client_stats (call_frame_t *frame, xlator_t *this, int32_t flags) -{ - gf_hdr_common_t *hdr = NULL; - gf_mop_stats_req_t *req = NULL; - size_t hdrlen = -1; - int ret = -1; - - GF_VALIDATE_OR_GOTO ("client", this, unwind); - - hdrlen = gf_hdr_len (req, 0); - hdr = gf_hdr_new (req, 0); - GF_VALIDATE_OR_GOTO (this->name, hdr, unwind); - - req = gf_param (hdr); - - req->flags = hton32 (flags); - - ret = protocol_client_xfer (frame, this, - CLIENT_CHANNEL (this, CHANNEL_BULK), - GF_OP_TYPE_MOP_REQUEST, GF_MOP_STATS, - hdr, hdrlen, NULL, 0, NULL); - - return ret; -unwind: - STACK_UNWIND (frame, -1, EINVAL, NULL); - return 0; -} - - /* Callbacks */ int @@ -5036,74 +4777,6 @@ client_fsetattr_cbk (call_frame_t *frame,gf_hdr_common_t *hdr, size_t hdrlen, return 0; } -static dir_entry_t * -gf_bin_to_direntry (char *buf, size_t count) -{ - int idx = 0; - int bread = 0; - size_t rcount = 0; - char *ender = NULL; - char *buffer = NULL; - char tmp_buf[512] = {0,}; - dir_entry_t *trav = NULL; - dir_entry_t *prev = NULL; - dir_entry_t *thead = NULL; - dir_entry_t *head = NULL; - - thead = CALLOC (1, sizeof (dir_entry_t)); - GF_VALIDATE_OR_GOTO ("client-protocol", thead, fail); - - buffer = buf; - prev = thead; - - for (idx = 0; idx < count ; idx++) { - bread = 0; - trav = CALLOC (1, sizeof (dir_entry_t)); - GF_VALIDATE_OR_GOTO ("client-protocol", trav, fail); - - ender = strchr (buffer, '/'); - if (!ender) - break; - rcount = ender - buffer; - trav->name = CALLOC (1, rcount + 2); - GF_VALIDATE_OR_GOTO ("client-protocol", trav->name, fail); - - strncpy (trav->name, buffer, rcount); - bread = rcount + 1; - buffer += bread; - - ender = strchr (buffer, '\n'); - if (!ender) - break; - rcount = ender - buffer; - strncpy (tmp_buf, buffer, rcount); - bread = rcount + 1; - buffer += bread; - - gf_string_to_stat (tmp_buf, &trav->buf); - - ender = strchr (buffer, '\n'); - if (!ender) - break; - rcount = ender - buffer; - *ender = '\0'; - if (IA_ISLNK (trav->buf.ia_type)) - trav->link = strdup (buffer); - else - trav->link = ""; - - bread = rcount + 1; - buffer += bread; - - prev->next = trav; - prev = trav; - } - - head = thead; -fail: - return head; -} - int gf_free_direntry (dir_entry_t *head) @@ -5129,50 +4802,6 @@ fail: } /* - * client_getdents_cbk - readdir callback for client protocol - * @frame: call frame - * @args: argument dictionary - * - * not for external reference - */ - -int -client_getdents_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, - struct iobuf *iobuf) -{ - gf_fop_getdents_rsp_t *rsp = NULL; - int32_t op_ret = 0; - int32_t op_errno = 0; - int32_t gf_errno = 0; - int32_t nr_count = 0; - dir_entry_t *entry = NULL; - - rsp = gf_param (hdr); - - op_ret = ntoh32 (hdr->rsp.op_ret); - gf_errno = ntoh32 (hdr->rsp.op_errno); - op_errno = gf_error_to_errno (gf_errno); - - if (op_ret >= 0) { - nr_count = ntoh32 (rsp->count); - entry = gf_bin_to_direntry(iobuf->ptr, nr_count); - if (entry == NULL) { - op_ret = -1; - op_errno = EINVAL; - } - } - - STACK_UNWIND (frame, op_ret, op_errno, entry, nr_count); - - if (iobuf) - iobuf_unref (iobuf); - if (entry) - gf_free_direntry(entry); - - return 0; -} - -/* * client_statfs_cbk - statfs callback for client protocol * @frame: call frame * @args: argument dictionary @@ -5462,69 +5091,7 @@ client_fentrylk_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, return 0; } -/** - * client_writedir_cbk - - * - * @frame: - * @args: - * - * not for external reference - */ - -int -client_setdents_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, - struct iobuf *iobuf) -{ - int32_t op_ret = 0; - int32_t op_errno = 0; - - op_ret = ntoh32 (hdr->rsp.op_ret); - op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); - - STACK_UNWIND (frame, op_ret, op_errno); - - return 0; -} - -/* - * client_stats_cbk - stats callback for client protocol - * - * @frame: call frame - * @args: argument dictionary - * - * not for external reference - */ -int -client_stats_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen, - struct iobuf *iobuf) -{ - struct xlator_stats stats = {0,}; - gf_mop_stats_rsp_t *rsp = NULL; - char *buffer = NULL; - int32_t op_ret = 0; - int32_t op_errno = 0; - - rsp = gf_param (hdr); - - op_ret = ntoh32 (hdr->rsp.op_ret); - op_errno = gf_error_to_errno (ntoh32 (hdr->rsp.op_errno)); - - if (op_ret >= 0) - { - buffer = rsp->buf; - - sscanf (buffer, "%"SCNx64",%"SCNx64",%"SCNx64",%"SCNx64 - ",%"SCNx64",%"SCNx64",%"SCNx64",%"SCNx64"\n", - &stats.nr_files, &stats.disk_usage, &stats.free_disk, - &stats.total_disk_size, &stats.read_usage, - &stats.write_usage, &stats.disk_speed, - &stats.nr_clients); - } - - STACK_UNWIND (frame, op_ret, op_errno, &stats); - return 0; -} /* * client_getspec - getspec function for client protocol @@ -6446,7 +6013,6 @@ static gf_op_t gf_fops[] = { [GF_FOP_GETXATTR] = client_getxattr_cbk, [GF_FOP_REMOVEXATTR] = client_removexattr_cbk, [GF_FOP_OPENDIR] = client_opendir_cbk, - [GF_FOP_GETDENTS] = client_getdents_cbk, [GF_FOP_FSYNCDIR] = client_fsyncdir_cbk, [GF_FOP_ACCESS] = client_access_cbk, [GF_FOP_CREATE] = client_create_cbk, @@ -6454,7 +6020,6 @@ static gf_op_t gf_fops[] = { [GF_FOP_FSTAT] = client_fstat_cbk, [GF_FOP_LK] = client_lk_common_cbk, [GF_FOP_LOOKUP] = client_lookup_cbk, - [GF_FOP_SETDENTS] = client_setdents_cbk, [GF_FOP_READDIR] = client_readdir_cbk, [GF_FOP_READDIRP] = client_readdirp_cbk, [GF_FOP_INODELK] = client_inodelk_cbk, @@ -6472,7 +6037,6 @@ static gf_op_t gf_fops[] = { static gf_op_t gf_mops[] = { [GF_MOP_SETVOLUME] = client_setvolume_cbk, [GF_MOP_GETVOLUME] = client_enosys_cbk, - [GF_MOP_STATS] = client_stats_cbk, [GF_MOP_SETSPEC] = client_setspec_cbk, [GF_MOP_GETSPEC] = client_getspec_cbk, [GF_MOP_PING] = client_ping_cbk, @@ -7102,8 +6666,6 @@ struct xlator_fops fops = { .entrylk = client_entrylk, .fentrylk = client_fentrylk, .lookup = client_lookup, - .setdents = client_setdents, - .getdents = client_getdents, .checksum = client_checksum, .rchecksum = client_rchecksum, .xattrop = client_xattrop, @@ -7113,7 +6675,6 @@ struct xlator_fops fops = { }; struct xlator_mops mops = { - .stats = client_stats, .getspec = client_getspec, .log = client_log, }; diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c index 57e32039310..17daec9c622 100644 --- a/xlators/protocol/server/src/server-protocol.c +++ b/xlators/protocol/server/src/server-protocol.c @@ -348,39 +348,6 @@ protocol_server_reply (call_frame_t *frame, int type, int op, /* - * server_setdents_cbk - writedir callback for server protocol - * @frame: call frame - * @cookie: - * @this: - * @op_ret: return value - * @op_errno: errno - * - * not for external reference - */ -int -server_setdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno) -{ - gf_hdr_common_t *hdr = NULL; - gf_fop_setdents_rsp_t *rsp = NULL; - size_t hdrlen = 0; - int32_t gf_errno = 0; - - hdrlen = gf_hdr_len (rsp, 0); - hdr = gf_hdr_new (rsp, 0); - rsp = gf_param (hdr); - - hdr->rsp.op_ret = hton32 (op_ret); - gf_errno = gf_errno_to_error (op_errno); - hdr->rsp.op_errno = hton32 (gf_errno); - - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_SETDENTS, - hdr, hdrlen, NULL, 0, NULL); - - return 0; -} - -/* * server_lk_cbk - lk callback for server protocol * @frame: call frame * @cookie: @@ -872,103 +839,6 @@ server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } -/* - * server_getdents_cbk - readdir callback for server protocol - * @frame: call frame - * @cookie: - * @this: - * @op_ret: return value - * @op_errno: errno - * @entries: - * @count: - * - * not for external reference - */ -int -server_getdents_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dir_entry_t *entries, - int32_t count) -{ - gf_hdr_common_t *hdr = NULL; - gf_fop_getdents_rsp_t *rsp = NULL; - size_t hdrlen = 0; - int32_t vec_count = 0; - int32_t gf_errno = 0; - struct iobref *iobref = NULL; - struct iobuf *iobuf = NULL; - size_t buflen = 0; - struct iovec vector[1]; - server_state_t *state = NULL; - - state = CALL_STATE(frame); - - if (op_ret >= 0) { - iobuf = iobuf_get (this->ctx->iobuf_pool); - if (!iobuf) { - op_ret = -1; - op_errno = ENOMEM; - goto out; - } - - buflen = gf_direntry_to_bin (entries, iobuf->ptr); - if (buflen < 0) { - gf_log (this->name, GF_LOG_ERROR, - "fd - %"PRId64" (%"PRId64"): failed to convert " - "entries list to string buffer", - state->resolve.fd_no, state->fd->inode->ino); - op_ret = -1; - op_errno = EINVAL; - goto out; - } - - iobref = iobref_new (); - if (iobref == NULL) { - gf_log (this->name, GF_LOG_ERROR, - "fd - %"PRId64" (%"PRId64"): failed to get iobref", - state->resolve.fd_no, state->fd->inode->ino); - op_ret = -1; - op_errno = ENOMEM; - goto out; - } - - iobref_add (iobref, iobuf); - - vector[0].iov_base = iobuf->ptr; - vector[0].iov_len = buflen; - vec_count = 1; - } else { - gf_log (this->name, GF_LOG_TRACE, - "%"PRId64": GETDENTS %"PRId64" (%"PRId64"): %"PRId32" (%s)", - frame->root->unique, - state->resolve.fd_no, - state->fd ? state->fd->inode->ino : 0, - op_ret, strerror (op_errno)); - vector[0].iov_base = NULL; - vector[0].iov_len = 0; - } - -out: - hdrlen = gf_hdr_len (rsp, 0); - hdr = gf_hdr_new (rsp, 0); - rsp = gf_param (hdr); - - rsp->count = hton32 (count); - - hdr->rsp.op_ret = hton32 (op_ret); - gf_errno = gf_errno_to_error (op_errno); - hdr->rsp.op_errno = hton32 (gf_errno); - - protocol_server_reply (frame, GF_OP_TYPE_FOP_REPLY, GF_FOP_GETDENTS, - hdr, hdrlen, vector, vec_count, iobref); - - if (iobref) - iobref_unref (iobref); - if (iobuf) - iobuf_unref (iobuf); - - return 0; -} - /* * server_readdir_cbk - getdents callback for server protocol @@ -3963,53 +3833,6 @@ server_releasedir (call_frame_t *frame, xlator_t *bound_xl, return 0; } -int -server_getdents_resume (call_frame_t *frame, xlator_t *bound_xl) -{ - server_state_t *state = NULL; - - state = CALL_STATE (frame); - - if (state->resolve.op_ret != 0) - goto err; - - STACK_WIND (frame, server_getdents_cbk, - bound_xl, - bound_xl->fops->getdents, - state->fd, state->size, state->offset, state->flags); - - return 0; -err: - server_getdents_cbk (frame, NULL, frame->this, state->resolve.op_ret, - state->resolve.op_errno, NULL, 0); - return 0; -} - -int -server_getdents (call_frame_t *frame, xlator_t *bound_xl, - gf_hdr_common_t *hdr, size_t hdrlen, - struct iobuf *iobuf) -{ - gf_fop_getdents_req_t *req = NULL; - server_state_t *state = NULL; - server_connection_t *conn = NULL; - - conn = SERVER_CONNECTION (frame); - - req = gf_param (hdr); - state = CALL_STATE(frame); - - state->resolve.type = RESOLVE_MUST; - state->resolve.fd_no = ntoh64 (req->fd); - state->size = ntoh32 (req->size); - state->offset = ntoh64 (req->offset); - state->flags = ntoh32 (req->flags); - - resolve_and_resume (frame, server_getdents_resume); - - return 0; -} - /* * server_readdirp_cbk - getdents callback for server protocol * @frame: call frame @@ -4963,189 +4786,6 @@ server_lk (call_frame_t *frame, xlator_t *bound_xl, return 0; } - -int -server_setdents_resume(call_frame_t *frame, xlator_t *bound_xl) -{ - server_state_t *state = NULL; - - state = CALL_STATE (frame); - - if (state->resolve.op_ret != 0) - goto err; - - STACK_WIND (frame, server_setdents_cbk, - BOUND_XL(frame), - BOUND_XL(frame)->fops->setdents, - state->fd, state->flags, state->entry, state->nr_count); - - return 0; -err: - server_setdents_cbk (frame, NULL, frame->this, state->resolve.op_ret, state->resolve.op_errno); - return 0; -} -/* - * server_writedir - - * - * @frame: - * @bound_xl: - * @params: - * - */ -int -server_setdents (call_frame_t *frame, xlator_t *bound_xl, - gf_hdr_common_t *hdr, size_t hdrlen, - struct iobuf *iobuf) -{ - server_connection_t *conn = NULL; - gf_fop_setdents_req_t *req = NULL; - server_state_t *state = NULL; - dir_entry_t *entry = NULL; - dir_entry_t *trav = NULL; - dir_entry_t *prev = NULL; - int32_t count = 0; - int32_t i = 0; - int32_t bread = 0; - char *ender = NULL; - char *buffer_ptr = NULL; - char tmp_buf[512] = {0,}; - - conn = SERVER_CONNECTION(frame); - - req = gf_param (hdr); - state = CALL_STATE(frame); - - state->resolve.type = RESOLVE_MUST; - state->resolve.fd_no = ntoh64 (req->fd); - state->nr_count = ntoh32 (req->count); - - - if (iobuf == NULL) { - gf_log (frame->this->name, GF_LOG_ERROR, - "fd - %"PRId64" (%"PRId64"): received a null buffer, " - "returning EINVAL", - state->resolve.fd_no, state->fd->inode->ino); - - server_setdents_cbk (frame, NULL, frame->this, -1, ENOMEM); - - goto out; - } - - entry = CALLOC (1, sizeof (dir_entry_t)); - ERR_ABORT (entry); - prev = entry; - buffer_ptr = iobuf->ptr; - - for (i = 0; i < state->nr_count ; i++) { - bread = 0; - trav = CALLOC (1, sizeof (dir_entry_t)); - ERR_ABORT (trav); - - ender = strchr (buffer_ptr, '/'); - if (!ender) - break; - count = ender - buffer_ptr; - trav->name = CALLOC (1, count + 2); - ERR_ABORT (trav->name); - - strncpy (trav->name, buffer_ptr, count); - bread = count + 1; - buffer_ptr += bread; - - ender = strchr (buffer_ptr, '\n'); - if (!ender) - break; - count = ender - buffer_ptr; - strncpy (tmp_buf, buffer_ptr, count); - bread = count + 1; - buffer_ptr += bread; - - /* TODO: use str_to_stat instead */ - { - uint64_t dev; - uint64_t ino; - uint32_t mode; - uint32_t nlink; - uint32_t uid; - uint32_t gid; - uint64_t rdev; - uint64_t size; - uint32_t blksize; - uint64_t blocks; - uint32_t atime; - uint32_t atime_nsec; - uint32_t mtime; - uint32_t mtime_nsec; - uint32_t ctime; - uint32_t ctime_nsec; - - sscanf (tmp_buf, GF_STAT_PRINT_FMT_STR, - &dev, &ino, &mode, &nlink, &uid, &gid, &rdev, - &size, &blksize, &blocks, &atime, &atime_nsec, - &mtime, &mtime_nsec, &ctime, &ctime_nsec); - - trav->buf.ia_gen = dev; - trav->buf.ia_ino = ino; - trav->buf.ia_prot = ia_prot_from_st_mode (mode); - trav->buf.ia_type = ia_type_from_st_mode (mode); - trav->buf.ia_nlink = nlink; - trav->buf.ia_uid = uid; - trav->buf.ia_gid = gid; - trav->buf.ia_rdev = rdev; - trav->buf.ia_size = size; - trav->buf.ia_blksize = blksize; - trav->buf.ia_blocks = blocks; - - trav->buf.ia_atime = atime; - trav->buf.ia_mtime = mtime; - trav->buf.ia_ctime = ctime; - - trav->buf.ia_atime_nsec = atime_nsec; - trav->buf.ia_mtime_nsec = mtime_nsec; - trav->buf.ia_ctime_nsec = ctime_nsec; - } - - ender = strchr (buffer_ptr, '\n'); - if (!ender) - break; - count = ender - buffer_ptr; - *ender = '\0'; - if (IA_ISLNK (trav->buf.ia_type)) { - trav->link = strdup (buffer_ptr); - } else - trav->link = ""; - bread = count + 1; - buffer_ptr += bread; - - prev->next = trav; - prev = trav; - } - - state->entry = entry; - resolve_and_resume (frame, server_setdents_resume); - - - /* Free the variables allocated in this fop here */ - trav = entry->next; - prev = entry; - while (trav) { - prev->next = trav->next; - FREE (trav->name); - if (IA_ISLNK (trav->buf.ia_type)) - FREE (trav->link); - FREE (trav); - trav = prev->next; - } - FREE (entry); - -out: - if (iobuf) - iobuf_unref (iobuf); - return 0; -} - - - /* xxx_MOPS */ int _volfile_update_checksum (xlator_t *this, char *key, uint32_t checksum) @@ -5944,89 +5584,6 @@ fail: return 0; } -/* - * server_mop_stats_cbk - stats callback for server management operation - * @frame: call frame - * @cookie: - * @this: - * @op_ret: return value - * @op_errno: errno - * @stats:err - * - * not for external reference - */ - -int -server_mop_stats_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t ret, int32_t op_errno, - struct xlator_stats *stats) -{ - /* TODO: get this information from somewhere else, not extern */ - gf_hdr_common_t *hdr = NULL; - gf_mop_stats_rsp_t *rsp = NULL; - char buffer[256] = {0,}; - int64_t glusterfsd_stats_nr_clients = 0; - size_t hdrlen = 0; - size_t buf_len = 0; - int32_t gf_errno = 0; - - if (ret >= 0) { - sprintf (buffer, - "%"PRIx64",%"PRIx64",%"PRIx64 - ",%"PRIx64",%"PRIx64",%"PRIx64 - ",%"PRIx64",%"PRIx64"\n", - stats->nr_files, stats->disk_usage, stats->free_disk, - stats->total_disk_size, stats->read_usage, - stats->write_usage, stats->disk_speed, - glusterfsd_stats_nr_clients); - - buf_len = strlen (buffer); - } - - hdrlen = gf_hdr_len (rsp, buf_len + 1); - hdr = gf_hdr_new (rsp, buf_len + 1); - rsp = gf_param (hdr); - - hdr->rsp.op_ret = hton32 (ret); - gf_errno = gf_errno_to_error (op_errno); - hdr->rsp.op_errno = hton32 (gf_errno); - - strcpy (rsp->buf, buffer); - - protocol_server_reply (frame, GF_OP_TYPE_MOP_REPLY, GF_MOP_STATS, - hdr, hdrlen, NULL, 0, NULL); - - return 0; -} - - -/* - * mop_unlock - unlock management function for server protocol - * @frame: call frame - * @bound_xl: - * @params: parameter dictionary - * - */ -int -mop_stats (call_frame_t *frame, xlator_t *bound_xl, - gf_hdr_common_t *hdr, size_t hdrlen, - struct iobuf *iobuf) -{ - int32_t flag = 0; - gf_mop_stats_req_t *req = NULL; - - req = gf_param (hdr); - - flag = ntoh32 (req->flags); - - STACK_WIND (frame, server_mop_stats_cbk, - bound_xl, - bound_xl->mops->stats, - flag); - - return 0; -} - int mop_ping (call_frame_t *frame, xlator_t *bound_xl, @@ -6244,7 +5801,6 @@ static gf_op_t gf_fops[] = { [GF_FOP_FSETXATTR] = server_fsetxattr, [GF_FOP_REMOVEXATTR] = server_removexattr, [GF_FOP_OPENDIR] = server_opendir, - [GF_FOP_GETDENTS] = server_getdents, [GF_FOP_FSYNCDIR] = server_fsyncdir, [GF_FOP_ACCESS] = server_access, [GF_FOP_CREATE] = server_create, @@ -6252,7 +5808,6 @@ static gf_op_t gf_fops[] = { [GF_FOP_FSTAT] = server_fstat, [GF_FOP_LK] = server_lk, [GF_FOP_LOOKUP] = server_lookup, - [GF_FOP_SETDENTS] = server_setdents, [GF_FOP_READDIR] = server_readdir, [GF_FOP_READDIRP] = server_readdirp, [GF_FOP_INODELK] = server_inodelk, @@ -6272,7 +5827,6 @@ static gf_op_t gf_fops[] = { static gf_op_t gf_mops[] = { [GF_MOP_SETVOLUME] = mop_setvolume, [GF_MOP_GETVOLUME] = mop_getvolume, - [GF_MOP_STATS] = mop_stats, [GF_MOP_GETSPEC] = mop_getspec, [GF_MOP_PING] = mop_ping, [GF_MOP_LOG] = mop_log, diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 64704c5d440..22e03304ff2 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -955,16 +955,6 @@ posix_opendir (call_frame_t *frame, xlator_t *this, return 0; } - -int -posix_getdents (call_frame_t *frame, xlator_t *this, - fd_t *fd, size_t size, off_t off, int32_t flag) -{ - STACK_UNWIND_STRICT (getdents, frame, -1, ENOSYS, NULL, 0); - return 0; -} - - int32_t posix_releasedir (xlator_t *this, fd_t *fd) @@ -2132,7 +2122,7 @@ posix_create (call_frame_t *frame, xlator_t *this, LOCK (&priv->lock); { - priv->stats.nr_files++; + priv->nr_files++; } UNLOCK (&priv->lock); @@ -2248,7 +2238,7 @@ posix_open (call_frame_t *frame, xlator_t *this, LOCK (&priv->lock); { - priv->stats.nr_files++; + priv->nr_files++; } UNLOCK (&priv->lock); @@ -2346,7 +2336,6 @@ posix_readv (call_frame_t *frame, xlator_t *this, LOCK (&priv->lock); { priv->read_value += op_ret; - priv->interval_read += op_ret; } UNLOCK (&priv->lock); @@ -2514,7 +2503,6 @@ posix_writev (call_frame_t *frame, xlator_t *this, LOCK (&priv->lock); { priv->write_value += op_ret; - priv->interval_write += op_ret; } UNLOCK (&priv->lock); @@ -2680,7 +2668,7 @@ posix_release (xlator_t *this, LOCK (&priv->lock); { - priv->stats.nr_files--; + priv->nr_files--; } UNLOCK (&priv->lock); @@ -3793,17 +3781,6 @@ posix_ftruncate (call_frame_t *frame, xlator_t *this, } -int -posix_setdents (call_frame_t *frame, xlator_t *this, - fd_t *fd, int32_t flags, dir_entry_t *entries, - int32_t count) -{ - - STACK_UNWIND_STRICT (setdents, frame, -1, ENOSYS); - return 0; -} - - int32_t posix_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd) @@ -4110,107 +4087,6 @@ posix_readdirp (call_frame_t *frame, xlator_t *this, int32_t -posix_stats (call_frame_t *frame, xlator_t *this, - int32_t flags) - -{ - int32_t op_ret = -1; - int32_t op_errno = 0; - - struct xlator_stats xlstats = {0, }; - struct xlator_stats * stats = NULL; - struct statvfs buf = {0,}; - struct timeval tv = {0,}; - struct posix_private * priv = (struct posix_private *)this->private; - - int64_t avg_read = 0; - int64_t avg_write = 0; - int64_t _time_ms = 0; - - DECLARE_OLD_FS_ID_VAR; - - SET_FS_ID (frame->root->uid, frame->root->gid); - - VALIDATE_OR_GOTO (frame, out); - VALIDATE_OR_GOTO (this, out); - - stats = &xlstats; - - op_ret = statvfs (priv->base_path, &buf); - - if (op_ret == -1) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, "statvfs failed: %s", - strerror (op_errno)); - goto out; - } - - /* client info is maintained at FSd */ - stats->nr_clients = priv->stats.nr_clients; - stats->nr_files = priv->stats.nr_files; - - /* number of free block in the filesystem. */ - stats->free_disk = buf.f_bfree * buf.f_bsize; - - stats->total_disk_size = buf.f_blocks * buf.f_bsize; - stats->disk_usage = (buf.f_blocks - buf.f_bavail) * buf.f_bsize; - - /* Calculate read and write usage */ - op_ret = gettimeofday (&tv, NULL); - if (op_ret == -1) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, - "gettimeofday failed: %s", strerror (errno)); - goto out; - } - - LOCK (&priv->lock); - { - /* Read */ - _time_ms = (tv.tv_sec - priv->init_time.tv_sec) * 1000 + - ((tv.tv_usec - priv->init_time.tv_usec) / 1000); - - avg_read = (_time_ms) ? (priv->read_value / _time_ms) : 0; /* KBps */ - avg_write = (_time_ms) ? (priv->write_value / _time_ms) : 0; /* KBps */ - - _time_ms = (tv.tv_sec - priv->prev_fetch_time.tv_sec) * 1000 + - ((tv.tv_usec - priv->prev_fetch_time.tv_usec) / 1000); - - if (_time_ms && ((priv->interval_read / _time_ms) > priv->max_read)) { - priv->max_read = (priv->interval_read / _time_ms); - } - - if (_time_ms && - ((priv->interval_write / _time_ms) > priv->max_write)) { - priv->max_write = priv->interval_write / _time_ms; - } - - stats->read_usage = avg_read / priv->max_read; - stats->write_usage = avg_write / priv->max_write; - } - UNLOCK (&priv->lock); - - op_ret = gettimeofday (&(priv->prev_fetch_time), NULL); - if (op_ret == -1) { - op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, "gettimeofday failed: %s", - strerror (op_errno)); - goto out; - } - - priv->interval_read = 0; - priv->interval_write = 0; - - op_ret = 0; - - out: - SET_TO_OLD_FS_ID (); - - STACK_UNWIND (frame, op_ret, op_errno, stats); - return 0; -} - -int32_t posix_checksum (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flag) { @@ -4306,11 +4182,11 @@ posix_priv (xlator_t *this) gf_proc_dump_build_key(key, key_prefix, "base_path_length"); gf_proc_dump_write(key,"%d", priv->base_path_length); gf_proc_dump_build_key(key, key_prefix, "max_read"); - gf_proc_dump_write(key,"%d", priv->max_read); + gf_proc_dump_write(key,"%d", priv->read_value); gf_proc_dump_build_key(key, key_prefix, "max_write"); - gf_proc_dump_write(key,"%d", priv->max_write); - gf_proc_dump_build_key(key, key_prefix, "stats.nr_files"); - gf_proc_dump_write(key,"%ld", priv->stats.nr_files); + gf_proc_dump_write(key,"%d", priv->write_value); + gf_proc_dump_build_key(key, key_prefix, "nr_files"); + gf_proc_dump_write(key,"%ld", priv->nr_files); return 0; } @@ -4533,14 +4409,6 @@ init (xlator_t *this) "could not find hostname (%s)", strerror (errno)); } - { - /* Stats related variables */ - gettimeofday (&_private->init_time, NULL); - gettimeofday (&_private->prev_fetch_time, NULL); - _private->max_read = 1; - _private->max_write = 1; - } - _private->export_statfs = 1; tmp_data = dict_get (this->options, "export-statfs-size"); if (tmp_data) { @@ -4684,7 +4552,6 @@ struct xlator_dumpops dumpops = { }; struct xlator_mops mops = { - .stats = posix_stats, }; struct xlator_fops fops = { @@ -4723,8 +4590,6 @@ struct xlator_fops fops = { .finodelk = posix_finodelk, .entrylk = posix_entrylk, .fentrylk = posix_fentrylk, - .setdents = posix_setdents, - .getdents = posix_getdents, .checksum = posix_checksum, .rchecksum = posix_rchecksum, .xattrop = posix_xattrop, diff --git a/xlators/storage/posix/src/posix.h b/xlators/storage/posix/src/posix.h index f92e256fbc0..6146c37055f 100644 --- a/xlators/storage/posix/src/posix.h +++ b/xlators/storage/posix/src/posix.h @@ -73,8 +73,7 @@ struct posix_private { char hostname[256]; /* Statistics, provides activity of the server */ - struct xlator_stats stats; - + struct timeval prev_fetch_time; struct timeval init_time; @@ -84,13 +83,9 @@ struct posix_private { pthread_cond_t janitor_cond; pthread_mutex_t janitor_lock; - int32_t max_read; /* */ - int32_t max_write; /* */ - int64_t interval_read; /* Used to calculate the max_read value */ - int64_t interval_write; /* Used to calculate the max_write value */ int64_t read_value; /* Total read, from init */ int64_t write_value; /* Total write, from init */ - + int64_t nr_files; /* In some cases, two exported volumes may reside on the same partition on the server. Sending statvfs info for both |