summaryrefslogtreecommitdiffstats
path: root/fs/afs/vnode.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2007-05-10 22:22:20 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-11 08:29:32 -0700
commit45222b9e02fb282eb0a8007a3d992dd229ec2410 (patch)
tree2160228a23c700437bda0898d3a700ac499b941d /fs/afs/vnode.c
parent0f300ca9284caabdd2c07c7f91b90f1f530f614e (diff)
downloadlinux-45222b9e02fb282eb0a8007a3d992dd229ec2410.tar.bz2
AFS: implement statfs
Implement the statfs() op for AFS. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/afs/vnode.c')
-rw-r--r--fs/afs/vnode.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/fs/afs/vnode.c b/fs/afs/vnode.c
index bea8bd9e7b2a..c36c98ce2c3c 100644
--- a/fs/afs/vnode.c
+++ b/fs/afs/vnode.c
@@ -869,3 +869,55 @@ no_server:
spin_unlock(&vnode->lock);
return PTR_ERR(server);
}
+
+/*
+ * get the status of a volume
+ */
+int afs_vnode_get_volume_status(struct afs_vnode *vnode, struct key *key,
+ struct afs_volume_status *vs)
+{
+ struct afs_server *server;
+ int ret;
+
+ _enter("%s{%x:%u.%u},%x,",
+ vnode->volume->vlocation->vldb.name,
+ vnode->fid.vid,
+ vnode->fid.vnode,
+ vnode->fid.unique,
+ key_serial(key));
+
+ /* this op will fetch the status */
+ spin_lock(&vnode->lock);
+ vnode->update_cnt++;
+ spin_unlock(&vnode->lock);
+
+ do {
+ /* pick a server to query */
+ server = afs_volume_pick_fileserver(vnode);
+ if (IS_ERR(server))
+ goto no_server;
+
+ _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+
+ ret = afs_fs_get_volume_status(server, key, vnode, vs, &afs_sync_call);
+
+ } while (!afs_volume_release_fileserver(vnode, server, ret));
+
+ /* adjust the flags */
+ if (ret == 0) {
+ afs_vnode_finalise_status_update(vnode, server);
+ afs_put_server(server);
+ } else {
+ afs_vnode_status_update_failed(vnode, ret);
+ }
+
+ _leave(" = %d", ret);
+ return ret;
+
+no_server:
+ spin_lock(&vnode->lock);
+ vnode->update_cnt--;
+ ASSERTCMP(vnode->update_cnt, >=, 0);
+ spin_unlock(&vnode->lock);
+ return PTR_ERR(server);
+}