6 StoreIoStats store_io_stats
;
9 * submit a request to create a cache object for writing.
10 * The StoreEntry structure is sent as a hint to the filesystem
11 * to what will be stored in this object, to allow the filesystem
12 * to select different polices depending on object size or type.
15 storeCreate(StoreEntry
* e
, StoreIOState::STFNCB
* file_callback
, StoreIOState::STIOCB
* close_callback
, void *callback_data
)
19 store_io_stats
.create
.calls
++;
23 * We assume that the header has been packed by now ..
25 const sdirno dirn
= storeDirSelectSwapDir(e
);
28 debugs(20, 2, "storeCreate: no swapdirs for " << *e
);
29 store_io_stats
.create
.select_fail
++;
33 debugs(20, 2, "storeCreate: Selected dir " << dirn
<< " for " << *e
);
34 SwapDir
*SD
= dynamic_cast<SwapDir
*>(INDEXSD(dirn
));
36 /* Now that we have a fs to use, call its storeCreate function */
37 StoreIOState::Pointer sio
= SD
->createStoreIO(*e
, file_callback
, close_callback
, callback_data
);
40 store_io_stats
.create
.create_fail
++;
42 store_io_stats
.create
.success
++;
48 * storeOpen() is purely for reading ..
51 storeOpen(StoreEntry
* e
, StoreIOState::STFNCB
* file_callback
, StoreIOState::STIOCB
* callback
,
54 return dynamic_cast<SwapDir
*>(e
->store().getRaw())->openStoreIO(*e
, file_callback
, callback
, callback_data
);
58 storeClose(StoreIOState::Pointer sio
, int how
)
60 if (sio
->flags
.closing
) {
61 debugs(20,3,HERE
<< "storeClose: flags.closing already set, bailing");
65 sio
->flags
.closing
= 1;
67 debugs(20,3,HERE
<< "storeClose: calling sio->close(" << how
<< ")");
72 storeRead(StoreIOState::Pointer sio
, char *buf
, size_t size
, off_t offset
, StoreIOState::STRCB
* callback
, void *callback_data
)
74 sio
->read_(buf
, size
, offset
, callback
, callback_data
);
78 storeIOWrite(StoreIOState::Pointer sio
, char const *buf
, size_t size
, off_t offset
, FREE
* free_func
)
80 sio
->write(buf
,size
,offset
,free_func
);