Skip to content

Commit 36a02de

Browse files
committed
FS-Cache: Convert the object event ID #defines into an enum
Convert the fscache_object event IDs from #defines into an enum. Also add an extra label to the enum to carry the event count and redefine the event mask in terms of that. Signed-off-by: David Howells <dhowells@redhat.com>
1 parent b4cf1e0 commit 36a02de

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

‎include/linux/fscache-cache.h‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,23 @@ struct fscache_cookie {
337337

338338
extern struct fscache_cookie fscache_fsdef_index;
339339

340+
/*
341+
* Event list for fscache_object::{event_mask,events}
342+
*/
343+
enum {
344+
FSCACHE_OBJECT_EV_REQUEUE, /* T if object should be requeued */
345+
FSCACHE_OBJECT_EV_UPDATE, /* T if object should be updated */
346+
FSCACHE_OBJECT_EV_INVALIDATE, /* T if cache requested object invalidation */
347+
FSCACHE_OBJECT_EV_CLEARED, /* T if accessors all gone */
348+
FSCACHE_OBJECT_EV_ERROR, /* T if fatal error occurred during processing */
349+
FSCACHE_OBJECT_EV_RELEASE, /* T if netfs requested object release */
350+
FSCACHE_OBJECT_EV_RETIRE, /* T if netfs requested object retirement */
351+
FSCACHE_OBJECT_EV_WITHDRAW, /* T if cache requested object withdrawal */
352+
NR_FSCACHE_OBJECT_EVENTS
353+
};
354+
355+
#define FSCACHE_OBJECT_EVENTS_MASK ((1UL << NR_FSCACHE_OBJECT_EVENTS) - 1)
356+
340357
/*
341358
* on-disk cache file or index handle
342359
*/
@@ -376,15 +393,6 @@ struct fscache_object {
376393
unsigned long event_mask; /* events this object is interested in */
377394
unsigned long events; /* events to be processed by this object
378395
* (order is important - using fls) */
379-
#define FSCACHE_OBJECT_EV_REQUEUE 0 /* T if object should be requeued */
380-
#define FSCACHE_OBJECT_EV_UPDATE 1 /* T if object should be updated */
381-
#define FSCACHE_OBJECT_EV_CLEARED 2 /* T if accessors all gone */
382-
#define FSCACHE_OBJECT_EV_ERROR 3 /* T if fatal error occurred during processing */
383-
#define FSCACHE_OBJECT_EV_RELEASE 4 /* T if netfs requested object release */
384-
#define FSCACHE_OBJECT_EV_RETIRE 5 /* T if netfs requested object retirement */
385-
#define FSCACHE_OBJECT_EV_WITHDRAW 6 /* T if cache requested object withdrawal */
386-
#define FSCACHE_OBJECT_EV_INVALIDATE 7 /* T if cache requested object invalidation */
387-
#define FSCACHE_OBJECT_EVENTS_MASK 0xff /* mask of all events*/
388396

389397
unsigned long flags;
390398
#define FSCACHE_OBJECT_LOCK 0 /* T if object is busy being processed */

0 commit comments

Comments
 (0)