Commit 0c3a5ac2 authored by David Howells's avatar David Howells

afs: Make it possible to get the data version in readpage

Store the data version number indicated by an FS.FetchData op into the read
request structure so that it's accessible by the page reader.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 5800db81
...@@ -613,7 +613,7 @@ static int afs_do_getlk(struct file *file, struct file_lock *fl) ...@@ -613,7 +613,7 @@ static int afs_do_getlk(struct file *file, struct file_lock *fl)
posix_test_lock(file, fl); posix_test_lock(file, fl);
if (fl->fl_type == F_UNLCK) { if (fl->fl_type == F_UNLCK) {
/* no local locks; consult the server */ /* no local locks; consult the server */
ret = afs_fetch_status(vnode, key); ret = afs_fetch_status(vnode, key, false);
if (ret < 0) if (ret < 0)
goto error; goto error;
......
This diff is collapsed.
...@@ -105,7 +105,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode, struct key *key) ...@@ -105,7 +105,7 @@ static int afs_inode_map_status(struct afs_vnode *vnode, struct key *key)
/* /*
* Fetch file status from the volume. * Fetch file status from the volume.
*/ */
int afs_fetch_status(struct afs_vnode *vnode, struct key *key) int afs_fetch_status(struct afs_vnode *vnode, struct key *key, bool new_inode)
{ {
struct afs_fs_cursor fc; struct afs_fs_cursor fc;
int ret; int ret;
...@@ -119,7 +119,7 @@ int afs_fetch_status(struct afs_vnode *vnode, struct key *key) ...@@ -119,7 +119,7 @@ int afs_fetch_status(struct afs_vnode *vnode, struct key *key)
if (afs_begin_vnode_operation(&fc, vnode, key)) { if (afs_begin_vnode_operation(&fc, vnode, key)) {
while (afs_select_fileserver(&fc)) { while (afs_select_fileserver(&fc)) {
fc.cb_break = vnode->cb_break + vnode->cb_s_break; fc.cb_break = vnode->cb_break + vnode->cb_s_break;
afs_fs_fetch_file_status(&fc, NULL); afs_fs_fetch_file_status(&fc, NULL, new_inode);
} }
afs_check_for_remote_deletion(&fc, fc.vnode); afs_check_for_remote_deletion(&fc, fc.vnode);
...@@ -307,7 +307,7 @@ struct inode *afs_iget(struct super_block *sb, struct key *key, ...@@ -307,7 +307,7 @@ struct inode *afs_iget(struct super_block *sb, struct key *key,
if (!status) { if (!status) {
/* it's a remotely extant inode */ /* it's a remotely extant inode */
ret = afs_fetch_status(vnode, key); ret = afs_fetch_status(vnode, key, true);
if (ret < 0) if (ret < 0)
goto bad_inode; goto bad_inode;
} else { } else {
...@@ -432,7 +432,7 @@ int afs_validate(struct afs_vnode *vnode, struct key *key) ...@@ -432,7 +432,7 @@ int afs_validate(struct afs_vnode *vnode, struct key *key)
* access */ * access */
if (!test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) { if (!test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) {
_debug("not promised"); _debug("not promised");
ret = afs_fetch_status(vnode, key); ret = afs_fetch_status(vnode, key, false);
if (ret < 0) { if (ret < 0) {
if (ret == -ENOENT) { if (ret == -ENOENT) {
set_bit(AFS_VNODE_DELETED, &vnode->flags); set_bit(AFS_VNODE_DELETED, &vnode->flags);
......
...@@ -122,7 +122,8 @@ struct afs_call { ...@@ -122,7 +122,8 @@ struct afs_call {
u32 operation_ID; /* operation ID for an incoming call */ u32 operation_ID; /* operation ID for an incoming call */
u32 count; /* count for use in unmarshalling */ u32 count; /* count for use in unmarshalling */
__be32 tmp; /* place to extract temporary data */ __be32 tmp; /* place to extract temporary data */
afs_dataversion_t store_version; /* updated version expected from store */ afs_dataversion_t expected_version; /* Updated version expected from store */
afs_dataversion_t expected_version_2; /* 2nd updated version expected from store */
}; };
struct afs_call_type { struct afs_call_type {
...@@ -173,6 +174,7 @@ struct afs_read { ...@@ -173,6 +174,7 @@ struct afs_read {
loff_t len; /* How much we're asking for */ loff_t len; /* How much we're asking for */
loff_t actual_len; /* How much we're actually getting */ loff_t actual_len; /* How much we're actually getting */
loff_t remain; /* Amount remaining */ loff_t remain; /* Amount remaining */
afs_dataversion_t new_version; /* Version number returned by server */
atomic_t usage; atomic_t usage;
unsigned int index; /* Which page we're reading into */ unsigned int index; /* Which page we're reading into */
unsigned int nr_pages; unsigned int nr_pages;
...@@ -702,7 +704,7 @@ extern int afs_flock(struct file *, int, struct file_lock *); ...@@ -702,7 +704,7 @@ extern int afs_flock(struct file *, int, struct file_lock *);
/* /*
* fsclient.c * fsclient.c
*/ */
extern int afs_fs_fetch_file_status(struct afs_fs_cursor *, struct afs_volsync *); extern int afs_fs_fetch_file_status(struct afs_fs_cursor *, struct afs_volsync *, bool);
extern int afs_fs_give_up_callbacks(struct afs_net *, struct afs_server *); extern int afs_fs_give_up_callbacks(struct afs_net *, struct afs_server *);
extern int afs_fs_fetch_data(struct afs_fs_cursor *, struct afs_read *); extern int afs_fs_fetch_data(struct afs_fs_cursor *, struct afs_read *);
extern int afs_fs_create(struct afs_fs_cursor *, const char *, umode_t, extern int afs_fs_create(struct afs_fs_cursor *, const char *, umode_t,
...@@ -735,7 +737,7 @@ extern int afs_fs_fetch_status(struct afs_fs_cursor *, struct afs_net *, ...@@ -735,7 +737,7 @@ extern int afs_fs_fetch_status(struct afs_fs_cursor *, struct afs_net *,
/* /*
* inode.c * inode.c
*/ */
extern int afs_fetch_status(struct afs_vnode *, struct key *); extern int afs_fetch_status(struct afs_vnode *, struct key *, bool);
extern int afs_iget5_test(struct inode *, void *); extern int afs_iget5_test(struct inode *, void *);
extern struct inode *afs_iget_pseudo_dir(struct super_block *, bool); extern struct inode *afs_iget_pseudo_dir(struct super_block *, bool);
extern struct inode *afs_iget(struct super_block *, struct key *, extern struct inode *afs_iget(struct super_block *, struct key *,
......
...@@ -322,7 +322,7 @@ int afs_check_permit(struct afs_vnode *vnode, struct key *key, ...@@ -322,7 +322,7 @@ int afs_check_permit(struct afs_vnode *vnode, struct key *key,
*/ */
_debug("no valid permit"); _debug("no valid permit");
ret = afs_fetch_status(vnode, key); ret = afs_fetch_status(vnode, key, false);
if (ret < 0) { if (ret < 0) {
*_access = 0; *_access = 0;
_leave(" = %d", ret); _leave(" = %d", ret);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment