summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient-internals.h
Commit message (Collapse)AuthorAgeFilesLines
* libglusterfsclient: Bind fd on fd creation code pathsShehjar Tikoo2009-07-311-0/+1
| | | | | | | | | | | | | | When an fd_t is fd_create'd, we need to call fd_bind on it to ensure that any fd_lookup on the inode gets us this fd. We're not doing this so translators like write-behind were not able to order path-based requests at all resulting in some fops like stat, which could be issued after a writev, overtaking a previous writev which is still being written-behind. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 179 (fileop reports miscompares on read tests) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=179
* libglusterfsclient: Use iobufs for storing application write dataShehjar Tikoo2009-07-301-0/+1
| | | | | | | | | | | | | | | | | | | | | Till now we've been creating an iovec, storing references in it to the application data and simply passing it on to the translator tree. This means that the buffer being passed to the translators is not at all associated with the memory ref'd by the iobref argument to write fop. This is a problem when write-behind is a translator in the tree since it assumes that the memory in the iovecs passed to write fops is already refcounted by the iobref and so it simply copies the address of the application data. The problem is that the application can continue using this buffer, free it or over-write it destroying the data that write-behind may write at a later time. The solution involves copying the application's write buffer into an iobuf which will be referred to by the iobref. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 178 (libglusterfsclient: Data corruption on using write-behind in translator tree) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=178
* libglusterfsclient: Fake a fsid for every VMPShehjar Tikoo2009-07-201-0/+4
| | | | | | | | | | | | This is needed to work around the replicate behaviour of possibly returning device number for the same file from different subvolumes. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 148 (replicate: Returns st_dev from different subvols resulting in ESTALE thru unfs3booster) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=148
* libglusterfsclient: Invalidate not update iattr cache on writevShehjar Tikoo2009-07-171-0/+2
| | | | | | | Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 149 (libglusterfsclient interacts incorrectly with write-behind on writev) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=149
* libglusterfsclient: Update attr cache on read/writeShehjar Tikoo2009-07-071-1/+3
| | | | | | | | | | | We werent updating the attr AKA stat cache on read and write on files so every stat on the file before the timeout was returning stale attr from the cache. Yuck! This fixes it. Turns out there is a good aspect of unfs3's notoriety when it comes to doing stat()s for every operation. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
* libglusterfsclient: update offset in glusterfs_read_async_cbk only if offset ↵Raghavendra G2009-06-111-0/+1
| | | | | | | | | | stored in fd_ctx is used. - this helps in implementing sendfile(2). manpage says that "If offset is not NULL, then sendfile() does not modify the current file offset of in_fd" Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
* libglusterfsclient: Avoid dirent copies in readdir cbkShehjar Tikoo2009-06-081-0/+5
| | | | | | | | | We can avoid memory allocation, de-allocation and data copies by just using the entries passed to us from a lower layer and by de-linking the entries from the original list. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
* libglusterfsclient: Add dirent pre-fetching and cachingShehjar Tikoo2009-06-031-0/+30
| | | | | | | | | | | | | | The fop interface is such that we're able to extract more than 1 dirent in a readdir fop. This commit now enables libglusterfsclient to read multiple entries on a glusterfs_readdir call. Once these have been pre-fetched, they're cached till either glusterfs_closedir ,glusterfs_rewinddir or glusterfs_seekdir are called. The current implementation is beneficial for sequential directory reading and probably indifferent to applications that do a lot of seekdir and rewinddir after opening the directory. This is because both these calls result in dirent cache invalidation. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
* libglusterfsclient: Simplify inode and stat cachingShehjar Tikoo2009-06-031-0/+13
| | | | | | | | | There is a mechanism for caching the inode numbers got from a lookup and a struct stat got from a stat or fstat but I wasnt sure if it worked. This commit simplifies cache updates and checks and the accompanying tests have made sure that the cache does work. Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
* libglusterfsclient: Revert and re-do readdir conformanceShehjar Tikoo2009-05-181-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit basically reverts the previous readdir conformance patch I sent a few days back. That commit had a completely retarded and broken way of maintaining per-directory dirent. It was broken for two reasons: 1. Creating a wrapper structure around the directory's fd_t only for storing a struct dirent is not clean enough. This commit takes a better approach by storing the dirent in fd_t context. This dirent is valid only if the fd_t refers to a directory. 2. That commit was made and tested under the assumption (..stupidity is a better word..) that only opendir call is used for opening a directory. That is not correct. Directories are also opened using the open syscall. The point is, glusterfs_open returns an fd_t and so did glusterfs_opendir. The previous patch actually changed opendir to return a new wrapper structure. That is fine, if we go by the POSIX definition of open and opendir because, they're both supposed to return different types, an int and a DIR*. However, in libglusterfsclient, all other code assumes that directory handles corresponding to DIR* and file descriptors corresponding to int types are the same type, resulting in use of the same locking and fd context addition/extraction code. So a directory opened using opendir returned a wrapper structure which went down into the libglusterfsclient stack where some function called a lock on the handle assuming it was an fd_t, since it is not and dereferencing of the supposed fd->inode->lock results in a seg fault. Obviously, this didnt show up till unfs3 used open() to open a directory and not opendir. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Improve readdir conformance on re-entrancyShehjar Tikoo2009-05-061-0/+13
| | | | | | | | | | | readdir is supposed to be non-re-entrant only with respect to the given dir stream, not the whole process. What that means is the static struct dirent that we maintain in libglusterfsclient should be per-directory handle and not process-wide. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Add virtual mount point supportShehjar Tikoo2009-04-211-0/+11
| | | | | | | | | | | | | | | | | | | | | One part of the glusterfsclient library requires users to use a handle to address a particular glusterfs context. This can become cumbersome for applications that need to use multiple such context. For such applications, we make it easy by letting them define virtual mount points(VMPs), which are just paths that identify a particular glusterfs context. This is done through a new glusterfs_mount(..) interface. Subsequenly, any path based operations, that pre-pend a VMP before the files and directories inside the glusterfsd export, get internally routed to the correct glusterfs context. This helps users do away with the need to maintain their own path-to-glusterfs_handle_t mapping. The old handle-based interface still exists for whoever wishes to use it. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient: Create and use LIBGF_REPLY_NOTIFY macroShehjar Tikoo2009-04-171-0/+11
| | | | | | | All reply notifications can now be abstracted away through this macro and all cbk functions should now call this. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* updated libglusterfsclient with IOBUF/IOBREFsAnand V. Avati2009-04-121-4/+0
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient - move lookup timeout related code to ↵Raghavendra G2009-04-031-1/+46
| | | | | | | | | | libgf_client_path_lookup - this simplifies the resolution of path to inode, the apis which receive path as argument just need to call libgf_client_path_lookup for path->inode translation. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient - fix indentationRaghavendra G2009-04-031-4/+8
| | | | Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient - change implementation of glusterfs_getRaghavendra G2009-04-031-1/+2
| | | | | | - remove redundent lookups happening in glusterfs_get. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* libglusterfsclient code changesRaghavendra G2009-04-031-0/+21
| | | | | | | | | | | | - add dentry support to libglusterfsclient. - changes related to using array, to store context in inode instead of dictionary. - code changes related to cleanup of libglusterfsclient interface. - added glusterfs_mkdir and glusterfs_rmdir - other changes in libglusterfsclient to make it work with code changes in other parts of glusterfs. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* updated copyright header to extend copyright upto 2009Basavanagowda Kanur2009-02-261-1/+1
| | | | | | updated copyright header to include 2009. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
* Added all filesVikas Gorur2009-02-181-0/+144