]> err.no Git - linux-2.6/blobdiff - fs/fuse/dir.c
Use ilog2() in fs/namespace.c
[linux-2.6] / fs / fuse / dir.c
index 7b3df35cf19671880c507ddd6e2a9dcff0496239..80d2f5292cf91f490532e903c0e37795e705de15 100644 (file)
@@ -132,6 +132,21 @@ static void fuse_lookup_init(struct fuse_req *req, struct inode *dir,
        req->out.args[0].value = outarg;
 }
 
+static u64 fuse_get_attr_version(struct fuse_conn *fc)
+{
+       u64 curr_version;
+
+       /*
+        * The spin lock isn't actually needed on 64bit archs, but we
+        * don't yet care too much about such optimizations.
+        */
+       spin_lock(&fc->lock);
+       curr_version = fc->attr_version;
+       spin_unlock(&fc->lock);
+
+       return curr_version;
+}
+
 /*
  * Check whether the dentry is still valid
  *
@@ -171,9 +186,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
                        return 0;
                }
 
-               spin_lock(&fc->lock);
-               attr_version = fc->attr_version;
-               spin_unlock(&fc->lock);
+               attr_version = fuse_get_attr_version(fc);
 
                parent = dget_parent(entry);
                fuse_lookup_init(req, parent->d_inode, entry, &outarg);
@@ -264,9 +277,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
                return ERR_PTR(PTR_ERR(forget_req));
        }
 
-       spin_lock(&fc->lock);
-       attr_version = fc->attr_version;
-       spin_unlock(&fc->lock);
+       attr_version = fuse_get_attr_version(fc);
 
        fuse_lookup_init(req, dir, entry, &outarg);
        request_send(fc, req);
@@ -646,6 +657,9 @@ static int fuse_rename(struct inode *olddir, struct dentry *oldent,
        err = req->out.h.error;
        fuse_put_request(fc, req);
        if (!err) {
+               /* ctime changes */
+               fuse_invalidate_attr(oldent->d_inode);
+
                fuse_invalidate_attr(olddir);
                if (olddir != newdir)
                        fuse_invalidate_attr(newdir);
@@ -733,9 +747,7 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
        if (IS_ERR(req))
                return PTR_ERR(req);
 
-       spin_lock(&fc->lock);
-       attr_version = fc->attr_version;
-       spin_unlock(&fc->lock);
+       attr_version = fuse_get_attr_version(fc);
 
        memset(&inarg, 0, sizeof(inarg));
        memset(&outarg, 0, sizeof(outarg));
@@ -955,7 +967,6 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
        struct page *page;
        struct inode *inode = file->f_path.dentry->d_inode;
        struct fuse_conn *fc = get_fuse_conn(inode);
-       struct fuse_file *ff = file->private_data;
        struct fuse_req *req;
 
        if (is_bad_inode(inode))
@@ -972,7 +983,7 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
        }
        req->num_pages = 1;
        req->pages[0] = page;
-       fuse_read_fill(req, ff, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR);
+       fuse_read_fill(req, file, inode, file->f_pos, PAGE_SIZE, FUSE_READDIR);
        request_send(fc, req);
        nbytes = req->out.args[0].size;
        err = req->out.h.error;