summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorHirofumi Ogawa <hirofumi@mail.parknet.co.jp>2003-05-27 05:56:58 -0700
committerArnaldo Carvalho de Melo <acme@conectiva.com.br>2003-05-27 05:56:58 -0700
commitb438aca413641374aee6a76f7655d7e206b99334 (patch)
tree7a1c25f9459ef5776234a4371de36a0d3cfb69fa /include/linux
parentff3345fd48fcf8d62274088a494c212dd9e99c30 (diff)
[PATCH] FAT cluster chain cache per superblock (4/5)
This shifts the data position caches from module to per-superblock, and cleanups.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/msdos_fs.h13
-rw-r--r--include/linux/msdos_fs_sb.h12
2 files changed, 13 insertions, 12 deletions
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index b1fa8c23dddc..0555d7d08894 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -27,8 +27,6 @@ struct statfs;
#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */
-#define FAT_CACHE 8 /* FAT cache size */
-
#define ATTR_NONE 0 /* no attribute bits */
#define ATTR_RO 1 /* read-only */
#define ATTR_HIDDEN 2 /* hidden */
@@ -204,14 +202,6 @@ static inline struct msdos_inode_info *MSDOS_I(struct inode *inode)
return container_of(inode, struct msdos_inode_info, vfs_inode);
}
-struct fat_cache {
- struct super_block *sb; /* fs in question. NULL means unused */
- int start_cluster; /* first cluster of the chain. */
- int file_cluster; /* cluster number in the file. */
- int disk_cluster; /* cluster number on disk. */
- struct fat_cache *next; /* next cache entry */
-};
-
static inline void fat16_towchar(wchar_t *dst, const __u8 *src, size_t len)
{
#ifdef __BIG_ENDIAN
@@ -242,12 +232,11 @@ static inline void fatwchar_to16(__u8 *dst, const wchar_t *src, size_t len)
extern int fat_access(struct super_block *sb, int nr, int new_value);
extern int __fat_access(struct super_block *sb, int nr, int new_value);
extern int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys);
-extern void fat_cache_init(void);
+extern void fat_cache_init(struct super_block *sb);
extern void fat_cache_lookup(struct inode *inode, int cluster, int *f_clu,
int *d_clu);
extern void fat_cache_add(struct inode *inode, int f_clu, int d_clu);
extern void fat_cache_inval_inode(struct inode *inode);
-extern void fat_cache_inval_dev(struct super_block *sb);
extern int fat_free(struct inode *inode, int skip);
/* fat/dir.c */
diff --git a/include/linux/msdos_fs_sb.h b/include/linux/msdos_fs_sb.h
index 317a02cd7c88..339fb5624943 100644
--- a/include/linux/msdos_fs_sb.h
+++ b/include/linux/msdos_fs_sb.h
@@ -26,6 +26,15 @@ struct fat_mount_options {
nocase:1; /* Does this need case conversion? 0=need case conversion*/
};
+#define FAT_CACHE_NR 8 /* number of FAT cache */
+
+struct fat_cache {
+ int start_cluster; /* first cluster of the chain. */
+ int file_cluster; /* cluster number in the file. */
+ int disk_cluster; /* cluster number on disk. */
+ struct fat_cache *next; /* next cache entry */
+};
+
struct msdos_sb_info {
unsigned short cluster_size; /* sectors/cluster */
unsigned short cluster_bits; /* sectors/cluster */
@@ -47,6 +56,9 @@ struct msdos_sb_info {
void *dir_ops; /* Opaque; default directory operations */
int dir_per_block; /* dir entries per block */
int dir_per_block_bits; /* log2(dir_per_block) */
+
+ spinlock_t cache_lock;
+ struct fat_cache cache_array[FAT_CACHE_NR], *cache;
};
#endif