summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/Makefile.am4
-rw-r--r--libglusterfs/src/compat.c55
-rw-r--r--libglusterfs/src/compat.h21
-rw-r--r--libglusterfs/src/syscall.c432
-rw-r--r--libglusterfs/src/syscall.h148
-rw-r--r--xlators/cluster/unify/src/unify.c25
-rw-r--r--xlators/performance/io-threads/src/io-threads.c455
-rw-r--r--xlators/performance/io-threads/src/io-threads.h38
-rw-r--r--xlators/storage/posix/src/posix.c48
9 files changed, 812 insertions, 414 deletions
diff --git a/libglusterfs/src/Makefile.am b/libglusterfs/src/Makefile.am
index 16e6717de9e..982c4d69de9 100644
--- a/libglusterfs/src/Makefile.am
+++ b/libglusterfs/src/Makefile.am
@@ -6,9 +6,9 @@ libglusterfs_la_LIBADD = @LEXLIB@
lib_LTLIBRARIES = libglusterfs.la
-libglusterfs_la_SOURCES = dict.c spec.lex.c y.tab.c xlator.c logging.c hashfn.c defaults.c scheduler.c common-utils.c transport.c timer.c inode.c call-stub.c compat.c authenticate.c fd.c compat-errno.c event.c mem-pool.c gf-dirent.c
+libglusterfs_la_SOURCES = dict.c spec.lex.c y.tab.c xlator.c logging.c hashfn.c defaults.c scheduler.c common-utils.c transport.c timer.c inode.c call-stub.c compat.c authenticate.c fd.c compat-errno.c event.c mem-pool.c gf-dirent.c syscall.c
-noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h logging.h protocol.h scheduler.h xlator.h transport.h stack.h timer.h list.h inode.h call-stub.h compat.h authenticate.h fd.h revision.h compat-errno.h event.h mem-pool.h byte-order.h gf-dirent.h locking.h
+noinst_HEADERS = common-utils.h defaults.h dict.h glusterfs.h hashfn.h logging.h protocol.h scheduler.h xlator.h transport.h stack.h timer.h list.h inode.h call-stub.h compat.h authenticate.h fd.h revision.h compat-errno.h event.h mem-pool.h byte-order.h gf-dirent.h locking.h syscall.h
EXTRA_DIST = spec.l spec.y
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c
index f0bd9119c7c..bad62b563d5 100644
--- a/libglusterfs/src/compat.c
+++ b/libglusterfs/src/compat.c
@@ -264,6 +264,61 @@ solaris_listxattr(const char *path,
return len;
}
+
+int
+solaris_flistxattr(int fd,
+ char *list,
+ size_t size)
+{
+ int attrdirfd = -1;
+ ssize_t len = 0;
+ DIR *dirptr = NULL;
+ struct dirent *dent = NULL;
+ int newfd = -1;
+
+ attrdirfd = openat (fd, ".", O_RDONLY, 0);
+ if (attrdirfd >= 0) {
+ newfd = dup(attrdirfd);
+ dirptr = fdopendir(newfd);
+ if (dirptr) {
+ while ((dent = readdir(dirptr))) {
+ size_t listlen = strlen(dent->d_name);
+ if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
+ /* we don't want "." and ".." here */
+ continue;
+ }
+ if (size == 0) {
+ /* return the current size of the list of extended attribute names*/
+ len += listlen + 1;
+ } else {
+ /* check size and copy entrie + nul into list. */
+ if ((len + listlen + 1) > size) {
+ errno = ERANGE;
+ len = -1;
+ break;
+ } else {
+ strncpy(list + len, dent->d_name, listlen);
+ len += listlen;
+ list[len] = '\0';
+ ++len;
+ }
+ }
+ }
+
+ if (closedir(dirptr) == -1) {
+ close (attrdirfd);
+ return -1;
+ }
+ } else {
+ close (attrdirfd);
+ return -1;
+ }
+ close (attrdirfd);
+ }
+ return len;
+}
+
+
int
solaris_removexattr(const char *path,
const char* key)
diff --git a/libglusterfs/src/compat.h b/libglusterfs/src/compat.h
index 67f8138b1df..42d2fa1419e 100644
--- a/libglusterfs/src/compat.h
+++ b/libglusterfs/src/compat.h
@@ -107,14 +107,6 @@ enum {
# endif
# endif
-#define lremovexattr(path,key) extattr_delete_link(path, EXTATTR_NAMESPACE_USER, key)
-#define llistxattr(path,key,size) extattr_list_link(path, EXTATTR_NAMESPACE_USER, key, size)
-#define lgetxattr(path, key, value, size) extattr_get_link(path, EXTATTR_NAMESPACE_USER, key, value, size)
-#define lsetxattr(path,key,value,size,flags) extattr_set_link(path, EXTATTR_NAMESPACE_USER, key, value, size)
-#define fgetxattr(fd,key,value,size) extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, key, value, size)
-#define fsetxattr(fd,key,value,size,flag) extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, key, value, size)
-
-
#define F_GETLK64 F_GETLK
#define F_SETLK64 F_SETLK
#define F_SETLKW64 F_SETLKW
@@ -168,13 +160,6 @@ enum {
# endif
# endif
-#define llistxattr(path,key,size) listxattr(path,key,size,XATTR_NOFOLLOW)
-#define lgetxattr(path,key,value,size) getxattr(path,key,value,size,0,XATTR_NOFOLLOW)
-#define lsetxattr(path,key,value,size,flags) setxattr(path,key,value,size,0,flags|XATTR_NOFOLLOW)
-#define lremovexattr(path,key) removexattr(path,key,XATTR_NOFOLLOW)
-#define fgetxattr(path,key,value,size) fgetxattr(path,key,value,size,0,0)
-#define fsetxattr(path,key,value,size,flag) fsetxattr(path,key,value,size,0,flag)
-
#define F_GETLK64 F_GETLK
#define F_SETLK64 F_SETLK
#define F_SETLKW64 F_SETLKW
@@ -231,12 +216,6 @@ enum {
#define s6_addr32 _S6_un._S6_u32
#endif
-#define lremovexattr(path,key) solaris_removexattr(path,key)
-#define llistxattr(path,key,size) solaris_listxattr(path,key,size)
-#define lgetxattr(path,key,value,size) solaris_getxattr(path,key,value,size)
-#define lsetxattr(path,key,value,size,flags) solaris_setxattr(path,key,value,size,flags)
-#define fgetxattr(fd,key,value,size) solaris_fgetxattr(fd,key,value,size)
-#define fsetxattr(fd,key,value,size,flags) solaris_fsetxattr(fd,key,value,size,flags)
#define lutimes(filename,times) utimes(filename,times)
int asprintf(char **string_ptr, const char *format, ...);
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
new file mode 100644
index 00000000000..f8e8c939a77
--- /dev/null
+++ b/libglusterfs/src/syscall.c
@@ -0,0 +1,432 @@
+/*
+ Copyright (c) 2009 Z RESEARCH, Inc. <http://www.zresearch.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#include "compat.h"
+#include "syscall.h"
+
+#include <sys/types.h>
+#include <utime.h>
+#include <sys/time.h>
+
+int
+sys_lstat (const char *path, struct stat *buf)
+{
+ return lstat (path, buf);
+}
+
+
+int
+sys_stat (const char *path, struct stat *buf)
+{
+ return stat (path, buf);
+}
+
+
+int
+sys_fstat (int fd, struct stat *buf)
+{
+ return fstat (fd, buf);
+}
+
+
+DIR *
+sys_opendir (const char *name)
+{
+ return opendir (name);
+}
+
+
+struct dirent *
+sys_readdir (DIR *dir)
+{
+ return readdir (dir);
+}
+
+
+ssize_t
+sys_readlink (const char *path, char *buf, size_t bufsiz)
+{
+ return readlink (path, buf, bufsiz);
+}
+
+
+int
+sys_closedir (DIR *dir)
+{
+ return closedir (dir);
+}
+
+
+int
+sys_mknod (const char *pathname, mode_t mode, dev_t dev)
+{
+ return mknod (pathname, mode, dev);
+}
+
+
+int
+sys_mkdir (const char *pathname, mode_t mode)
+{
+ return mkdir (pathname, mode);
+}
+
+
+int
+sys_unlink (const char *pathname)
+{
+ return unlink (pathname);
+}
+
+
+int
+sys_rmdir (const char *pathname)
+{
+ return rmdir (pathname);
+}
+
+
+int
+sys_symlink (const char *oldpath, const char *newpath)
+{
+ return symlink (oldpath, newpath);
+}
+
+
+int
+sys_rename (const char *oldpath, const char *newpath)
+{
+ return rename (oldpath, newpath);
+}
+
+
+int
+sys_link (const char *oldpath, const char *newpath)
+{
+ return link (oldpath, newpath);
+}
+
+
+int
+sys_chmod (const char *path, mode_t mode)
+{
+ return chmod (path, mode);
+}
+
+
+int
+sys_fchmod (int fd, mode_t mode)
+{
+ return fchmod (fd, mode);
+}
+
+
+int
+sys_chown (const char *path, uid_t owner, gid_t group)
+{
+ return chown (path, owner, group);
+}
+
+
+int
+sys_fchown (int fd, uid_t owner, gid_t group)
+{
+ return fchown (fd, owner, group);
+}
+
+
+int
+sys_lchown (const char *path, uid_t owner, gid_t group)
+{
+ return lchown (path, owner, group);
+}
+
+
+int
+sys_truncate (const char *path, off_t length)
+{
+ return truncate (path, length);
+}
+
+
+int
+sys_ftruncate (int fd, off_t length)
+{
+ return ftruncate (fd, length);
+}
+
+
+int
+sys_utimes (const char *filename, const struct timeval times[2])
+{
+ return utimes (filename, times);
+}
+
+
+int
+sys_creat (const char *pathname, mode_t mode)
+{
+ return creat (pathname, mode);
+}
+
+
+ssize_t
+sys_readv (int fd, const struct iovec *iov, int iovcnt)
+{
+ return readv (fd, iov, iovcnt);
+}
+
+
+ssize_t
+sys_writev (int fd, const struct iovec *iov, int iovcnt)
+{
+ return writev (fd, iov, iovcnt);
+}
+
+
+ssize_t
+sys_read (int fd, void *buf, size_t count)
+{
+ return read (fd, buf, count);
+}
+
+
+ssize_t
+sys_write (int fd, const void *buf, size_t count)
+{
+ return write (fd, buf, count);
+}
+
+
+off_t
+sys_lseek (int fd, off_t offset, int whence)
+{
+ return lseek (fd, offset, whence);
+}
+
+
+int
+sys_statvfs (const char *path, struct statvfs *buf)
+{
+ return statvfs (path, buf);
+}
+
+
+int
+sys_close (int fd)
+{
+ return close (fd);
+}
+
+
+int
+sys_fsync (int fd)
+{
+ return fsync (fd);
+}
+
+
+int
+sys_fdatasync (int fd)
+{
+#ifdef HAVE_FDATASYNC
+ return fdatasync (fd);
+#else
+ return 0;
+#endif
+}
+
+
+int
+sys_lsetxattr (const char *path, const char *name, const void *value,
+ size_t size, int flags)
+{
+
+#ifdef GF_LINUX_HOST_OS
+ return lsetxattr (path, name, value, size, flags);
+#endif
+
+#ifdef GF_BSD_HOST_OS
+ return extattr_set_link (path, EXTATTR_NAMESPACE_USER,
+ name, value, size);
+#endif
+
+#ifdef GF_SOLARIS_HOST_OS
+ return solaris_setxattr (path, name, value, size, flags);
+#endif
+
+#ifdef GF_DARWIN_HOST_OS
+ return setxattr (path, name, value, size, 0,
+ flags|XATTR_NOFOLLOW);
+#endif
+
+}
+
+
+ssize_t
+sys_llistxattr (const char *path, char *list, size_t size)
+{
+
+#ifdef GF_LINUX_HOST_OS
+ return llistxattr (path, list, size);
+#endif
+
+#ifdef GF_BSD_HOST_OS
+ return extattr_list_link (path, EXTATTR_NAMESPACE_USER, list, size);
+#endif
+
+#ifdef GF_SOLARIS_HOST_OS
+ return solaris_listxattr (path, list, size);
+#endif
+
+#ifdef GF_DARWIN_HOST_OS
+ return listxattr (path, list, size, XATTR_NOFOLLOW);
+#endif
+
+}
+
+
+ssize_t
+sys_lgetxattr (const char *path, const char *name, void *value, size_t size)
+{
+
+#ifdef GF_LINUX_HOST_OS
+ return lgetxattr (path, name, value, size);
+#endif
+
+#ifdef GF_BSD_HOST_OS
+ return extattr_get_link (path, EXTATTR_NAMESPACE_USER, name, value,
+ size);
+#endif
+
+#ifdef GF_SOLARIS_HOST_OS
+ return solaris_getxattr (path, name, value, size);
+#endif
+
+#ifdef GF_DARWIN_HOST_OS
+ return getxattr (path, name, value, size, 0, XATTR_NOFOLLOW);
+#endif
+
+}
+
+
+ssize_t
+sys_fgetxattr (int filedes, const char *name, void *value, size_t size)
+{
+
+#ifdef GF_LINUX_HOST_OS
+ return fgetxattr (filedes, name, value, size);
+#endif
+
+#ifdef GF_BSD_HOST_OS
+ return extattr_get_fd (filedes, EXTATTR_NAMESPACE_USER, name,
+ value, size);
+#endif
+
+#ifdef GF_SOLARIS_HOST_OS
+ return solaris_fgetxattr (filedes, name, value, size);
+#endif
+
+#ifdef GF_DARWIN_HOST_OS
+ return fgetxattr (filedes, name, value, size, 0, 0);
+#endif
+
+}
+
+
+int
+sys_fsetxattr (int filedes, const char *name, const void *value,
+ size_t size, int flags)
+{
+
+#ifdef GF_LINUX_HOST_OS
+ return fsetxattr (filedes, name, value, size, flags);
+#endif
+
+#ifdef GF_BSD_HOST_OS
+ return extattr_set_fd (filedes, EXTATTR_NAMESPACE_USER, name,
+ value, size);
+#endif
+
+#ifdef GF_SOLARIS_HOST_OS
+ solaris_fsetxattr (filedes, name, value, size, flags);
+#endif
+
+#ifdef GF_DARWIN_HOST_OS
+ return fsetxattr (filedes, name, value, size, 0, flags);
+#endif
+
+}
+
+
+ssize_t
+sys_flistxattr (int filedes, char *list, size_t size)
+{
+
+#ifdef GF_LINUX_HOST_OS
+ return flistxattr (filedes, list, size);
+#endif
+
+#ifdef GF_BSD_HOST_OS
+ return extattr_list_fd (filedes, EXTATTR_NAMESPACE_USER, list, size);
+#endif
+
+#ifdef GF_SOLARIS_HOST_OS
+ return solaris_flistxattr (filedes, list, size);
+#endif
+
+#ifdef GF_DARWIN_HOST_OS
+ return flistxattr (filedes, list, size, XATTR_NOFOLLOW);
+#endif
+
+}
+
+
+int
+sys_lremovexattr (const char *path, const char *name)
+{
+
+#ifdef GF_LINUX_HOST_OS
+ return lremovexattr (path, name);
+#endif
+
+#ifdef GF_BSD_HOST_OS
+ return extattr_delete_link (path, EXTATTR_NAMESPACE_USER, name);
+#endif
+
+#ifdef GF_SOLARIS_HOST_OS
+ return solaris_removexattr (path, name);
+#endif
+
+#ifdef GF_DARWIN_HOST_OS
+ return removexattr (path, name, XATTR_NOFOLLOW);
+#endif
+
+}
+
+
+int
+sys_access (const char *pathname, int mode)
+{
+ return access (pathname, mode);
+}
diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h
new file mode 100644
index 00000000000..d9cbb8fd41a
--- /dev/null
+++ b/libglusterfs/src/syscall.h
@@ -0,0 +1,148 @@
+/*
+ Copyright (c) 2009 Z RESEARCH, Inc. <http://www.zresearch.com>
+ This file is part of GlusterFS.
+
+ GlusterFS is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ GlusterFS is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __SYSCALL_H__
+#define __SYSCALL_H__
+
+int
+sys_lstat (const char *path, struct stat *buf);
+
+int
+sys_stat (const char *path, struct stat *buf);
+
+int
+sys_fstat (int fd, struct stat *buf);
+
+DIR *
+sys_opendir (const char *name);
+
+struct dirent *
+sys_readdir (DIR *dir);
+
+ssize_t
+sys_readlink (const char *path, char *buf, size_t bufsiz);
+
+int
+sys_closedir (DIR *dir);
+
+int
+sys_mknod (const char *pathname, mode_t mode, dev_t dev);
+
+int
+sys_mkdir (const char *pathname, mode_t mode);
+
+int
+sys_unlink (const char *pathname);
+
+int
+sys_rmdir (const char *pathname);
+
+int
+sys_symlink (const char *oldpath, const char *newpath);
+
+int
+sys_rename (const char *oldpath, const char *newpath);
+
+int
+sys_link (const char *oldpath, const char *newpath);
+
+int
+sys_chmod (const char *path, mode_t mode);
+
+int
+sys_fchmod (int fd, mode_t mode);
+
+int
+sys_chown (const char *path, uid_t owner, gid_t group);
+
+int
+sys_fchown (int fd, uid_t owner, gid_t group);
+
+int
+sys_lchown (const char *path, uid_t owner, gid_t group);
+
+int
+sys_truncate (const char *path, off_t length);
+
+int
+sys_ftruncate (int fd, off_t length);
+
+int
+sys_utimes (const char *filename, const struct timeval times[2]);
+
+int
+sys_creat (const char *pathname, mode_t mode);
+
+ssize_t
+sys_readv (int fd, const struct iovec *iov, int iovcnt);
+
+ssize_t
+sys_writev (int fd, const struct iovec *iov, int iovcnt);
+
+ssize_t
+sys_read (int fd, void *buf, size_t count);
+
+ssize_t
+sys_write (int fd, const void *buf, size_t count);
+
+off_t
+sys_lseek (int fd, off_t offset, int whence);
+
+int
+sys_statvfs (const char *path, struct statvfs *buf);
+
+int
+sys_close (int fd);
+
+int
+sys_fsync (int fd);
+
+int
+sys_fdatasync (int fd);
+
+int
+sys_lsetxattr (const char *path, const char *name, const void *value,
+ size_t size, int flags);
+
+ssize_t
+sys_llistxattr (const char *path, char *list, size_t size);
+
+ssize_t
+sys_lgetxattr (const char *path, const char *name, void *value, size_t size);
+
+ssize_t
+sys_fgetxattr (int filedes, const char *name, void *value, size_t size);
+
+int
+sys_fsetxattr (int filedes, const char *name, const void *value,
+ size_t size, int flags);
+
+ssize_t
+sys_flistxattr (int filedes, char *list, size_t size);
+
+int
+sys_lremovexattr (const char *path, const char *name);
+
+int
+sys_access (const char *pathname, int mode);
+
+int
+sys_ftruncate (int fd, off_t length);
+
+#endif /* __SYSCALL_H__ */
diff --git a/xlators/cluster/unify/src/unify.c b/xlators/cluster/unify/src/unify.c
index 5122a006173..337cd46882e 100644
--- a/xlators/cluster/unify/src/unify.c
+++ b/xlators/cluster/unify/src/unify.c
@@ -522,6 +522,13 @@ unify_lookup_cbk (call_frame_t *frame,
zr_unify_self_heal (frame, this, local);
local_dict = NULL;
} else {
+ if (local->failed) {
+ /* NOTE: directory lookup is sent to all
+ * subvolumes and success from a subvolume
+ * might set local->op_ret to 0 (zero) */
+ local->op_ret = -1;
+ }
+
/* either no self heal, or op_ret == -1 (failure) */
tmp_inode = local->loc1.inode;
unify_local_wipe (local);
@@ -4075,6 +4082,23 @@ unify_xattrop (call_frame_t *frame, xlator_t *this,
return 0;
}
+int
+unify_forget (xlator_t *this,
+ inode_t *inode)
+{
+ int16_t *list = NULL;
+ uint64_t tmp_list = 0;
+
+ if (!S_ISDIR(inode->st_mode)) {
+ inode_ctx_get (inode, this, &tmp_list);
+ if (tmp_list) {
+ list = (int16_t *)(long)tmp_list;
+ FREE (list);
+ }
+ }
+
+ return 0;
+}
/**
* notify
@@ -4428,6 +4452,7 @@ struct xlator_mops mops = {
};
struct xlator_cbks cbks = {
+ .forget = unify_forget,
};
struct volume_options options[] = {
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 3d172f9b4fa..3bebb3185e4 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -36,21 +36,18 @@ iot_queue (iot_worker_t *worker,
static call_stub_t *
iot_dequeue (iot_worker_t *worker);
-static iot_worker_t *
+static void
iot_schedule (iot_conf_t *conf,
- iot_file_t *file,
- ino_t ino)
+ inode_t *inode,
+ call_stub_t *stub)
{
- int32_t cnt = (ino % conf->thread_count);
- iot_worker_t *trav = conf->workers.next;
+ int32_t idx = 0;
+ iot_worker_t *selected_worker = NULL;
- for (; cnt; cnt--)
- trav = trav->next;
-
- if (file)
- file->worker = trav;
- trav->fd_count++;
- return trav;
+ idx = (inode->ino % conf->thread_count);
+ selected_worker = conf->workers[idx];
+
+ iot_queue (selected_worker, stub);
}
int32_t
@@ -61,28 +58,22 @@ iot_open_cbk (call_frame_t *frame,
int32_t op_errno,
fd_t *fd)
{
- iot_conf_t *conf = this->private;
-
- if (op_ret >= 0) {
- iot_file_t *file = CALLOC (1, sizeof (*file));
- ERR_ABORT (file);
-
- iot_schedule (conf, file, fd->inode->ino);
- file->fd = fd;
-
- fd_ctx_set (fd, this, (uint64_t)(long)file);
-
- pthread_mutex_lock (&conf->files_lock);
- file->next = &conf->files;
- file->prev = file->next->prev;
- file->next->prev = file;
- file->prev->next = file;
- pthread_mutex_unlock (&conf->files_lock);
- }
STACK_UNWIND (frame, op_ret, op_errno, fd);
return 0;
}
+static int32_t
+iot_open_wrapper (call_frame_t * frame,
+ xlator_t * this,
+ loc_t *loc,
+ int32_t flags,
+ fd_t * fd)
+{
+ STACK_WIND (frame, iot_open_cbk, FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->open, loc, flags, fd);
+ return 0;
+}
+
int32_t
iot_open (call_frame_t *frame,
xlator_t *this,
@@ -90,13 +81,16 @@ iot_open (call_frame_t *frame,
int32_t flags,
fd_t *fd)
{
- STACK_WIND (frame,
- iot_open_cbk,
- FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->open,
- loc,
- flags,
- fd);
+ call_stub_t *stub = NULL;
+
+ stub = fop_open_stub (frame, iot_open_wrapper, loc, flags, fd);
+ if (!stub) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "cannot get open call stub");
+ STACK_UNWIND (frame, -1, ENOMEM, NULL, 0);
+ }
+ iot_schedule ((iot_conf_t *)this->private, loc->inode, stub);
+
return 0;
}
@@ -111,30 +105,12 @@ iot_create_cbk (call_frame_t *frame,
inode_t *inode,
struct stat *stbuf)
{
- iot_conf_t *conf = this->private;
-
- if (op_ret >= 0) {
- iot_file_t *file = CALLOC (1, sizeof (*file));
- ERR_ABORT (file);
-
- iot_schedule (conf, file, fd->inode->ino);
- file->fd = fd;
-
- fd_ctx_set (fd, this, (uint64_t)(long)file);
-
- pthread_mutex_lock (&conf->files_lock);
- file->next = &conf->files;
- file->prev = file->next->prev;
- file->next->prev = file;
- file->prev->next = file;
- pthread_mutex_unlock (&conf->files_lock);
- }
STACK_UNWIND (frame, op_ret, op_errno, fd, inode, stbuf);
return 0;
}
int32_t
-iot_create (call_frame_t *frame,
+iot_create_wrapper (call_frame_t *frame,
xlator_t *this,
loc_t *loc,
int32_t flags,
@@ -152,7 +128,26 @@ iot_create (call_frame_t *frame,
return 0;
}
+int32_t
+iot_create (call_frame_t *frame,
+ xlator_t *this,
+ loc_t *loc,
+ int32_t flags,
+ mode_t mode,
+ fd_t *fd)
+{
+ call_stub_t *stub = NULL;
+ stub = fop_create_stub (frame, iot_create_wrapper, loc, flags, mode,
+ fd);
+ if (!stub) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "cannot get create call stub");
+ STACK_UNWIND (frame, -1, ENOMEM, NULL, 0);
+ }
+ iot_schedule ((iot_conf_t *)this->private, loc->inode, stub);
+ return 0;
+}
int32_t
iot_readv_cbk (call_frame_t *frame,
@@ -164,10 +159,6 @@ iot_readv_cbk (call_frame_t *frame,
int32_t count,
struct stat *stbuf)
{
- iot_local_t *local = frame->local;
-
- local->frame_size = 0; //iov_length (vector, count);
-
STACK_UNWIND (frame, op_ret, op_errno, vector, count, stbuf);
return 0;
@@ -198,25 +189,6 @@ iot_readv (call_frame_t *frame,
off_t offset)
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_file_t *file = NULL;
- iot_worker_t *worker = NULL;
- uint64_t tmp_file = 0;
-
- if (fd_ctx_get (fd, this, &tmp_file)) {
- gf_log (this->name, GF_LOG_ERROR,
- "fd context is NULL, returning EBADFD");
- STACK_UNWIND (frame, -1, EBADFD);
- return 0;
- }
-
- file = (iot_file_t *)(long)tmp_file;
- worker = file->worker;
-
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
- frame->local = local;
-
stub = fop_readv_stub (frame,
iot_readv_wrapper,
fd,
@@ -229,8 +201,7 @@ iot_readv (call_frame_t *frame,
return 0;
}
- iot_queue (worker, stub);
-
+ iot_schedule ((iot_conf_t *)this->private, fd->inode, stub);
return 0;
}
@@ -264,26 +235,6 @@ iot_flush (call_frame_t *frame,
fd_t *fd)
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_file_t *file = NULL;
- iot_worker_t *worker = NULL;
- uint64_t tmp_file = 0;
-
- if (fd_ctx_get (fd, this, &tmp_file)) {
- gf_log (this->name, GF_LOG_ERROR,
- "fd context is NULL, returning EBADFD");
- STACK_UNWIND (frame, -1, EBADFD);
- return 0;
- }
-
- file = (iot_file_t *)(long)tmp_file;
- worker = file->worker;
-
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
-
- frame->local = local;
-
stub = fop_flush_stub (frame,
iot_flush_wrapper,
fd);
@@ -292,8 +243,8 @@ iot_flush (call_frame_t *frame,
STACK_UNWIND (frame, -1, ENOMEM);
return 0;
}
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, fd->inode, stub);
return 0;
}
@@ -330,26 +281,6 @@ iot_fsync (call_frame_t *frame,
int32_t datasync)
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_file_t *file = NULL;
- iot_worker_t *worker = NULL;
- uint64_t tmp_file = 0;
-
- if (fd_ctx_get (fd, this, &tmp_file)) {
- gf_log (this->name, GF_LOG_ERROR,
- "fd context is NULL, returning EBADFD");
- STACK_UNWIND (frame, -1, EBADFD);
- return 0;
- }
-
- file = (iot_file_t *)(long)tmp_file;
- worker = file->worker;
-
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
-
- frame->local = local;
-
stub = fop_fsync_stub (frame,
iot_fsync_wrapper,
fd,
@@ -359,8 +290,8 @@ iot_fsync (call_frame_t *frame,
STACK_UNWIND (frame, -1, ENOMEM);
return 0;
}
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, fd->inode, stub);
return 0;
}
@@ -372,10 +303,6 @@ iot_writev_cbk (call_frame_t *frame,
int32_t op_errno,
struct stat *stbuf)
{
- iot_local_t *local = frame->local;
-
- local->frame_size = 0; /* hehe, caught me! */
-
STACK_UNWIND (frame, op_ret, op_errno, stbuf);
return 0;
}
@@ -408,30 +335,6 @@ iot_writev (call_frame_t *frame,
off_t offset)
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_file_t *file = NULL;
- iot_worker_t *worker = NULL;
- uint64_t tmp_file = 0;
-
- if (fd_ctx_get (fd, this, &tmp_file)) {
- gf_log (this->name, GF_LOG_ERROR,
- "fd context is NULL, returning EBADFD");
- STACK_UNWIND (frame, -1, EBADFD);
- return 0;
- }
-
- file = (iot_file_t *)(long)tmp_file;
- worker = file->worker;
-
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
-
- if (frame->root->req_refs)
- local->frame_size = dict_serialized_length (frame->root->req_refs);
- else
- local->frame_size = iov_length (vector, count);
- frame->local = local;
-
stub = fop_writev_stub (frame, iot_writev_wrapper,
fd, vector, count, offset);
@@ -441,7 +344,7 @@ iot_writev (call_frame_t *frame,
return 0;
}
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, fd->inode, stub);
return 0;
}
@@ -486,25 +389,6 @@ iot_lk (call_frame_t *frame,
struct flock *flock)
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_file_t *file = NULL;
- iot_worker_t *worker = NULL;
- uint64_t tmp_file = 0;
-
- if (fd_ctx_get (fd, this, &tmp_file)) {
- gf_log (this->name, GF_LOG_ERROR,
- "fd context is NULL, returning EBADFD");
- STACK_UNWIND (frame, -1, EBADFD);
- return 0;
- }
-
- file = (iot_file_t *)(long)tmp_file;
- worker = file->worker;
-
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
- frame->local = local;
-
stub = fop_lk_stub (frame, iot_lk_wrapper,
fd, cmd, flock);
@@ -513,9 +397,8 @@ iot_lk (call_frame_t *frame,
STACK_UNWIND (frame, -1, ENOMEM, NULL);
return 0;
}
-
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, fd->inode, stub);
return 0;
}
@@ -552,17 +435,8 @@ iot_stat (call_frame_t *frame,
loc_t *loc)
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_worker_t *worker = NULL;
- iot_conf_t *conf;
fd_t *fd = NULL;
- conf = this->private;
-
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
- frame->local = local;
-
fd = fd_lookup (loc->inode, frame->root->pid);
if (fd == NULL) {
@@ -576,8 +450,6 @@ iot_stat (call_frame_t *frame,
fd_unref (fd);
- worker = iot_schedule (conf, NULL, loc->inode->ino);
-
stub = fop_stat_stub (frame,
iot_stat_wrapper,
loc);
@@ -586,7 +458,7 @@ iot_stat (call_frame_t *frame,
STACK_UNWIND (frame, -1, ENOMEM, NULL);
return 0;
}
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, loc->inode, stub);
return 0;
}
@@ -623,24 +495,6 @@ iot_fstat (call_frame_t *frame,
fd_t *fd)
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_file_t *file = NULL;
- iot_worker_t *worker = NULL;
- uint64_t tmp_file = 0;
-
- if (fd_ctx_get (fd, this, &tmp_file)) {
- gf_log (this->name, GF_LOG_ERROR,
- "fd context is NULL, returning EBADFD");
- STACK_UNWIND (frame, -1, EBADFD);
- return 0;
- }
-
- file = (iot_file_t *)(long)tmp_file;
- worker = file->worker;
-
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
- frame->local = local;
stub = fop_fstat_stub (frame,
iot_fstat_wrapper,
fd);
@@ -650,7 +504,7 @@ iot_fstat (call_frame_t *frame,
return 0;
}
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, fd->inode, stub);
return 0;
}
@@ -689,16 +543,8 @@ iot_truncate (call_frame_t *frame,
off_t offset)
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_worker_t *worker = NULL;
- iot_conf_t *conf;
fd_t *fd = NULL;
- conf = this->private;
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
- frame->local = local;
-
fd = fd_lookup (loc->inode, frame->root->pid);
if (fd == NULL) {
@@ -713,8 +559,6 @@ iot_truncate (call_frame_t *frame,
fd_unref (fd);
- worker = iot_schedule (conf, NULL, loc->inode->ino);
-
stub = fop_truncate_stub (frame,
iot_truncate_wrapper,
loc,
@@ -724,7 +568,7 @@ iot_truncate (call_frame_t *frame,
STACK_UNWIND (frame, -1, ENOMEM, NULL);
return 0;
}
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, loc->inode, stub);
return 0;
}
@@ -763,25 +607,6 @@ iot_ftruncate (call_frame_t *frame,
off_t offset)
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_file_t *file = NULL;
- iot_worker_t *worker = NULL;
- uint64_t tmp_file = 0;
-
- if (fd_ctx_get (fd, this, &tmp_file)) {
- gf_log (this->name, GF_LOG_ERROR,
- "fd context is NULL, returning EBADFD");
- STACK_UNWIND (frame, -1, EBADFD);
- return 0;
- }
-
- file = (iot_file_t *)(long)tmp_file;
- worker = file->worker;
-
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
- frame->local = local;
-
stub = fop_ftruncate_stub (frame,
iot_ftruncate_wrapper,
fd,
@@ -791,7 +616,7 @@ iot_ftruncate (call_frame_t *frame,
STACK_UNWIND (frame, -1, ENOMEM, NULL);
return 0;
}
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, fd->inode, stub);
return 0;
}
@@ -831,17 +656,8 @@ iot_utimens (call_frame_t *frame,
struct timespec tv[2])
{
call_stub_t *stub;
- iot_local_t *local = NULL;
- iot_worker_t *worker = NULL;
- iot_conf_t *conf;
fd_t *fd = NULL;
- conf = this->private;
-
- local = CALLOC (1, sizeof (*local));
- ERR_ABORT (local);
- frame->local = local;
-
fd = fd_lookup (loc->inode, frame->root->pid);
if (fd == NULL) {
@@ -856,8 +672,6 @@ iot_utimens (call_frame_t *frame,
fd_unref (fd);
- worker = iot_schedule (conf, NULL, loc->inode->ino);
-
stub = fop_utimens_stub (frame,
iot_utimens_wrapper,
loc,
@@ -867,7 +681,7 @@ iot_utimens (call_frame_t *frame,
STACK_UNWIND (frame, -1, ENOMEM, NULL);
return 0;
}
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, loc->inode, stub);
return 0;
}
@@ -909,16 +723,6 @@ iot_checksum (call_frame_t *frame,
int32_t flags)
{
call_stub_t *stub = NULL;
- iot_local_t *local = NULL;
- iot_worker_t *worker = NULL;
- iot_conf_t *conf = NULL;
-
- conf = this->private;
-
- local = CALLOC (1, sizeof (*local));
- frame->local = local;
-
- worker = iot_schedule (conf, NULL, conf->misc_thread_index++);
stub = fop_checksum_stub (frame,
iot_checksum_wrapper,
@@ -929,7 +733,7 @@ iot_checksum (call_frame_t *frame,
STACK_UNWIND (frame, -1, ENOMEM, NULL, NULL);
return 0;
}
- iot_queue (worker, stub);
+ iot_schedule ((iot_conf_t *)this->private, loc->inode, stub);
return 0;
}
@@ -966,52 +770,14 @@ iot_unlink (call_frame_t *frame,
loc_t *loc)
{
call_stub_t *stub = NULL;
- iot_local_t *local = NULL;
- iot_worker_t *worker = NULL;
- iot_conf_t *conf = NULL;
-
- conf = this->private;
-
- local = CALLOC (1, sizeof (*local));
- frame->local = local;
-
- worker = iot_schedule (conf, NULL, conf->misc_thread_index++);
-
stub = fop_unlink_stub (frame, iot_unlink_wrapper, loc);
if (!stub) {
gf_log (this->name, GF_LOG_ERROR, "cannot get fop_unlink call stub");
STACK_UNWIND (frame, -1, ENOMEM);
return 0;
}
- iot_queue (worker, stub);
-
- return 0;
-}
-
-int32_t
-iot_release (xlator_t *this,
- fd_t *fd)
-{
- iot_file_t *file = NULL;
- iot_conf_t *conf = NULL;
- uint64_t tmp_file = 0;
- int ret = 0;
-
- conf = this->private;
- ret = fd_ctx_del (fd, this, &tmp_file);
- if (ret)
- return 0;
-
- file = (iot_file_t *)(long)tmp_file;
-
- pthread_mutex_lock (&conf->files_lock);
- {
- (file->prev)->next = file->next;
- (file->next)->prev = file->prev;
- }
- pthread_mutex_unlock (&conf->files_lock);
+ iot_schedule ((iot_conf_t *)this->private, loc->inode, stub);
- FREE (file);
return 0;
}
@@ -1020,24 +786,18 @@ static void
iot_queue (iot_worker_t *worker,
call_stub_t *stub)
{
- iot_queue_t *queue;
+ iot_request_t *req = NULL;
- queue = CALLOC (1, sizeof (*queue));
- ERR_ABORT (queue);
- queue->stub = stub;
+ req = CALLOC (1, sizeof (iot_request_t));
+ ERR_ABORT (req);
+ req->stub = stub;
pthread_mutex_lock (&worker->qlock);
{
- queue->next = &worker->queue;
- queue->prev = worker->queue.prev;
-
- queue->next->prev = queue;
- queue->prev->next = queue;
+ list_add_tail (&req->list, &worker->rqlist);
/* dq_cond */
worker->queue_size++;
- worker->q++;
-
pthread_cond_broadcast (&worker->dq_cond);
}
pthread_mutex_unlock (&worker->qlock);
@@ -1047,25 +807,23 @@ static call_stub_t *
iot_dequeue (iot_worker_t *worker)
{
call_stub_t *stub = NULL;
- iot_queue_t *queue = NULL;
+ iot_request_t *req = NULL;
pthread_mutex_lock (&worker->qlock);
{
while (!worker->queue_size)
pthread_cond_wait (&worker->dq_cond, &worker->qlock);
- queue = worker->queue.next;
- queue->next->prev = queue->prev;
- queue->prev->next = queue->next;
-
- stub = queue->stub;
+ list_for_each_entry (req, &worker->rqlist, list)
+ break;
+ list_del (&req->list);
+ stub = req->stub;
worker->queue_size--;
- worker->dq++;
}
pthread_mutex_unlock (&worker->qlock);
- FREE (queue);
+ FREE (req);
return stub;
}
@@ -1083,35 +841,57 @@ iot_worker (void *arg)
}
}
-static void
-workers_init (iot_conf_t *conf)
+static iot_worker_t **
+allocate_worker_array (int count)
{
- int i;
+ iot_worker_t ** warr = NULL;
- conf->workers.next = &conf->workers;
- conf->workers.prev = &conf->workers;
+ warr = CALLOC (count, sizeof(iot_worker_t *));
+ ERR_ABORT (warr);
- for (i=0; i<conf->thread_count; i++) {
+ return warr;
+}
- iot_worker_t *worker = CALLOC (1, sizeof (*worker));
- ERR_ABORT (worker);
+static iot_worker_t *
+allocate_worker (iot_conf_t * conf)
+{
+ iot_worker_t *wrk = NULL;
- worker->next = &conf->workers;
- worker->prev = conf->workers.prev;
- worker->next->prev = worker;
- worker->prev->next = worker;
+ wrk = CALLOC (1, sizeof (iot_worker_t));
+ ERR_ABORT (wrk);
- worker->queue.next = &worker->queue;
- worker->queue.prev = &worker->queue;
+ INIT_LIST_HEAD (&wrk->rqlist);
+ wrk->conf = conf;
+ pthread_cond_init (&wrk->dq_cond, NULL);
+ pthread_mutex_init (&wrk->qlock, NULL);
- pthread_mutex_init (&worker->qlock, NULL);
- pthread_cond_init (&worker->dq_cond, NULL);
- worker->conf = conf;
+ return wrk;
+}
- pthread_create (&worker->thread, NULL, iot_worker, worker);
- }
+static void
+allocate_workers (iot_conf_t *conf,
+ int count,
+ int start_alloc_idx)
+{
+ int i, end_count;
+
+ end_count = count + start_alloc_idx;
+ for (i = start_alloc_idx; i < end_count; i++) {
+ conf->workers[i] = allocate_worker (conf);
+ pthread_create (&conf->workers[i]->thread, NULL, iot_worker,
+ conf->workers[i]);
+ }
}
+static void
+workers_init (iot_conf_t *conf)
+{
+ conf->workers = allocate_worker_array (conf->thread_count);
+ allocate_workers (conf, conf->thread_count, 0);
+}
+
+
+
int32_t
init (xlator_t *this)
{
@@ -1144,10 +924,6 @@ init (xlator_t *this)
conf->thread_count);
}
- conf->files.next = &conf->files;
- conf->files.prev = &conf->files;
- pthread_mutex_init (&conf->files_lock, NULL);
-
workers_init (conf);
this->private = conf;
@@ -1186,7 +962,6 @@ struct xlator_mops mops = {
};
struct xlator_cbks cbks = {
- .release = iot_release,
};
struct volume_options options[] = {
diff --git a/xlators/performance/io-threads/src/io-threads.h b/xlators/performance/io-threads/src/io-threads.h
index 7606d0625d5..7975529007a 100644
--- a/xlators/performance/io-threads/src/io-threads.h
+++ b/xlators/performance/io-threads/src/io-threads.h
@@ -32,59 +32,39 @@
#include "dict.h"
#include "xlator.h"
#include "common-utils.h"
+#include "list.h"
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
struct iot_conf;
struct iot_worker;
-struct iot_queue;
-struct iot_local;
-struct iot_file;
+struct iot_request;
-struct iot_local {
- struct iot_file *file;
- size_t frame_size;
-};
-
-struct iot_queue {
- struct iot_queue *next, *prev;
+struct iot_request {
+ struct list_head list; /* Attaches this request to the list of
+ requests.
+ */
call_stub_t *stub;
};
struct iot_worker {
- struct iot_worker *next, *prev;
- struct iot_queue queue;
+ struct list_head rqlist; /* List of requests assigned to me. */
struct iot_conf *conf;
int64_t q,dq;
pthread_cond_t dq_cond;
pthread_mutex_t qlock;
- int32_t fd_count;
int32_t queue_size;
pthread_t thread;
};
-struct iot_file {
- struct iot_file *next, *prev; /* all open files via this xlator */
- struct iot_worker *worker;
- fd_t *fd;
- int32_t pending_ops;
-};
-
struct iot_conf {
int32_t thread_count;
- int32_t misc_thread_index; /* Used to schedule the miscellaneous calls like checksum */
- struct iot_worker workers;
- struct iot_file files;
- pthread_mutex_t files_lock;
-
- pthread_cond_t q_cond;
+ struct iot_worker ** workers;
};
-typedef struct iot_file iot_file_t;
typedef struct iot_conf iot_conf_t;
-typedef struct iot_local iot_local_t;
typedef struct iot_worker iot_worker_t;
-typedef struct iot_queue iot_queue_t;
+typedef struct iot_request iot_request_t;
#endif /* __IOT_H */
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 657be1edc12..2848dbdc5f3 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -44,6 +44,7 @@
#include "compat-errno.h"
#include "compat.h"
#include "byte-order.h"
+#include "syscall.h"
#undef HAVE_SET_FSID
#ifdef HAVE_SET_FSID
@@ -163,12 +164,13 @@ _posix_xattr_get_set (dict_t *xattr_req,
ret = dict_set_uint32 (filler->xattr, key, 0);
}
} else {
- xattr_size = lgetxattr (filler->real_path, key, NULL, 0);
+ xattr_size = sys_lgetxattr (filler->real_path, key, NULL, 0);
if (xattr_size > 0) {
value = calloc (1, xattr_size + 1);
- lgetxattr (filler->real_path, key, value, xattr_size);
+ sys_lgetxattr (filler->real_path, key, value,
+ xattr_size);
value[xattr_size] = '\0';
ret = dict_set_bin (filler->xattr, key,
@@ -2044,8 +2046,9 @@ handle_pair (xlator_t *this, char *real_path,
if (ZR_FILE_CONTENT_REQUEST(trav->key)) {
ret = set_file_contents (this, real_path, trav, flags);
} else {
- sys_ret = lsetxattr (real_path, trav->key, trav->value->data,
- trav->value->len, flags);
+ sys_ret = sys_lsetxattr (real_path, trav->key,
+ trav->value->data,
+ trav->value->len, flags);
if (sys_ret < 0) {
if (errno == ENOTSUP) {
@@ -2243,7 +2246,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
- size = llistxattr (real_path, NULL, 0);
+ size = sys_llistxattr (real_path, NULL, 0);
if (size == -1) {
op_errno = errno;
if ((errno == ENOTSUP) || (errno == ENOSYS)) {
@@ -2270,7 +2273,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
- size = llistxattr (real_path, list, size);
+ size = sys_llistxattr (real_path, list, size);
remaining_size = size;
list_offset = 0;
@@ -2279,7 +2282,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
break;
strcpy (key, list + list_offset);
- op_ret = lgetxattr (real_path, key, NULL, 0);
+ op_ret = sys_lgetxattr (real_path, key, NULL, 0);
if (op_ret == -1)
break;
@@ -2290,7 +2293,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
- op_ret = lgetxattr (real_path, key, value, op_ret);
+ op_ret = sys_lgetxattr (real_path, key, value, op_ret);
if (op_ret == -1)
break;
@@ -2364,7 +2367,7 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
- size = flistxattr (_fd, NULL, 0);
+ size = sys_flistxattr (_fd, NULL, 0);
if (size == -1) {
op_errno = errno;
if ((errno == ENOTSUP) || (errno == ENOSYS)) {
@@ -2391,7 +2394,7 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
- size = flistxattr (_fd, list, size);
+ size = sys_flistxattr (_fd, list, size);
remaining_size = size;
list_offset = 0;
@@ -2400,7 +2403,7 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
break;
strcpy (key, list + list_offset);
- op_ret = fgetxattr (_fd, key, NULL, 0);
+ op_ret = sys_fgetxattr (_fd, key, NULL, 0);
if (op_ret == -1)
break;
@@ -2411,7 +2414,7 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
goto out;
}
- op_ret = fgetxattr (_fd, key, value, op_ret);
+ op_ret = sys_fgetxattr (_fd, key, value, op_ret);
if (op_ret == -1)
break;
@@ -2448,8 +2451,8 @@ fhandle_pair (xlator_t *this, int fd,
int sys_ret = -1;
int ret = 0;
- sys_ret = fsetxattr (fd, trav->key, trav->value->data,
- trav->value->len, flags);
+ sys_ret = sys_fsetxattr (fd, trav->key, trav->value->data,
+ trav->value->len, flags);
if (sys_ret < 0) {
if (errno == ENOTSUP) {
@@ -2554,7 +2557,7 @@ posix_removexattr (call_frame_t *frame, xlator_t *this,
SET_FS_ID (frame->root->uid, frame->root->gid);
- op_ret = lremovexattr (real_path, name);
+ op_ret = sys_lremovexattr (real_path, name);
if (op_ret == -1) {
op_errno = errno;
@@ -2674,8 +2677,8 @@ posix_xattrop (call_frame_t *frame, xlator_t *this,
count = trav->value->len / sizeof (int32_t);
array = CALLOC (count, sizeof (int32_t));
- size = lgetxattr (real_path, trav->key, (char *)array,
- trav->value->len);
+ size = sys_lgetxattr (real_path, trav->key, (char *)array,
+ trav->value->len);
op_errno = errno;
if ((size == -1) && (op_errno != ENODATA) &&
@@ -2709,8 +2712,8 @@ posix_xattrop (call_frame_t *frame, xlator_t *this,
goto out;
}
- size = lsetxattr (real_path, trav->key, array,
- trav->value->len, 0);
+ size = sys_lsetxattr (real_path, trav->key, array,
+ trav->value->len, 0);
op_errno = errno;
if (size == -1) {
@@ -2786,7 +2789,8 @@ posix_fxattrop (call_frame_t *frame, xlator_t *this,
count = trav->value->len / sizeof (int32_t);
array = CALLOC (count, sizeof (int32_t));
- size = fgetxattr (_fd, trav->key, (char *)array, trav->value->len);
+ size = sys_fgetxattr (_fd, trav->key, (char *)array,
+ trav->value->len);
op_errno = errno;
if ((size == -1) && ((op_errno != ENODATA) &&
@@ -2818,8 +2822,8 @@ posix_fxattrop (call_frame_t *frame, xlator_t *this,
goto out;
}
- size = fsetxattr (_fd, trav->key, (char *)array,
- trav->value->len, 0);
+ size = sys_fsetxattr (_fd, trav->key, (char *)array,
+ trav->value->len, 0);
op_errno = errno;
if (size == -1) {