afs/include/linux cachefs.h,1.16,1.17

dwh at infradead.org dwh at infradead.org
Thu Jul 10 16:20:02 BST 2003


Update of /home/cvs/afs/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv15190/include/linux

Modified Files:
	cachefs.h 
Log Message:
more codestylifying


Index: cachefs.h
===================================================================
RCS file: /home/cvs/afs/include/linux/cachefs.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- cachefs.h	9 Jul 2003 10:39:49 -0000	1.16
+++ cachefs.h	10 Jul 2003 14:19:59 -0000	1.17
@@ -15,37 +15,46 @@
 #include <linux/fs.h>
 #include <linux/list.h>
 #include <linux/pagemap.h>
-#include <linux/bio.h>
 
 struct cachefs_cookie;
 struct cachefs_netfs;
 struct cachefs_netfs_operations;
 struct cachefs_page;
 
-typedef enum {
-	CACHEFS_MATCH_FAILED,		/* no match */
-	CACHEFS_MATCH_SUCCESS,		/* successful match */
-	CACHEFS_MATCH_SUCCESS_UPDATE,	/* successful match, entry requires update */
-	CACHEFS_MATCH_SUCCESS_DELETE,	/* successful match, entry requires deletion */
-} cachefs_match_val_t;
-
 typedef void (*cachefs_rw_complete_t)(void *cookie_data,
 				      struct page *page,
 				      void *data,
 				      int error);
 
+/* result of index entry comparison */
+typedef enum {
+	/* no match */
+	CACHEFS_MATCH_FAILED,
+
+	/* successful match */
+	CACHEFS_MATCH_SUCCESS,
+
+	/* successful match, entry requires update */
+	CACHEFS_MATCH_SUCCESS_UPDATE,
+
+	/* successful match, entry requires deletion */
+	CACHEFS_MATCH_SUCCESS_DELETE,
+} cachefs_match_val_t;
+
 /*****************************************************************************/
 /*
  * cachefs index definition
  * - each index file contains a number of fixed size entries
- *   - they don't have to fit exactly into a page, but if they don't, the gap at the end of the
- *     page will not be used
- * - if the first 4 bytes of the entry are all zero, then the entry is taken as not being in use
+ *   - they don't have to fit exactly into a page, but if they don't, the gap
+ *     at the end of the page will not be used
  */
 struct cachefs_index_def
 {
-	u_int8_t			name[8];	/* name of index */
-	u_int16_t			data_size;	/* index entry data size */
+	/* name of index */
+	u_int8_t			name[8];
+
+	/* size of data to be stored in index */
+	u_int16_t			data_size;
 
 	/* key description (for displaying in cache mountpoint) */
 	struct {
@@ -61,13 +70,16 @@
 #define CACHEFS_INDEX_KEYS__LAST	CACHEFS_INDEX_KEYS_IPV6ADDR
 
 	/* see if entry matches the specified key
-	 * - the netfs data from the cookie being used as the target is presented
+	 * - the netfs data from the cookie being used as the target is
+	 *   presented
 	 * - entries that aren't in use will not be presented for matching
 	 */
-	cachefs_match_val_t (*match)(void *target_netfs_data, const void *entry);
+	cachefs_match_val_t (*match)(void *target_netfs_data,
+				     const void *entry);
 
 	/* update entry from key
-	 * - the netfs data from the cookie being used as the source is presented
+	 * - the netfs data from the cookie being used as the source is
+	 *   presented
 	 */
 	void (*update)(void *source_netfs_data, void *entry);
 };
@@ -77,7 +89,8 @@
 				   void *netfs_data,
 				   struct cachefs_cookie **_cookie);
 
-extern void cachefs_relinquish_cookie(struct cachefs_cookie *cookie, int retire);
+extern void cachefs_relinquish_cookie(struct cachefs_cookie *cookie,
+				      int retire);
 
 /*****************************************************************************/
 /*
@@ -87,11 +100,11 @@
  */
 struct cachefs_netfs
 {
-	const char			*name;		/* filesystem def name */
-	unsigned			version;	/* index layout version */
+	const char			*name;		/* filesystem name */
+	unsigned			version;	/* indexing version */
 	struct cachefs_cookie		*primary_index;
 	struct cachefs_netfs_operations	*ops;
-	struct list_head		link;		/* internal cachefs list link */
+	struct list_head		link;		/* internal link */
 };
 
 extern int cachefs_register_netfs(struct cachefs_netfs *netfs,
@@ -105,11 +118,8 @@
 	 * - returning -ENODATA will cause this page to be ignored
 	 * - typically, the struct will be attached to page->private
 	 */
-	int (*get_page_cookie)(struct page *page, struct cachefs_page **_page_cookie);
-
-	/* handle journal replaying indicating writeback needed */
-	int (*replay)(struct cachefs_cookie *cookie, unsigned page_number);
-
+	int (*get_page_cookie)(struct page *page,
+			       struct cachefs_page **_page_cookie);
 };
 
 /*****************************************************************************/
@@ -122,9 +132,11 @@
 {
 	struct cachefs_block	*mapped_block;	/* block mirroring this page */
 	rwlock_t		lock;
+
 	unsigned long		flags;
-#define CACHEFS_PAGE_BOUNDARY	0		/* next block has a different indirection chain */
-#define CACHEFS_PAGE_NEW	1		/* this is a newly allocated block */
+#define CACHEFS_PAGE_BOUNDARY	0	/* next block has a different
+					 * indirection chain */
+#define CACHEFS_PAGE_NEW	1	/* this is a newly allocated block */
 };
 
 /*
@@ -132,10 +144,10 @@
  * - if the cookie is not backed by a file:
  *   - -ENOBUFS will be returned and nothing more will be done
  * - else if the page is backed by a block in the cache:
- *   - a read will be started which will call end_io_data on completion
+ *   - a read will be started which will call end_io_func on completion
  *   - the wb-journal will be searched for an entry pertaining to this block
  *     - if an entry is found:
- *       - 1 will be returned
+ *       - 1 will be returned [not yet supported]
  *       else
  *       - 0 will be returned
  * - else if the page is unbacked:
@@ -152,13 +164,16 @@
 
 /*
  * request a page be stored in the cache
- * - this request may be ignored if no cache block is currently attached, in which case it
+ * - this request may be ignored if no cache block is currently attached, in
+ *   which case it:
  *   - returns -ENOBUFS
  * - if a cache block was already allocated:
  *   - the page cookie will be updated to reflect the block selected
- *   - a BIO will have been dispatched to write the page with end_io as the completion func
- *     - end_io can be NULL, in which case a default function will just clear the writeback bit
- *   - if a page is associated with a v-journal entry, that entry will be erased
+ *   - a BIO will be dispatched to write the page (end_io_func will be called
+ *     from the completion function)
+ *     - end_io_func can be NULL, in which case a default function will just
+ *       clear the writeback bit on the page
+ *   - any associated validity journal entry will be cleared
  *   - returns 0
  */
 extern int cachefs_write_page(struct cachefs_cookie *cookie,
@@ -169,7 +184,7 @@
 
 /*
  * indicate that caching is no longer required on a page
- * - cannot cancel any outstanding BIOs between this page and the cache
+ * - note: cannot cancel any outstanding BIOs between this page and the cache
  */
 extern void cachefs_uncache_page(struct cachefs_cookie *cookie,
 				 struct page *page);
@@ -195,9 +210,11 @@
 #endif
 
 /*
- * convenience routines for mapping page->private directly to a struct cachefs_page
+ * convenience routines for mapping page->private directly to a struct
+ * cachefs_page
  */
-static inline struct cachefs_page *__cachefs_page_get_private(struct page *page)
+static inline
+struct cachefs_page *__cachefs_page_get_private(struct page *page)
 {
 	BUG_ON(!PagePrivate(page));
 	return (struct cachefs_page *) page->private;




More information about the linux-afs-cvs mailing list