#define LIBXFS_MOUNT_COMPAT_ATTR 0x0008
#define LIBXFS_MOUNT_ATTR2 0x0010
-#define LIBXFS_IHASHSIZE(sbp) (1<<10)
#define LIBXFS_BHASHSIZE(sbp) (1<<10)
extern xfs_mount_t *libxfs_mount (xfs_mount_t *, xfs_sb_t *,
extern int libxfs_readbufr(struct xfs_buftarg *, xfs_daddr_t, xfs_buf_t *, int, int);
extern int libxfs_bhash_size;
-extern int libxfs_ihash_size;
#define LIBXFS_BREAD 0x1
#define LIBXFS_BWRITE 0x2
extern int libxfs_iflush_int (xfs_inode_t *, xfs_buf_t *);
/* Inode Cache Interfaces */
-extern struct cache *libxfs_icache;
-extern struct cache_operations libxfs_icache_operations;
-extern void libxfs_icache_purge (void);
extern int libxfs_iget (xfs_mount_t *, xfs_trans_t *, xfs_ino_t,
uint, xfs_inode_t **, xfs_daddr_t);
extern void libxfs_iput (xfs_inode_t *, uint);
char *progname = "libxfs"; /* default, changed by each tool */
-struct cache *libxfs_icache; /* global inode cache */
-int libxfs_ihash_size; /* #buckets in icache */
-
struct cache *libxfs_bcache; /* global buffer cache */
int libxfs_bhash_size; /* #buckets in bcache */
}
if (needcd)
chdir(curdir);
- if (!libxfs_ihash_size)
- libxfs_ihash_size = LIBXFS_IHASHSIZE(sbp);
- libxfs_icache = cache_init(libxfs_ihash_size, &libxfs_icache_operations);
if (!libxfs_bhash_size)
libxfs_bhash_size = LIBXFS_BHASHSIZE(sbp);
libxfs_bcache = cache_init(libxfs_bhash_size, &libxfs_bcache_operations);
int agno;
libxfs_rtmount_destroy(mp);
- libxfs_icache_purge();
libxfs_bcache_purge();
for (agno = 0; agno < mp->m_maxagi; agno++) {
libxfs_destroy(void)
{
manage_zones(1);
- cache_destroy(libxfs_icache);
cache_destroy(libxfs_bcache);
}
time_t t;
char *c;
- cache_report(fp, "libxfs_icache", libxfs_icache);
cache_report(fp, "libxfs_bcache", libxfs_bcache);
t = time(NULL);
/*
- * Inode cache interfaces
+ * Inode cache stubs.
*/
extern kmem_zone_t *xfs_ili_zone;
extern kmem_zone_t *xfs_inode_zone;
-static unsigned int
-libxfs_ihash(cache_key_t key, unsigned int hashsize)
-{
- return ((unsigned int)*(xfs_ino_t *)key) % hashsize;
-}
-
-static int
-libxfs_icompare(struct cache_node *node, cache_key_t key)
-{
- xfs_inode_t *ip = (xfs_inode_t *)node;
-
- return (ip->i_ino == *(xfs_ino_t *)key);
-}
-
int
libxfs_iget(xfs_mount_t *mp, xfs_trans_t *tp, xfs_ino_t ino, uint lock_flags,
xfs_inode_t **ipp, xfs_daddr_t bno)
xfs_inode_t *ip;
int error = 0;
- if (cache_node_get(libxfs_icache, &ino, (struct cache_node **)&ip)) {
-#ifdef INO_DEBUG
- fprintf(stderr, "%s: allocated inode, ino=%llu(%llu), %p\n",
- __FUNCTION__, (unsigned long long)ino, bno, ip);
-#endif
- ip->i_ino = ino;
- ip->i_mount = mp;
- error = xfs_iread(mp, tp, ip, bno);
- if (error) {
- cache_node_purge(libxfs_icache, &ino,
- (struct cache_node *)ip);
- ip = NULL;
- }
- }
- *ipp = ip;
- return error;
-}
+ ip = kmem_zone_zalloc(xfs_inode_zone, 0);
+ if (!ip)
+ return ENOMEM;
-void
-libxfs_iput(xfs_inode_t *ip, uint lock_flags)
-{
- cache_node_put(libxfs_icache, (struct cache_node *)ip);
-}
+ ip->i_ino = ino;
+ ip->i_mount = mp;
+ error = xfs_iread(mp, tp, ip, bno);
+ if (error) {
+ kmem_zone_free(xfs_inode_zone, ip);
+ *ipp = NULL;
+ return error;
+ }
-static struct cache_node *
-libxfs_ialloc(cache_key_t key)
-{
- return kmem_zone_zalloc(xfs_inode_zone, 0);
+ *ipp = ip;
+ return 0;
}
static void
libxfs_idestroy_fork(ip, XFS_ATTR_FORK);
}
-static void
-libxfs_irelse(struct cache_node *node)
-{
- xfs_inode_t *ip = (xfs_inode_t *)node;
-
- if (ip != NULL) {
- if (ip->i_itemp)
- kmem_zone_free(xfs_ili_zone, ip->i_itemp);
- ip->i_itemp = NULL;
- libxfs_idestroy(ip);
- kmem_zone_free(xfs_inode_zone, ip);
- ip = NULL;
- }
-}
-
void
-libxfs_icache_purge(void)
+libxfs_iput(xfs_inode_t *ip, uint lock_flags)
{
- cache_purge(libxfs_icache);
+ if (ip->i_itemp)
+ kmem_zone_free(xfs_ili_zone, ip->i_itemp);
+ ip->i_itemp = NULL;
+ libxfs_idestroy(ip);
+ kmem_zone_free(xfs_inode_zone, ip);
}
-
-struct cache_operations libxfs_icache_operations = {
- /* .hash */ libxfs_ihash,
- /* .alloc */ libxfs_ialloc,
- /* .flush */ NULL,
- /* .relse */ libxfs_irelse,
- /* .compare */ libxfs_icompare,
- /* .bulkrelse */ NULL
-};
supported are:
.RS 1.0i
.TP
-.BI ihash= ihashsize
-overrides the default inode cache hash size. The total number of
-inode cache entries are limited to 8 times this amount. The default
-.I ihashsize
-is 1024 (for a total of 8192 entries).
-.TP
.BI bhash= bhashsize
overrides the default buffer cache hash size. The total number of
buffer cache entries are limited to 8 times this amount. The default
* Need to drop references to inodes we still hold, first.
*/
libxfs_rtmount_destroy(mp);
- libxfs_icache_purge();
libxfs_bcache_purge();
/*
};
-static int ihash_option_used;
static int bhash_option_used;
static long max_mem_specified; /* in megabytes */
static int phase2_threads = 32;
pre_65_beta = 1;
break;
case IHASH_SIZE:
- libxfs_ihash_size = (int)strtol(val, NULL, 0);
- ihash_option_used = 1;
+ do_warn(
+ _("-o ihash option has been removed and will be ignored\n"));
break;
case BHASH_SIZE:
if (max_mem_specified)
do_abort(
- _("-o bhash option cannot be used with -m option\n"));
+ _("-o bhash option cannot be used with -m option\n"));
libxfs_bhash_size = (int)strtol(val, NULL, 0);
bhash_option_used = 1;
break;
unsigned long max_mem;
struct rlimit rlim;
- libxfs_icache_purge();
libxfs_bcache_purge();
- cache_destroy(libxfs_icache);
cache_destroy(libxfs_bcache);
mem_used = (mp->m_sb.sb_icount >> (10 - 2)) +
do_log(_(" - block cache size set to %d entries\n"),
libxfs_bhash_size * HASH_CACHE_RATIO);
- if (!ihash_option_used)
- libxfs_ihash_size = libxfs_bhash_size;
-
- libxfs_icache = cache_init(libxfs_ihash_size,
- &libxfs_icache_operations);
libxfs_bcache = cache_init(libxfs_bhash_size,
&libxfs_bcache_operations);
}