Lines Matching refs:inode

31 static inline int fat_max_cache(struct inode *inode)  in fat_max_cache()  argument
61 static inline struct fat_cache *fat_cache_alloc(struct inode *inode) in fat_cache_alloc() argument
72 static inline void fat_cache_update_lru(struct inode *inode, in fat_cache_update_lru() argument
75 if (MSDOS_I(inode)->cache_lru.next != &cache->cache_list) in fat_cache_update_lru()
76 list_move(&cache->cache_list, &MSDOS_I(inode)->cache_lru); in fat_cache_update_lru()
79 static int fat_cache_lookup(struct inode *inode, int fclus, in fat_cache_lookup() argument
88 spin_lock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_lookup()
89 list_for_each_entry(p, &MSDOS_I(inode)->cache_lru, cache_list) { in fat_cache_lookup()
102 fat_cache_update_lru(inode, hit); in fat_cache_lookup()
104 cid->id = MSDOS_I(inode)->cache_valid_id; in fat_cache_lookup()
111 spin_unlock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_lookup()
116 static struct fat_cache *fat_cache_merge(struct inode *inode, in fat_cache_merge() argument
121 list_for_each_entry(p, &MSDOS_I(inode)->cache_lru, cache_list) { in fat_cache_merge()
133 static void fat_cache_add(struct inode *inode, struct fat_cache_id *new) in fat_cache_add() argument
140 spin_lock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_add()
142 new->id != MSDOS_I(inode)->cache_valid_id) in fat_cache_add()
145 cache = fat_cache_merge(inode, new); in fat_cache_add()
147 if (MSDOS_I(inode)->nr_caches < fat_max_cache(inode)) { in fat_cache_add()
148 MSDOS_I(inode)->nr_caches++; in fat_cache_add()
149 spin_unlock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_add()
151 tmp = fat_cache_alloc(inode); in fat_cache_add()
153 spin_lock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_add()
154 MSDOS_I(inode)->nr_caches--; in fat_cache_add()
155 spin_unlock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_add()
159 spin_lock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_add()
160 cache = fat_cache_merge(inode, new); in fat_cache_add()
162 MSDOS_I(inode)->nr_caches--; in fat_cache_add()
168 struct list_head *p = MSDOS_I(inode)->cache_lru.prev; in fat_cache_add()
176 fat_cache_update_lru(inode, cache); in fat_cache_add()
178 spin_unlock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_add()
185 static void __fat_cache_inval_inode(struct inode *inode) in __fat_cache_inval_inode() argument
187 struct msdos_inode_info *i = MSDOS_I(inode); in __fat_cache_inval_inode()
203 void fat_cache_inval_inode(struct inode *inode) in fat_cache_inval_inode() argument
205 spin_lock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_inval_inode()
206 __fat_cache_inval_inode(inode); in fat_cache_inval_inode()
207 spin_unlock(&MSDOS_I(inode)->cache_lru_lock); in fat_cache_inval_inode()
224 int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus) in fat_get_cluster() argument
226 struct super_block *sb = inode->i_sb; in fat_get_cluster()
232 BUG_ON(MSDOS_I(inode)->i_start == 0); in fat_get_cluster()
235 *dclus = MSDOS_I(inode)->i_start; in fat_get_cluster()
239 if (fat_cache_lookup(inode, cluster, &cid, fclus, dclus) < 0) { in fat_get_cluster()
254 MSDOS_I(inode)->i_pos); in fat_get_cluster()
259 nr = fat_ent_read(inode, &fatent, *dclus); in fat_get_cluster()
266 MSDOS_I(inode)->i_pos); in fat_get_cluster()
270 fat_cache_add(inode, &cid); in fat_get_cluster()
279 fat_cache_add(inode, &cid); in fat_get_cluster()
285 static int fat_bmap_cluster(struct inode *inode, int cluster) in fat_bmap_cluster() argument
287 struct super_block *sb = inode->i_sb; in fat_bmap_cluster()
290 if (MSDOS_I(inode)->i_start == 0) in fat_bmap_cluster()
293 ret = fat_get_cluster(inode, cluster, &fclus, &dclus); in fat_bmap_cluster()
298 __func__, MSDOS_I(inode)->i_pos); in fat_bmap_cluster()
304 int fat_bmap(struct inode *inode, sector_t sector, sector_t *phys, in fat_bmap() argument
307 struct super_block *sb = inode->i_sb; in fat_bmap()
316 if ((sbi->fat_bits != 32) && (inode->i_ino == MSDOS_ROOT_INO)) { in fat_bmap()
324 last_block = (i_size_read(inode) + (blocksize - 1)) >> blocksize_bits; in fat_bmap()
333 last_block = (MSDOS_I(inode)->mmu_private + (blocksize - 1)) in fat_bmap()
341 cluster = fat_bmap_cluster(inode, cluster); in fat_bmap()