Don't count a sector in the cache unless we manage to create it.

This commit is contained in:
Poul-Henning Kamp 2003-04-25 20:56:27 +00:00
parent f2314b445d
commit af6b9f17f9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114035

View File

@ -231,10 +231,10 @@ g_bde_get_sector(struct g_bde_work *wp, off_t offset)
if (sp != NULL && sp->ref > 0)
sp = NULL;
if (sp == NULL) {
g_bde_ncache++;
sc->ncache++;
sp = g_bde_new_sector(wp, sc->sectorsize);
if (sp != NULL) {
g_bde_ncache++;
sc->ncache++;
TAILQ_INSERT_TAIL(&sc->freelist, sp, list);
sp->malloc = 2;
}