dbEntryLimit(0),
fd(-1),
dbOffset(0),
- fileno(0)
+ filen(0)
{
assert(sd);
memset(&counts, 0, sizeof(counts));
failure("cannot read db header", errno);
dbOffset = SwapDir::HeaderSize;
- fileno = 0;
+ filen = 0;
checkpoint();
}
void
Rock::Rebuild::steps() {
- debugs(47,5, HERE << sd->index << " fileno " << fileno << " at " <<
+ debugs(47,5, HERE << sd->index << " filen " << filen << " at " <<
dbOffset << " <= " << dbSize);
const int maxCount = dbEntryLimit;
const int wantedCount = opt_foreground_rebuild ? maxCount : 50;
const int stepCount = min(wantedCount, maxCount);
- for (int i = 0; i < stepCount && dbOffset < dbSize; ++i, ++fileno) {
+ for (int i = 0; i < stepCount && dbOffset < dbSize; ++i, ++filen) {
doOneEntry();
dbOffset += dbEntrySize;
void
Rock::Rebuild::doOneEntry() {
- debugs(47,5, HERE << sd->index << " fileno " << fileno << " at " <<
+ debugs(47,5, HERE << sd->index << " filen " << filen << " at " <<
dbOffset << " <= " << dbSize);
++counts.scancount;
// skip empty slots
if (loadedE.swap_filen > 0 || loadedE.swap_file_sz > 0) {
counts.invalid++;
- //sd->unlink(fileno); leave garbage on disk, it should not hurt
+ //sd->unlink(filen); leave garbage on disk, it should not hurt
}
return;
}
counts.objcount++;
// loadedE->dump(5);
- sd->addEntry(fileno, header, loadedE);
+ sd->addEntry(filen, header, loadedE);
}
void
void
Rock::Rebuild::failure(const char *msg, int errNo) {
- debugs(47,5, HERE << sd->index << " fileno " << fileno << " at " <<
+ debugs(47,5, HERE << sd->index << " filen " << filen << " at " <<
dbOffset << " <= " << dbSize);
if (errNo)
if (!map || !theFile || !theFile->canRead())
return NULL;
- sfileno fileno;
- const Ipc::StoreMapSlot *const slot = map->openForReading(key, fileno);
+ sfileno filen;
+ const Ipc::StoreMapSlot *const slot = map->openForReading(key, filen);
if (!slot)
return NULL;
StoreEntry *e = new StoreEntry();
e->lock_count = 0;
e->swap_dirn = index;
- e->swap_filen = fileno;
+ e->swap_filen = filen;
e->swap_file_sz = basics.swap_file_sz;
e->lastref = basics.lastref;
e->timestamp = basics.timestamp;
/* Add a new object to the cache with empty memory copy and pointer to disk
* use to rebuild store from disk. Based on UFSSwapDir::addDiskRestore */
bool
-Rock::SwapDir::addEntry(const int fileno, const DbCellHeader &header, const StoreEntry &from)
+Rock::SwapDir::addEntry(const int filen, const DbCellHeader &header, const StoreEntry &from)
{
debugs(47, 8, HERE << &from << ' ' << from.getMD5Text() <<
- ", fileno="<< std::setfill('0') << std::hex << std::uppercase <<
- std::setw(8) << fileno);
+ ", filen="<< std::setfill('0') << std::hex << std::uppercase <<
+ std::setw(8) << filen);
sfileno newLocation = 0;
if (Ipc::StoreMapSlot *slot = map->openForWriting(reinterpret_cast<const cache_key *>(from.key), newLocation)) {
- if (fileno == newLocation) {
+ if (filen == newLocation) {
slot->set(from);
- map->extras(fileno) = header;
+ map->extras(filen) = header;
} // else some other, newer entry got into our cell
map->closeForWriting(newLocation, false);
- return fileno == newLocation;
+ return filen == newLocation;
}
return false;
const int64_t payloadEnd = sizeof(DbCellHeader) + header.payloadSize;
assert(payloadEnd <= max_objsize);
- sfileno fileno;
+ sfileno filen;
Ipc::StoreMapSlot *const slot =
- map->openForWriting(reinterpret_cast<const cache_key *>(e.key), fileno);
+ map->openForWriting(reinterpret_cast<const cache_key *>(e.key), filen);
if (!slot) {
debugs(47, 5, HERE << "Rock::SwapDir::createStoreIO: map->add failed");
return NULL;
}
e.swap_file_sz = header.payloadSize; // and will be copied to the map
slot->set(e);
- map->extras(fileno) = header;
+ map->extras(filen) = header;
// XXX: We rely on our caller, storeSwapOutStart(), to set e.fileno.
// If that does not happen, the entry will not decrement the read level!
IoState *sio = new IoState(this, &e, cbFile, cbIo, data);
sio->swap_dirn = index;
- sio->swap_filen = fileno;
+ sio->swap_filen = filen;
sio->payloadEnd = payloadEnd;
sio->diskOffset = diskOffset(sio->swap_filen);
- debugs(47,5, HERE << "dir " << index << " created new fileno " <<
+ debugs(47,5, HERE << "dir " << index << " created new filen " <<
std::setfill('0') << std::hex << std::uppercase << std::setw(8) <<
sio->swap_filen << std::dec << " at " << sio->diskOffset);
sio->payloadEnd = sizeof(DbCellHeader) + map->extras(e.swap_filen).payloadSize;
assert(sio->payloadEnd <= max_objsize); // the payload fits the slot
- debugs(47,5, HERE << "dir " << index << " has old fileno: " <<
+ debugs(47,5, HERE << "dir " << index << " has old filen: " <<
std::setfill('0') << std::hex << std::uppercase << std::setw(8) <<
sio->swap_filen);