u32 abort_code; /* Abort if bulk-fetching this failed */
};
+struct afs_status_cb {
+ struct afs_file_status status;
+ struct afs_callback callback;
+ bool have_cb; /* True if cb record was retrieved */
+};
+
/*
* AFS file status change request
*/
bool found;
bool one_only;
unsigned short nr_fids;
- struct afs_file_status *statuses;
- struct afs_callback *callbacks;
+ struct afs_status_cb *statuses;
struct afs_fid fids[50];
};
struct afs_lookup_cookie *cookie;
struct afs_cb_interest *cbi = NULL;
struct afs_super_info *as = dir->i_sb->s_fs_info;
+ struct afs_status_cb *scb;
struct afs_iget_data data;
struct afs_fs_cursor fc;
struct afs_vnode *dvnode = AFS_FS_I(dir);
/* Need space for examining all the selected files */
inode = ERR_PTR(-ENOMEM);
- cookie->statuses = kcalloc(cookie->nr_fids, sizeof(struct afs_file_status),
- GFP_KERNEL);
+ cookie->statuses = kvcalloc(cookie->nr_fids, sizeof(struct afs_status_cb),
+ GFP_KERNEL);
if (!cookie->statuses)
goto out;
- cookie->callbacks = kcalloc(cookie->nr_fids, sizeof(struct afs_callback),
- GFP_KERNEL);
- if (!cookie->callbacks)
- goto out_s;
-
/* Try FS.InlineBulkStatus first. Abort codes for the individual
* lookups contained therein are stored in the reply without aborting
* the whole operation.
afs_v2net(dvnode),
cookie->fids,
cookie->statuses,
- cookie->callbacks,
cookie->nr_fids, NULL);
}
inode = ERR_PTR(-ERESTARTSYS);
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
while (afs_select_fileserver(&fc)) {
+ scb = &cookie->statuses[0];
afs_fs_fetch_status(&fc,
afs_v2net(dvnode),
cookie->fids,
- cookie->statuses,
- cookie->callbacks,
+ &scb->status,
+ &scb->callback,
NULL);
}
goto out_c;
for (i = 0; i < cookie->nr_fids; i++)
- cookie->statuses[i].abort_code = 0;
+ cookie->statuses[i].status.abort_code = 0;
success:
/* Turn all the files into inodes and save the first one - which is the
* one we actually want.
*/
- if (cookie->statuses[0].abort_code != 0)
- inode = ERR_PTR(afs_abort_to_error(cookie->statuses[0].abort_code));
+ scb = &cookie->statuses[0];
+ if (scb->status.abort_code != 0)
+ inode = ERR_PTR(afs_abort_to_error(scb->status.abort_code));
for (i = 0; i < cookie->nr_fids; i++) {
+ struct afs_status_cb *scb = &cookie->statuses[i];
struct inode *ti;
- if (cookie->statuses[i].abort_code != 0)
+ if (scb->status.abort_code != 0)
continue;
ti = afs_iget(dir->i_sb, key, &cookie->fids[i],
- &cookie->statuses[i],
- &cookie->callbacks[i],
+ &scb->status,
+ &scb->callback,
cbi, dvnode);
if (i == 0) {
inode = ti;
out_c:
afs_put_cb_interest(afs_v2net(dvnode), cbi);
- kfree(cookie->callbacks);
-out_s:
- kfree(cookie->statuses);
+ kvfree(cookie->statuses);
out:
kfree(cookie);
return inode;
*/
static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
{
- struct afs_file_status *statuses;
- struct afs_callback *callbacks;
+ struct afs_status_cb *scb;
const __be32 *bp;
u32 tmp;
int ret;
return ret;
bp = call->buffer;
- statuses = call->out_extra_status;
- ret = afs_decode_status(call, &bp, &statuses[call->count],
+ scb = &call->out_scb[call->count];
+ ret = afs_decode_status(call, &bp, &scb->status,
NULL, NULL, NULL);
if (ret < 0)
return ret;
_debug("unmarshall CB array");
bp = call->buffer;
- callbacks = call->out_cb;
- xdr_decode_AFSCallBack_raw(call, &callbacks[call->count], &bp);
- statuses = call->out_extra_status;
+ scb = &call->out_scb[call->count];
+ xdr_decode_AFSCallBack_raw(call, &scb->callback, &bp);
+ scb->have_cb = true;
call->count++;
if (call->count < call->count2)
goto more_cbs;
int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
struct afs_net *net,
struct afs_fid *fids,
- struct afs_file_status *statuses,
- struct afs_callback *callbacks,
+ struct afs_status_cb *statuses,
unsigned int nr_fids,
struct afs_volsync *volsync)
{
int i;
if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
- return yfs_fs_inline_bulk_status(fc, net, fids, statuses, callbacks,
+ return yfs_fs_inline_bulk_status(fc, net, fids, statuses,
nr_fids, volsync);
_enter(",%x,{%llx:%llu},%u",
}
call->key = fc->key;
- call->out_extra_status = statuses;
- call->out_cb = callbacks;
+ call->out_scb = statuses;
call->out_volsync = volsync;
call->count2 = nr_fids;
call->want_reply_time = true;
struct afs_file_status *out_vnode_status;
struct afs_file_status *out_extra_status;
struct afs_callback *out_cb;
+ struct afs_status_cb *out_scb;
struct yfs_acl *out_yacl;
struct afs_volsync *out_volsync;
struct afs_volume_status *out_volstatus;
struct afs_addr_cursor *, struct key *,
unsigned int);
extern int afs_fs_inline_bulk_status(struct afs_fs_cursor *, struct afs_net *,
- struct afs_fid *, struct afs_file_status *,
- struct afs_callback *, unsigned int,
- struct afs_volsync *);
+ struct afs_fid *, struct afs_status_cb *,
+ unsigned int, struct afs_volsync *);
extern int afs_fs_fetch_status(struct afs_fs_cursor *, struct afs_net *,
struct afs_fid *, struct afs_file_status *,
struct afs_callback *, struct afs_volsync *);
struct afs_fid *, struct afs_file_status *,
struct afs_callback *, struct afs_volsync *);
extern int yfs_fs_inline_bulk_status(struct afs_fs_cursor *, struct afs_net *,
- struct afs_fid *, struct afs_file_status *,
- struct afs_callback *, unsigned int,
- struct afs_volsync *);
+ struct afs_fid *, struct afs_status_cb *,
+ unsigned int, struct afs_volsync *);
struct yfs_acl {
struct afs_acl *acl; /* Dir/file/symlink ACL */
struct afs_callback cb;
xdr_decode_YFSCallBack_raw(call, &cb, _bp);
-
+
write_seqlock(&vnode->cb_lock);
if (!afs_cb_is_broken(call->cb_break, vnode, cbi)) {
*/
static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call)
{
- struct afs_file_status *statuses;
- struct afs_callback *callbacks;
+ struct afs_status_cb *scb;
const __be32 *bp;
u32 tmp;
int ret;
return ret;
bp = call->buffer;
- statuses = call->out_extra_status;
- ret = yfs_decode_status(call, &bp, &statuses[call->count],
+ scb = &call->out_scb[call->count];
+ ret = yfs_decode_status(call, &bp, &scb->status,
NULL, NULL, NULL);
if (ret < 0)
return ret;
_debug("unmarshall CB array");
bp = call->buffer;
- callbacks = call->out_cb;
- xdr_decode_YFSCallBack_raw(call, &callbacks[call->count], &bp);
+ scb = &call->out_scb[call->count];
+ xdr_decode_YFSCallBack_raw(call, &scb->callback, &bp);
+ scb->have_cb = true;
call->count++;
if (call->count < call->count2)
goto more_cbs;
int yfs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
struct afs_net *net,
struct afs_fid *fids,
- struct afs_file_status *statuses,
- struct afs_callback *callbacks,
+ struct afs_status_cb *statuses,
unsigned int nr_fids,
struct afs_volsync *volsync)
{
}
call->key = fc->key;
- call->out_extra_status = statuses;
- call->out_cb = callbacks;
+ call->out_scb = statuses;
call->out_volsync = volsync;
call->count2 = nr_fids;