Lines Matching refs:ents

70 static int   flush_ents(cache_ent **ents, int n_ents);
811 static cache_ent *ents[NUM_FLUSH_BLOCKS];
831 ents[num_ents] = ce;
832 ents[num_ents]->flags |= CE_BUSY;
844 /* skip ents that meet the above criteria */;
849 ents[num_ents] = ce;
850 ents[num_ents]->flags |= CE_BUSY;
861 qsort(ents, num_ents, sizeof(cache_ent **), cache_ent_cmp);
863 if ((err = flush_ents(ents, num_ents)) != 0) {
864 printf("flush ents failed (ents @ 0x%lx, num_ents %d!\n",
865 (ulong)ents, num_ents);
869 ents[i]->flags &= ~CE_BUSY;
918 flush_ents(cache_ent **ents, int n_ents)
931 if ((ents[i]->flags & CE_DIRTY) == 0 && ents[i]->clone == NULL)
935 if (ents[i]->clone == NULL && ents[i]->lock != 0)
939 bsize = ents[i]->bsize;
940 start_bnum = ents[i]->block_num;
943 if (ents[j]->dev != ents[i]->dev ||
944 ents[j]->block_num != start_bnum + (j - i))
947 if (ents[j]->clone == NULL && ents[j]->lock != 0)
952 if ((ret = flush_cache_ent(ents[i])) != 0)
959 if (ents[k]->clone)
960 iov[iocnt].iov_base = ents[k]->clone;
962 iov[iocnt].iov_base = ents[k]->data;
971 ret = writev_pos(ents[i]->dev, start_bnum * (fs_off_t)bsize,
993 if (ents[k]->func) {
994 ents[k]->func(ents[k]->logged_bnum, 1, ents[k]->arg);
995 ents[k]->func = NULL;
998 if (ents[k]->clone) {
999 free(ents[k]->clone);
1000 ents[k]->clone = NULL;
1002 ents[k]->flags &= ~CE_DIRTY;
1025 if ((ents[i]->flags & CE_DIRTY) == 0 || ents[i]->lock)
1189 cache_ent *ents[NUM_FLUSH_BLOCKS];
1227 ents[cur++] = ce;
1232 qsort(ents, cur, sizeof(cache_ent **), cache_ent_cmp);
1234 flush_ents(ents, cur);
1238 ents[j]->flags &= ~CE_BUSY;
1248 qsort(ents, cur, sizeof(cache_ent **), cache_ent_cmp);
1250 flush_ents(ents, cur);
1254 ents[j]->flags &= ~CE_BUSY;
1315 do_flush(cache_ent **ents, int max)
1320 ents[i]->flags |= CE_BUSY;
1325 qsort(ents, max, sizeof(cache_ent **), cache_ent_cmp);
1326 flush_ents(ents, max);
1330 ents[i]->flags &= ~CE_BUSY;
1339 cache_ent *ents[NUM_FLUSH_BLOCKS];
1352 ents[cur++] = ce;
1354 do_flush(ents, cur);
1366 do_flush(ents, cur);
1377 ents[cur++] = ce;
1379 do_flush(ents, cur);
1391 do_flush(ents, cur);
1479 cache_ent *ents[NUM_FLUSH_BLOCKS];
1503 ents[cur++] = ce;
1508 qsort(ents, cur, sizeof(cache_ent **), cache_ent_cmp);
1509 flush_ents(ents, cur);
1513 ents[i]->flags &= ~CE_BUSY;
1525 qsort(ents, cur, sizeof(cache_ent **), cache_ent_cmp);
1526 flush_ents(ents, cur);
1529 ents[i]->flags &= ~CE_BUSY;
1632 get_ents(cache_ent **ents, int num_needed, int max, int *num_gotten, int bsize)
1642 ents[cur] = new_cache_ent(bsize);
1643 if (ents[cur] == NULL)
1658 ents[cur++] = ce;
1681 ((ents[cur-1]->flags & CE_DIRTY) || ents[cur-1]->clone)) {
1683 for(ce=ents[cur-1]->next; ce && cur < max; ce=ce->next) {
1691 ents[cur++] = ce;
1700 read_into_ents(int dev, fs_off_t bnum, cache_ent **ents, int num, int bsize)
1708 iov[i].iov_base = ents[i]->data;
1970 cache_ent *ents[NUM_FLUSH_BLOCKS];
2013 get_ents(ents, num_needed, NUM_FLUSH_BLOCKS, &real_nblocks, bsize);
2016 beos_panic("don't have enough cache ents "
2022 There are now three variables used as limits within the ents
2033 Below, we sort the list of ents so that when we flush them
2037 qsort(ents, real_nblocks, sizeof(cache_ent **), cache_ent_cmp);
2046 ce = ents[cur];
2060 dev, bnum + cur, ents[cur]);
2091 if (num_dirty && (err = flush_ents(ents, real_nblocks)) != 0) {
2092 printf("flush ents failed (ents @ %p, nblocks %d!\n",
2093 ents, cur_nblocks);
2111 if (ents[cur]->bsize != bsize) {
2112 free(ents[cur]->data);
2113 ents[cur]->data = NULL;
2115 if (ents[cur]->clone) {
2116 free(ents[cur]->clone);
2117 ents[cur]->clone = NULL;
2123 if (ents[cur]->data == NULL) {
2124 ents[cur]->data = (void *)malloc(bsize);
2125 ents[cur]->bsize = bsize;
2128 if (ents[cur]->data == NULL) {
2147 if (tmp_ce != ents[cur]) {
2150 ents[cur]);
2153 tmp_ce = (cache_ent *)hash_delete(&bc.ht,ents[cur]->dev,
2154 ents[cur]->block_num);
2155 if (tmp_ce != ents[cur]) {
2157 ents[cur]->dev, ents[cur]->block_num, tmp_ce,
2158 ents[cur]);
2161 ents[cur]->flags &= ~CE_BUSY;
2162 if (ents[cur]->data)
2163 free(ents[cur]->data);
2164 free(ents[cur]);
2165 ents[cur] = NULL;
2173 ents[cur]->flags &= ~CE_BUSY;
2176 add_to_tail(&bc.normal, ents[cur]);
2195 err = read_into_ents(dev, bnum, ents, num_needed, bsize);
2202 "data %p, ents[0] %p\n",
2204 bsize, data, ents[0]);
2221 ce = ents[cur];
2244 ents[cur]->flags &= ~CE_BUSY;
2246 if (ents[cur]->lock)
2248 ents[cur]);
2250 add_to_tail(&bc.normal, ents[cur]);
2261 if (tmp_ce != ents[cur]) {
2264 ents[cur]);
2267 ce = ents[cur];
2274 ents[cur] = NULL;
2290 ce = ents[cur];
2413 cache_ent *ents[NUM_FLUSH_BLOCKS];
2425 ents[count++] = ce;
2441 ents[count++] = ce;
2453 qsort(ents, count, sizeof(cache_ent **), cache_ent_cmp);
2454 flush_ents(ents, count);
2457 ents[i]->flags &= ~CE_BUSY;