亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? store_io_coss.c

?? 代理服務器 squid-2.6.STABLE16
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * $Id: store_io_coss.c,v 1.35 2006/11/05 21:14:32 hno Exp $ * * DEBUG: section 79    Storage Manager COSS Interface * AUTHOR: Eric Stern * * SQUID Web Proxy Cache          http://www.squid-cache.org/ * ---------------------------------------------------------- * *  Squid is the result of efforts by numerous individuals from *  the Internet community; see the CONTRIBUTORS file for full *  details.   Many organizations have provided support for Squid's *  development; see the SPONSORS file for full details.  Squid is *  Copyrighted (C) 2001 by the Regents of the University of *  California; see the COPYRIGHT file for full details.  Squid *  incorporates software developed and/or copyrighted by other *  sources; see the CREDITS file for full details. * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. *   *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. *   *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */#include "squid.h"#if HAVE_AIO_H#include <aio.h>#endif#include "async_io.h"#include "store_coss.h"#if USE_AUFSOPS#include "../aufs/async_io.h"#endif#if USE_AUFSOPSstatic AIOCB storeCossWriteMemBufDone;#elsestatic DWCB storeCossWriteMemBufDone;#endifstatic void storeCossIOCallback(storeIOState * sio, int errflag);static char *storeCossMemPointerFromDiskOffset(CossInfo * cs, off_t offset, CossMemBuf ** mb);static void storeCossMemBufLock(SwapDir * SD, storeIOState * e);static void storeCossMemBufUnlock(SwapDir * SD, storeIOState * e);static void storeCossWriteMemBuf(SwapDir * SD, CossMemBuf * t);static CossMemBuf *storeCossCreateMemBuf(SwapDir * SD, int stripe, sfileno curfn, int *collision);static CossMemBuf *storeCossCreateMemOnlyBuf(SwapDir * SD);static CBDUNL storeCossIOFreeEntry;static off_t storeCossFilenoToDiskOffset(sfileno f, CossInfo *);static sfileno storeCossDiskOffsetToFileno(off_t o, CossInfo *);static void storeCossMaybeWriteMemBuf(SwapDir * SD, CossMemBuf * t);static void storeCossMaybeFreeBuf(CossInfo * cs, CossMemBuf * mb);int storeCossFilenoToStripe(CossInfo * cs, sfileno filen);static void membuf_describe(CossMemBuf * t, int level, int line);/* Handle relocates - temporary routines until readops have been fleshed out */void storeCossNewPendingRelocate(CossInfo * cs, storeIOState * sio, sfileno original_filen, sfileno new_filen);CossPendingReloc *storeCossGetPendingReloc(CossInfo * cs, sfileno new_filen);#if USE_AUFSOPSAIOCB storeCossCompletePendingReloc;#elseDRCB storeCossCompletePendingReloc;#endif/* Read operation code */CossReadOp *storeCossCreateReadOp(CossInfo * cs, storeIOState * sio);void storeCossCompleteReadOp(CossInfo * cs, CossReadOp * op, int error);void storeCossKickReadOp(CossInfo * cs, CossReadOp * op);CBDATA_TYPE(storeIOState);CBDATA_TYPE(CossMemBuf);CBDATA_TYPE(CossPendingReloc);/* === PUBLIC =========================================================== */static sfilenostoreCossMemOnlyAllocate(SwapDir * SD, const StoreEntry * e){    CossInfo *cs = (CossInfo *) SD->fsdata;    CossMemBuf *newmb;    off_t retofs;    size_t allocsize;    sfileno f;    coss_stats.alloc.memalloc++;    allocsize = e->swap_file_sz;    if (cs->current_memonly_membuf == NULL) {	newmb = storeCossCreateMemOnlyBuf(SD);	cs->current_memonly_membuf = newmb;	if (newmb == NULL) {	    return -1;	}	cs->current_memonly_offset = cs->current_memonly_membuf->diskstart;    } else if ((cs->current_memonly_offset + allocsize) >= cs->current_memonly_membuf->diskend) {	debug(79, 3) ("storeCossMemOnlyAllocate: overflow for buffer %d (%p)\n", cs->curmemstripe, cs->current_memonly_membuf);	cs->current_memonly_membuf->flags.full = 1;	storeCossMaybeWriteMemBuf(SD, cs->current_memonly_membuf);	/* cs->current_memonly_membuf may be invalid at this point */	newmb = storeCossCreateMemOnlyBuf(SD);	cs->current_memonly_membuf = newmb;	if (newmb == NULL) {	    return -1;	}	cs->current_memonly_offset = cs->current_memonly_membuf->diskstart;    }    retofs = cs->current_memonly_offset;    cs->current_memonly_offset = retofs + allocsize;    cs->current_memonly_membuf->numobjs++;    cs->current_memonly_offset = ((cs->current_memonly_offset + cs->blksz_mask) >> cs->blksz_bits) << cs->blksz_bits;    f = storeCossDiskOffsetToFileno(retofs, cs);    assert(f >= 0 && f <= 0xffffff);    debug(79, 3) ("storeCossMemOnlyAllocate: offset %" PRId64 ", filen: %d\n", (int64_t) retofs, f);    return f;}/* * This routine sucks. I want to rewrite it when possible, and I also think * that we should check after creatmembuf() to see if the object has a * RELEASE_REQUEST set on it (thanks Eric!) rather than this way which seems * to work.. * -- Adrian */static sfilenostoreCossAllocate(SwapDir * SD, const StoreEntry * e, int which){    CossInfo *cs = (CossInfo *) SD->fsdata;    CossMemBuf *newmb;    off_t retofs;    size_t allocsize;    int coll = 0;    sfileno f;    sfileno checkf;    /* Make sure we chcek collisions if reallocating */    if (which == COSS_ALLOC_REALLOC) {	checkf = e->swap_filen;	coss_stats.alloc.realloc++;    } else {	checkf = -1;	coss_stats.alloc.alloc++;    }    if (e->swap_file_sz > 0)	allocsize = e->swap_file_sz;    else	allocsize = objectLen(e) + e->mem_obj->swap_hdr_sz;    /* Since we're not supporting NOTIFY anymore, lets fail */    assert(which != COSS_ALLOC_NOTIFY);    /* Check to see if we need to allocate a membuf to start */    if (cs->current_membuf == NULL) {	if (cs->curstripe < (cs->numstripes - 1))	    newmb = storeCossCreateMemBuf(SD, cs->curstripe + 1, checkf, &coll);	else	    newmb = storeCossCreateMemBuf(SD, 0, checkf, &coll);	cs->current_membuf = newmb;	if (newmb == NULL) {	    cs->sizerange_max = SD->max_objsize;	    return -1;	}	cs->current_offset = cs->current_membuf->diskstart;	/* Check if we have overflowed the disk .. */    } else if ((cs->current_offset + allocsize) > ((off_t) SD->max_size << 10)) {	/*	 * tried to allocate past the end of the disk, so wrap	 * back to the beginning	 */	coss_stats.disk_overflows++;	cs->current_membuf->flags.full = 1;	cs->numfullstripes++;	cs->current_membuf->diskend = cs->current_offset;	storeCossMaybeWriteMemBuf(SD, cs->current_membuf);	/* cs->current_membuf may be invalid at this point */	cs->current_offset = 0;	/* wrap back to beginning */	debug(79, 2) ("storeCossAllocate: %s: wrap to 0\n", stripePath(SD));	newmb = storeCossCreateMemBuf(SD, 0, checkf, &coll);	cs->current_membuf = newmb;	if (newmb == NULL) {	    cs->sizerange_max = SD->max_objsize;	    return -1;	}	/* Check if we have overflowed the MemBuf */    } else if ((cs->current_offset + allocsize) >= cs->current_membuf->diskend) {	/*	 * Skip the blank space at the end of the stripe. start over.	 */	coss_stats.stripe_overflows++;	cs->current_membuf->flags.full = 1;	cs->numfullstripes++;	cs->current_offset = cs->current_membuf->diskend;	storeCossMaybeWriteMemBuf(SD, cs->current_membuf);	/* cs->current_membuf may be invalid at this point */	debug(79, 3) ("storeCossAllocate: %s: New offset - %" PRId64 "\n", stripePath(SD),	    (int64_t) cs->current_offset);	assert(cs->curstripe < (cs->numstripes - 1));	newmb = storeCossCreateMemBuf(SD, cs->curstripe + 1, checkf, &coll);	cs->current_membuf = newmb;	if (newmb == NULL) {	    cs->sizerange_max = SD->max_objsize;	    return -1;	}    }    /* If we didn't get a collision, then update the current offset and return it */    if (coll == 0) {	retofs = cs->current_offset;	cs->current_offset = retofs + allocsize;	cs->current_membuf->numobjs++;	/* round up to our blocksize */	cs->current_offset = ((cs->current_offset + cs->blksz_mask) >> cs->blksz_bits) << cs->blksz_bits;	f = storeCossDiskOffsetToFileno(retofs, cs);	assert(f >= 0 && f <= 0xffffff);	debug(79, 3) ("storeCossAllocate: offset %" PRId64 ", filen: %d\n", (int64_t) retofs, f);	/* 	 * Keep track of the largest object we can accept based on the	 * max-wasted-space value	 */	cs->sizerange_max = cs->current_membuf->diskend - cs->current_offset;	if (cs->sizerange_max < cs->sizerange_min)	    cs->sizerange_max = cs->sizerange_min;	return f;    } else {	/* Reset this to a safe value */	cs->sizerange_max = SD->max_objsize;	coss_stats.alloc.collisions++;	debug(79, 3) ("storeCossAllocate: %s: Collision\n", stripePath(SD));	return -1;    }}voidstoreCossUnlink(SwapDir * SD, StoreEntry * e){    debug(79, 3) ("storeCossUnlink: %s: offset %d\n", stripePath(SD), e->swap_filen);    coss_stats.unlink.ops++;    coss_stats.unlink.success++;    storeCossRemove(SD, e);}voidstoreCossRecycle(SwapDir * SD, StoreEntry * e){    debug(79, 3) ("storeCossRecycle: %s: offset %d\n", stripePath(SD), e->swap_filen);    /* If there is a valid filen remove from COSS linked list */    if (e->swap_filen > -1) {	storeCossUnlink(SD, e);	/* 	 * Set filen and dirn to -1.  	 * This makes storeRelease() treat the entry differently 	 */	e->swap_filen = -1;	e->swap_dirn = -1;    }}static intstoreCossRelocateRequired(CossInfo * cs, sfileno f){    int stripes_written;    int original_stripe = storeCossFilenoToStripe(cs, f);    if (cs->curstripe > original_stripe)	stripes_written = cs->curstripe - original_stripe;    else	stripes_written = cs->numstripes + cs->curstripe - original_stripe;    /* Relocate if stripes_written > minimum_stripe_distance */    return (stripes_written > cs->minimum_stripe_distance);}storeIOState *storeCossCreate(SwapDir * SD, StoreEntry * e, STFNCB * file_callback, STIOCB * callback, void *callback_data){    CossState *cstate;    storeIOState *sio;    CossInfo *cs = SD->fsdata;    assert(cs->rebuild.rebuilding == 0);    coss_stats.create.ops++;    sio = cbdataAlloc(storeIOState);    cstate = memPoolAlloc(coss_state_pool);    sio->fsstate = cstate;    sio->offset = 0;    sio->mode = O_WRONLY | O_BINARY;    /*     * If we get handed an object with a size of -1,     * the squid code is broken     */    assert(e->mem_obj->object_sz != -1);    /*     * this one is kinda strange - Eric called storeCossAllocate(), then     * storeCossOpen(O_RDONLY) .. weird. Anyway, I'm allocating this now.     */    sio->st_size = objectLen(e) + e->mem_obj->swap_hdr_sz;    sio->swap_dirn = SD->index;    sio->swap_filen = storeCossAllocate(SD, e, COSS_ALLOC_ALLOCATE);    debug(79, 3) ("storeCossCreate: %p: filen: %d\n", sio, sio->swap_filen);    assert(-1 != sio->swap_filen);    sio->callback = callback;    sio->file_callback = file_callback;    sio->callback_data = callback_data;    cbdataLock(callback_data);    sio->e = (StoreEntry *) e;    cstate->flags.writing = 0;    cstate->flags.reading = 0;    cstate->reqdiskoffset = -1;    /* Now add it into the index list */    e->swap_filen = sio->swap_filen;    e->swap_dirn = sio->swap_dirn;    storeCossAdd(SD, e, cs->curstripe);    storeCossMemBufLock(SD, sio);    coss_stats.create.success++;    return sio;}storeIOState *storeCossOpen(SwapDir * SD, StoreEntry * e, STFNCB * file_callback,    STIOCB * callback, void *callback_data){    storeIOState *sio;    char *p;    CossState *cstate;    sfileno f = e->swap_filen;    sfileno nf;    CossInfo *cs = (CossInfo *) SD->fsdata;    assert(cs->rebuild.rebuilding == 0);    sio = cbdataAlloc(storeIOState);    cstate = memPoolAlloc(coss_state_pool);    debug(79, 3) ("storeCossOpen: %p: offset %d\n", sio, f);    coss_stats.open.ops++;    sio->fsstate = cstate;    sio->swap_filen = f;    sio->swap_dirn = SD->index;    sio->offset = 0;    sio->mode = O_RDONLY | O_BINARY;    sio->callback = callback;    sio->file_callback = file_callback;    sio->callback_data = callback_data;    cbdataLock(callback_data);    sio->st_size = e->swap_file_sz;    sio->e = e;    cstate->flags.writing = 0;    cstate->flags.reading = 0;    cstate->reqdiskoffset = -1;    /* make local copy so we don't have to lock membuf */    p = storeCossMemPointerFromDiskOffset(cs, storeCossFilenoToDiskOffset(f, cs), NULL);    if (p) {	coss_stats.open_mem_hits++;	// This seems to cause a crash: either the membuf pointer is set wrong or the membuf	// is deallocated from underneath us.	storeCossMemBufLock(SD, sio);	debug(79, 3) ("storeCossOpen: %s: memory hit!\n", stripePath(SD));    } else {	/* Do the allocation */	/* this is the first time we've been called on a new sio	 * read the whole object into memory, then return the 	 * requested amount	 */	coss_stats.open_mem_misses++;	/*	 * This bit of code actually does the LRU disk thing - we realloc	 * a place for the object here, and the file_read() reads the object	 * into the cossmembuf for later writing ..	 */	cstate->reqdiskoffset = storeCossFilenoToDiskOffset(sio->swap_filen, cs);	assert(cstate->reqdiskoffset >= 0);	/* If the object is allocated too recently, make a memory-only copy */	if (storeCossRelocateRequired(cs, sio->swap_filen)) {	    debug(79, 3) ("storeCossOpen: %s: memory miss - doing reallocation (Current stripe : %d  Object in stripe : %d)\n", stripePath(SD), cs->curstripe, storeCossFilenoToStripe(cs, sio->swap_filen));	    nf = storeCossAllocate(SD, e, COSS_ALLOC_REALLOC);	} else {	    debug(79, 3) ("storeCossOpen: %s memory miss - not reallocating (Current stripe : %d  Object in stripe : %d)\n", stripePath(SD), cs->curstripe, storeCossFilenoToStripe(cs, sio->swap_filen));	    nf = storeCossMemOnlyAllocate(SD, e);	    if (nf == -1) {		debug(79, 3) ("storeCossOpen: %s memory miss - reallocating because all membufs are in use\n", stripePath(SD));		nf = storeCossAllocate(SD, e, COSS_ALLOC_REALLOC);	    }	}	if (nf == -1) {	    /* We have to clean up neatly .. */	    coss_stats.open.fail++;	    cbdataFree(sio);	    cs->numcollisions++;	    debug(79, 3) ("storeCossOpen: Reallocation of %d/%d failed\n", e->swap_dirn, e->swap_filen);	    /* XXX XXX XXX Will squid call storeUnlink for this object? */	    return NULL;	}	if (nf < cs->max_disk_nf) {	    /* Remove the object from its currently-allocated stripe */	    storeCossRemove(SD, e);	    storeCossNewPendingRelocate(cs, sio, sio->swap_filen, nf);	    sio->swap_filen = nf;	    cstate->flags.reloc = 1;	    /* Notify the upper levels that we've changed file number */	    sio->file_callback(sio->callback_data, 0, sio);	    /*	     * lock the new buffer so it doesn't get swapped out on us	     * this will get unlocked in storeCossClose	     */	    storeCossMemBufLock(SD, sio);	    /*	     * Do the index magic to keep the disk and memory LRUs identical	     * by adding the object into the link list on the current stripe	     */	    storeCossAdd(SD, e, cs->curstripe);	} else {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久综合色8888| 久久精品久久综合| 久久99这里只有精品| 97超碰欧美中文字幕| 日韩欧美亚洲国产另类| 一区二区三区在线播放| 成人高清视频免费观看| 日韩欧美你懂的| 丝袜诱惑亚洲看片| 色一情一伦一子一伦一区| 久久精品这里都是精品| 久久精品国内一区二区三区| 欧美日韩国产天堂| 一区二区三区产品免费精品久久75 | 一区二区三区中文在线| 成人免费高清视频在线观看| 精品免费99久久| 蜜臀国产一区二区三区在线播放| 欧美亚洲国产一区二区三区 | 大桥未久av一区二区三区中文| 日韩视频一区二区在线观看| 五月天婷婷综合| 欧美精品色一区二区三区| 亚洲高清免费观看高清完整版在线观看| 99久久综合狠狠综合久久| 中文天堂在线一区| 国产91在线|亚洲| 国产欧美日韩在线看| 丁香婷婷综合激情五月色| 国产目拍亚洲精品99久久精品| 韩国欧美一区二区| 国产欧美一区二区精品性色 | 亚洲精品va在线观看| 91在线观看高清| 一区二区三区在线观看网站| 欧美亚洲一区二区在线| 日韩激情视频网站| 精品免费视频.| 成人在线一区二区三区| 综合久久久久久| 欧美日韩亚洲国产综合| 青青草国产成人99久久| 久久天天做天天爱综合色| 成人性生交大片免费看视频在线 | 日韩一区二区免费在线电影| 蜜臀av亚洲一区中文字幕| 精品国产不卡一区二区三区| 国产精品亚洲视频| 亚洲欧美国产三级| 欧美精品在欧美一区二区少妇| 久久av资源网| 最新国产成人在线观看| 69堂精品视频| 国产在线看一区| 日韩伦理av电影| 这里只有精品视频在线观看| 国产精品一区二区不卡| 亚洲精品日日夜夜| 久久这里只有精品视频网| gogo大胆日本视频一区| 图片区日韩欧美亚洲| 国产日本亚洲高清| 欧美日韩高清在线播放| 国产成人综合在线观看| 亚洲国产裸拍裸体视频在线观看乱了 | 国产69精品一区二区亚洲孕妇| 亚洲精品免费在线| 欧美大黄免费观看| 9人人澡人人爽人人精品| 日韩高清不卡一区| 国产精品天干天干在观线| 欧美日韩国产一二三| 成人综合婷婷国产精品久久蜜臀| 天堂蜜桃91精品| 亚洲三级在线播放| 精品国产乱码久久久久久1区2区 | 欧美国产国产综合| 欧美日韩精品一区二区| 成人av在线播放网址| 久久精品二区亚洲w码| 亚洲一区在线观看网站| 国产精品福利一区| 久久精品视频网| 欧美一级艳片视频免费观看| 欧美在线视频日韩| 99在线精品观看| 国产精品1024| 久久精品免费看| 免费人成在线不卡| 亚洲高清免费观看高清完整版在线观看| 亚洲国产精品成人综合 | 福利电影一区二区| 免费在线观看成人| 日日夜夜精品视频天天综合网| 亚洲情趣在线观看| 中文字幕 久热精品 视频在线 | 欧美日韩国产综合久久| 99精品在线观看视频| 成人小视频免费观看| 国产精品一二三四| 国产电影一区二区三区| 狠狠色丁香九九婷婷综合五月| 日本伊人精品一区二区三区观看方式 | 亚洲欧洲国产专区| 国产女人水真多18毛片18精品视频 | 欧美一区2区视频在线观看| 欧美日韩国产在线播放网站| 在线影视一区二区三区| 色综合久久综合网欧美综合网 | 精品日韩一区二区三区| 欧美一三区三区四区免费在线看 | 5月丁香婷婷综合| 69堂精品视频| 日韩欧美成人激情| 日韩一区二区三区电影在线观看 | 国产精品一区二区三区网站| 韩国成人福利片在线播放| 国产一区二区在线电影| 国产麻豆一精品一av一免费| 国产一区二区视频在线播放| 韩国精品久久久| 欧美三级资源在线| 欧美优质美女网站| 欧美精品一级二级| 日韩欧美的一区二区| 久久网这里都是精品| 国产精品久久久久影视| 亚洲另类中文字| 首页国产欧美日韩丝袜| 精品一区二区三区免费毛片爱| 国产综合成人久久大片91| 成人性生交大片免费看在线播放| 91麻豆swag| 日韩一级完整毛片| 欧美经典一区二区| 亚洲线精品一区二区三区八戒| 偷拍亚洲欧洲综合| 国产盗摄一区二区| 欧美专区在线观看一区| 欧美zozozo| 亚洲视频在线一区| 久久不见久久见免费视频7| 波多野结衣在线一区| 欧美日韩三级视频| 国产日产精品1区| 亚洲成人综合在线| 国产盗摄视频一区二区三区| 欧美体内she精高潮| 亚洲精品一区二区三区在线观看| 成人免费在线播放视频| 美女视频黄免费的久久| 色又黄又爽网站www久久| 精品久久国产字幕高潮| 一区二区成人在线| 国产麻豆一精品一av一免费| 欧美午夜精品电影| 国产精品天美传媒| 久久超碰97中文字幕| 欧美在线色视频| 国产精品网站一区| 美女免费视频一区| 欧美色欧美亚洲另类二区| 国产日韩欧美综合在线| 日日夜夜精品视频天天综合网| 国产精品免费看片| 精品一区二区三区在线观看国产| 91免费看片在线观看| 精品成人私密视频| 三级欧美在线一区| 色婷婷综合五月| 国产精品国产三级国产有无不卡| 免费人成黄页网站在线一区二区| 91在线观看污| 日本一区二区免费在线观看视频 | 欧美精品第1页| 中文字幕日韩欧美一区二区三区| 麻豆精品精品国产自在97香蕉| 欧美亚洲尤物久久| 玉足女爽爽91| 色综合色狠狠天天综合色| 国产女同互慰高潮91漫画| 久久99精品国产麻豆婷婷| 欧美绝品在线观看成人午夜影视| 成人免费一区二区三区视频| 成人午夜伦理影院| 国产欧美一区二区精品性色 | 成人午夜电影久久影院| 精品日韩在线观看| 精品一区二区在线视频| 精品日产卡一卡二卡麻豆| 免费成人在线观看| 欧美一区二区三区影视| 丝袜亚洲精品中文字幕一区| 欧美日韩国产区一| 视频一区视频二区中文| 欧美一级夜夜爽| 国产一区二区三区高清播放| 久久亚洲综合av| 国产+成+人+亚洲欧洲自线| 国产亚洲精品aa|