X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=yaffs_guts.c;h=e8873e1debfd176641816a23490676e9eafddbec;hb=06781c4ca96ccdf097952eb97fe86b8db87b84b0;hp=ca1dd6a4c88f751e32ccef3e8490fc4bca107958;hpb=da27a11ac14cc0db3e7a8dbce75ec0ff18fb4334;p=yaffs2.git diff --git a/yaffs_guts.c b/yaffs_guts.c index ca1dd6a..e8873e1 100644 --- a/yaffs_guts.c +++ b/yaffs_guts.c @@ -13,7 +13,7 @@ */ const char *yaffs_guts_c_version = - "$Id: yaffs_guts.c,v 1.30 2006-03-01 08:14:32 charles Exp $"; + "$Id: yaffs_guts.c,v 1.31 2006-03-08 07:59:20 charles Exp $"; #include "yportenv.h" @@ -3037,6 +3037,36 @@ static void yaffs_FlushFilesChunkCache(yaffs_Object * obj) } +/*yaffs_FlushEntireDeviceCache(dev) + * + * + */ + +void yaffs_FlushEntireDeviceCache(yaffs_Device *dev) +{ + yaffs_Object *obj; + int nCaches = dev->nShortOpCaches; + int i; + + /* Find a dirty object in the cache and flush it... + * until there are no further dirty objects. + */ + do { + obj = NULL; + for( i = 0; i < nCaches && !obj; i++) { + if (dev->srCache[i].object && + dev->srCache[i].dirty) + obj = dev->srCache[i].object; + + } + if(obj) + yaffs_FlushFilesChunkCache(obj); + + } while(obj); + +} + + /* Grab us a cache chunk for use. * First look for an empty one. * Then look for the least recently used non-dirty one.