UCPI_UBH(ucpi)->fragment = ufs_cgcmin(cgno);
UCPI_UBH(ucpi)->count = uspi->s_cgsize >> sb->s_blocksize_bits; /* * We have already the first fragment of cylinder group block in buffer
*/
UCPI_UBH(ucpi)->bh[0] = sbi->s_ucg[cgno]; for (i = 1; i < UCPI_UBH(ucpi)->count; i++) {
UCPI_UBH(ucpi)->bh[i] = sb_bread(sb, UCPI_UBH(ucpi)->fragment + i); if (!UCPI_UBH(ucpi)->bh[i]) goto failed;
}
sbi->s_cgno[bitmap_nr] = cgno;
if (uspi->s_ncg > UFS_MAX_GROUP_LOADED && bitmap_nr >= sbi->s_cg_loaded) {
ufs_panic (sb, "ufs_put_cylinder", "internal error"); return;
} /* * rotor is not so important data, so we put it to disk * at the end of working with cylinder
*/
ucg->cg_rotor = cpu_to_fs32(sb, ucpi->c_rotor);
ucg->cg_frotor = cpu_to_fs32(sb, ucpi->c_frotor);
ucg->cg_irotor = cpu_to_fs32(sb, ucpi->c_irotor);
ubh_mark_buffer_dirty (UCPI_UBH(ucpi)); for (i = 1; i < UCPI_UBH(ucpi)->count; i++) {
brelse (UCPI_UBH(ucpi)->bh[i]);
}
/* * Find cylinder group in cache and return it as pointer. * If cylinder group is not in cache, we will load it from disk. * * The cache is managed by LRU algorithm.
*/ struct ufs_cg_private_info * ufs_load_cylinder ( struct super_block * sb, unsigned cgno)
{ struct ufs_sb_info * sbi = UFS_SB(sb); struct ufs_sb_private_info * uspi; struct ufs_cg_private_info * ucpi; unsigned cg, i, j;
UFSD("ENTER, cgno %u\n", cgno);
uspi = sbi->s_uspi; if (cgno >= uspi->s_ncg) {
ufs_panic (sb, "ufs_load_cylinder", "internal error, high number of cg"); return NULL;
} /* * Cylinder group number cg it in cache and it was last used
*/ if (sbi->s_cgno[0] == cgno) {
UFSD("EXIT\n"); return sbi->s_ucpi[0];
} /* * Number of cylinder groups is not higher than UFS_MAX_GROUP_LOADED
*/ if (uspi->s_ncg <= UFS_MAX_GROUP_LOADED) { if (sbi->s_cgno[cgno] != UFS_CGNO_EMPTY) { if (sbi->s_cgno[cgno] != cgno) {
ufs_panic (sb, "ufs_load_cylinder", "internal error, wrong number of cg in cache");
UFSD("EXIT (FAILED)\n"); return NULL;
}
} else { if (unlikely(!ufs_read_cylinder (sb, cgno, cgno))) {
UFSD("EXIT (FAILED)\n"); return NULL;
}
}
UFSD("EXIT\n"); return sbi->s_ucpi[cgno];
} /* * Cylinder group number cg is in cache but it was not last used, * we will move to the first position
*/ for (i = 0; i < sbi->s_cg_loaded && sbi->s_cgno[i] != cgno; i++); if (i < sbi->s_cg_loaded && sbi->s_cgno[i] == cgno) {
cg = sbi->s_cgno[i];
ucpi = sbi->s_ucpi[i]; for (j = i; j > 0; j--) {
sbi->s_cgno[j] = sbi->s_cgno[j-1];
sbi->s_ucpi[j] = sbi->s_ucpi[j-1];
}
sbi->s_cgno[0] = cg;
sbi->s_ucpi[0] = ucpi; /* * Cylinder group number cg is not in cache, we will read it from disk * and put it to the first position
*/
} else { if (sbi->s_cg_loaded < UFS_MAX_GROUP_LOADED)
sbi->s_cg_loaded++; else
ufs_put_cylinder (sb, UFS_MAX_GROUP_LOADED-1);
ucpi = sbi->s_ucpi[sbi->s_cg_loaded - 1]; for (j = sbi->s_cg_loaded - 1; j > 0; j--) {
sbi->s_cgno[j] = sbi->s_cgno[j-1];
sbi->s_ucpi[j] = sbi->s_ucpi[j-1];
}
sbi->s_ucpi[0] = ucpi; if (unlikely(!ufs_read_cylinder (sb, cgno, 0))) {
UFSD("EXIT (FAILED)\n"); return NULL;
}
}
UFSD("EXIT\n"); return sbi->s_ucpi[0];
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.0 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.