Skip to content

Commit 5cf9dd5

Browse files
committed
afs: Prospectively look up extra files when doing a single lookup
When afs_lookup() is called, prospectively look up the next 50 uncached fids also from that same directory and cache the results, rather than just looking up the one file requested. This allows us to use the FS.InlineBulkStatus RPC op to increase efficiency by fetching up to 50 file statuses at a time. Signed-off-by: David Howells <[email protected]>
1 parent 17814ae commit 5cf9dd5

File tree

8 files changed

+552
-63
lines changed

8 files changed

+552
-63
lines changed

fs/afs/afs.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ typedef enum {
6767
} afs_callback_type_t;
6868

6969
struct afs_callback {
70-
struct afs_fid fid; /* file identifier */
71-
unsigned version; /* callback version */
72-
unsigned expiry; /* time at which expires */
73-
afs_callback_type_t type; /* type of callback */
70+
unsigned version; /* Callback version */
71+
unsigned expiry; /* Time at which expires */
72+
afs_callback_type_t type; /* Type of callback */
73+
};
74+
75+
struct afs_callback_break {
76+
struct afs_fid fid; /* File identifier */
77+
struct afs_callback cb; /* Callback details */
7478
};
7579

7680
#define AFSCBMAX 50 /* maximum callbacks transferred per bulk op */
@@ -123,21 +127,22 @@ typedef u32 afs_access_t;
123127
* AFS file status information
124128
*/
125129
struct afs_file_status {
130+
u64 size; /* file size */
131+
afs_dataversion_t data_version; /* current data version */
132+
time_t mtime_client; /* last time client changed data */
133+
time_t mtime_server; /* last time server changed data */
126134
unsigned if_version; /* interface version */
127135
#define AFS_FSTATUS_VERSION 1
136+
unsigned abort_code; /* Abort if bulk-fetching this failed */
128137

129138
afs_file_type_t type; /* file type */
130139
unsigned nlink; /* link count */
131-
u64 size; /* file size */
132-
afs_dataversion_t data_version; /* current data version */
133140
u32 author; /* author ID */
134141
kuid_t owner; /* owner ID */
135142
kgid_t group; /* group ID */
136143
afs_access_t caller_access; /* access rights for authenticated caller */
137144
afs_access_t anon_access; /* access rights for unauthenticated caller */
138145
umode_t mode; /* UNIX mode */
139-
time_t mtime_client; /* last time client changed data */
140-
time_t mtime_server; /* last time server changed data */
141146
s32 lock_count; /* file lock count (0=UNLK -1=WRLCK +ve=#RDLCK */
142147
};
143148

fs/afs/afs_fs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ enum AFS_FS_Operations {
3131
FSGETVOLUMEINFO = 148, /* AFS Get information about a volume */
3232
FSGETVOLUMESTATUS = 149, /* AFS Get volume status information */
3333
FSGETROOTVOLUME = 151, /* AFS Get root volume name */
34+
FSBULKSTATUS = 155, /* AFS Fetch multiple file statuses */
3435
FSSETLOCK = 156, /* AFS Request a file lock */
3536
FSEXTENDLOCK = 157, /* AFS Extend a file lock */
3637
FSRELEASELOCK = 158, /* AFS Release a file lock */
3738
FSLOOKUP = 161, /* AFS lookup file in directory */
39+
FSINLINEBULKSTATUS = 65536, /* AFS Fetch multiple file statuses with inline errors */
3840
FSFETCHDATA64 = 65537, /* AFS Fetch file data */
3941
FSSTOREDATA64 = 65538, /* AFS Store file data */
4042
FSGIVEUPALLCALLBACKS = 65539, /* AFS Give up all outstanding callbacks on a server */

fs/afs/callback.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static void afs_break_one_callback(struct afs_server *server,
187187
* allow the fileserver to break callback promises
188188
*/
189189
void afs_break_callbacks(struct afs_server *server, size_t count,
190-
struct afs_callback callbacks[])
190+
struct afs_callback_break *callbacks)
191191
{
192192
_enter("%p,%zu,", server, count);
193193

@@ -199,9 +199,9 @@ void afs_break_callbacks(struct afs_server *server, size_t count,
199199
callbacks->fid.vid,
200200
callbacks->fid.vnode,
201201
callbacks->fid.unique,
202-
callbacks->version,
203-
callbacks->expiry,
204-
callbacks->type
202+
callbacks->cb.version,
203+
callbacks->cb.expiry,
204+
callbacks->cb.type
205205
);
206206
afs_break_one_callback(server, &callbacks->fid);
207207
}

fs/afs/cmservice.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ static void SRXAFSCB_CallBack(struct work_struct *work)
178178
*/
179179
static int afs_deliver_cb_callback(struct afs_call *call)
180180
{
181+
struct afs_callback_break *cb;
181182
struct sockaddr_rxrpc srx;
182-
struct afs_callback *cb;
183183
struct afs_server *server;
184184
__be32 *bp;
185185
int ret, loop;
@@ -218,7 +218,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
218218

219219
_debug("unmarshall FID array");
220220
call->request = kcalloc(call->count,
221-
sizeof(struct afs_callback),
221+
sizeof(struct afs_callback_break),
222222
GFP_KERNEL);
223223
if (!call->request)
224224
return -ENOMEM;
@@ -229,7 +229,7 @@ static int afs_deliver_cb_callback(struct afs_call *call)
229229
cb->fid.vid = ntohl(*bp++);
230230
cb->fid.vnode = ntohl(*bp++);
231231
cb->fid.unique = ntohl(*bp++);
232-
cb->type = AFSCM_CB_UNTYPED;
232+
cb->cb.type = AFSCM_CB_UNTYPED;
233233
}
234234

235235
call->offset = 0;
@@ -260,9 +260,9 @@ static int afs_deliver_cb_callback(struct afs_call *call)
260260
cb = call->request;
261261
bp = call->buffer;
262262
for (loop = call->count2; loop > 0; loop--, cb++) {
263-
cb->version = ntohl(*bp++);
264-
cb->expiry = ntohl(*bp++);
265-
cb->type = ntohl(*bp++);
263+
cb->cb.version = ntohl(*bp++);
264+
cb->cb.expiry = ntohl(*bp++);
265+
cb->cb.type = ntohl(*bp++);
266266
}
267267

268268
call->offset = 0;

0 commit comments

Comments
 (0)