From 6a7f455bb129e867407fe1961328931ff704b3d2 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 12 Nov 2000 19:07:06 +0000 Subject: [PATCH] ChangeLog, inode.c: inode.c (ext2fs_flush_icache): Add new function ext2fs_flush_icache() which flushes the internal inode cache. Applications which modify the inode table blocks directly must call this function. --- lib/ext2fs/ChangeLog | 7 +++++++ lib/ext2fs/inode.c | 20 +++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index aebf9c1..17f47fd 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,10 @@ +2000-11-01 + + * inode.c (ext2fs_flush_icache): Add new function + ext2fs_flush_icache() which flushes the internal inode + cache. Applications which modify the inode table blocks + directly must call this function. + 2000-10-26 * mkjournal.c: Add #include of netinet/in.h, since Solaris diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c index 58c9d5d..590def4 100644 --- a/lib/ext2fs/inode.c +++ b/lib/ext2fs/inode.c @@ -54,10 +54,25 @@ struct ext2_struct_inode_scan { int reserved[6]; }; +/* + * This routine flushes the icache, if it exists. + */ +errcode_t ext2fs_flush_icache(ext2_filsys fs) +{ + int i; + + if (!fs->icache) + return 0; + + for (i=0; i < fs->icache->cache_size; i++) + fs->icache->cache[i].ino = 0; + + return 0; +} + static errcode_t create_icache(ext2_filsys fs) { errcode_t retval; - int i; if (fs->icache) return 0; @@ -84,8 +99,7 @@ static errcode_t create_icache(ext2_filsys fs) ext2fs_free_mem((void **) &fs->icache); return retval; } - for (i=0; i < fs->icache->cache_size; i++) - fs->icache->cache[i].ino = 0; + ext2fs_flush_icache(fs); return 0; } -- 1.8.3.1