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

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

?? rrc_raid5.c

?? create raid tool at linux
?? C
字號:
/* RAID5 driver for reconfiguration */#include "raidreconf.h"#include "rrc_common.h"/* private contextual data for this driver */typedef struct {	int		algorithm;		/* which parity computation */	int		raid_disks;		/* # disks in RAID	    */	int		data_disks;		/* # data disks in RAID     */	int		chunk_size;		/* bytes/chunk		    */	rrc_disk_t	*disks;			/* disk info array	    */	int		*disk_id_idx;		/* direct lookup of disk_id */	unsigned long	tot_chunks;		/* chunks in this RAID	    */	unsigned long	cur_block;		/* current block	    */	unsigned long	tot_blocks;		/* blocks to copy	    */	unsigned long	blocks_per_chunk;	/* should always be 1	    */	unsigned long	*disk_total_blocks;	/* # blocks for each disk   */} raid5_driver_private_t;/* function prototypes */static void *emalloc (int size);static unsigned long raid5_compute_sector (unsigned long, unsigned int *,     unsigned int *, raid5_driver_private_t *);static unsigned long compute_blocknr (raid5_driver_private_t *, int,     unsigned long);/* initialize this driver */static const char *raid5_initialize (void *context, md_cfg_entry_t *cfg, rrc_disk_t *cfgdisks,    unsigned long *blocks){	int d;	unsigned long max_disk_id = 0;	raid5_driver_private_t *ctx = (raid5_driver_private_t *) context;	if (cfg->array.param.level != 5)		return ("Wrong level for RAID-5 Driver");	if (cfg->array.param.nr_disks < 3)		return "Too few disks for RAID5";	ctx->raid_disks = cfg->array.param.nr_disks;	ctx->data_disks = ctx->raid_disks-1;	ctx->chunk_size = cfg->array.param.chunk_size;	ctx->algorithm = cfg->array.param.layout;	ctx->cur_block = 0;	ctx->disks = cfgdisks;	/* sum the total blocks in the array */	ctx->tot_chunks = 0;	for (d = 0; d < ctx->raid_disks; ++d)		ctx->tot_chunks += ctx->disks[d].chunks;	/* RAID5 uses one disk's worth of data for parity, so subtract it */	ctx->tot_chunks -= ctx->disks[0].chunks;	/* set up the disk_id -> disks[] mapping */	for (d = 0; d < ctx->raid_disks; ++d)		if (ctx->disks[d].disk_id > max_disk_id)			max_disk_id = ctx->disks[d].disk_id;	if (max_disk_id > 0) {		ctx->disk_id_idx = emalloc (sizeof (int) * (max_disk_id + 1));		for (d = 0; d < ctx->raid_disks; ++d)			ctx->disk_id_idx[ctx->disks[d].disk_id] = d;	}		ctx->blocks_per_chunk = (cfg->array.param.chunk_size / MD_BLK_SIZ) / 	    reconf_block_size;		*blocks = ctx->blocks_per_chunk * ctx->tot_chunks;	/* we only want to actually copy the MIN blocks of the arrays */	if (source_blocks && sink_blocks)		ctx->tot_blocks = MIN (source_blocks, sink_blocks);	else		ctx->tot_blocks = *blocks;	ctx->disk_total_blocks = emalloc (sizeof (unsigned long) * 	    ctx->raid_disks);	for (d = 0; d < ctx->raid_disks; ++d)		ctx->disk_total_blocks[d] = 		    cfgdisks[d].chunks * (ctx->chunk_size / MD_BLK_SIZ) / 		    reconf_block_size;	return NULL;}/* fill the wish_list with wishes for blocks we wish to write */static driver_status_traid5_request_blocks (void *context){	raid5_driver_private_t *ctx = (raid5_driver_private_t *) context;	while (ctx->cur_block < ctx->tot_blocks) {		if (!can_wish_again ())			return LDR_INCOMPLETE;		insert_wish (ctx->cur_block);		++ctx->cur_block;	}	return LDR_DONE;}/* update the super-block, tell the kernel about any new disks, and** start the array*/static const char *raid5_update_super (void *context){	unsigned long d;	int mdfile;	int rc;	mdu_param_t mdpar;	printf ("Updating superblocks...\n");	if (analyze_sb (&ver, mkraid, new_md_cfg, 1, 0, 1)) {		fprintf (stderr, "Error analyzing superblock.\n");		return "RAID-5 Superblock analysis error";	}	/* Tell the kernel about this */	mdfile = open (new_md_cfg->md_name, O_RDONLY);	if (mdfile < 0) {		static char grump[1024];		snprintf (grump, sizeof (grump), "can't open %s (%s).", 		    new_md_cfg->md_name, strerror (errno));		fprintf (stderr, "%s\n", grump);		return (grump);	}	/* turn off the clean state bit, 	** so the parity blocks will be recalculated	** "Unclean!  Unclean!"	*/	new_md_cfg->array.param.state &= ~(1 << MD_SB_CLEAN);	rc = ioctl (mdfile, SET_ARRAY_INFO, 	    (unsigned long) &new_md_cfg->array.param);	if (rc) {		fprintf (stderr, "Failed setting array info for device %s\n", 		    new_md_cfg->md_name);		return "RAID-5 Superblock info error";	}		printf ("Array is updated with kernel.\n");	for (d = 0; d != new_md_cfg->array.param.nr_disks; d++) {		rc = ioctl (mdfile, ADD_NEW_DISK,		    (unsigned long) (new_md_cfg->array.disks + d));		if (rc) {			static char grump[1024];			snprintf (grump, sizeof (grump), 			    "Failed adding disk %lu to array.", d);			fprintf (stderr, "%s\n", grump);			return (grump);		}	}	close (mdfile);	printf ("Disks re-inserted in array... "	    "Hold on while starting the array...\n");	mdfile = open (new_md_cfg->md_name, O_RDWR);	if (mdfile < 0) {		static char grump[1024];		snprintf (grump, sizeof (grump), "can't open %s (%s).", 		    new_md_cfg->md_name, strerror (errno));		fprintf (stderr, "%s\n", grump);		return (grump);	}	/* Now run the array ! */	memset (&mdpar, 0, sizeof (mdpar));	mdpar.personality = RAID5;	mdpar.chunk_size = new_md_cfg->array.param.chunk_size;	rc = ioctl (mdfile, RUN_ARRAY, (unsigned long) &mdpar);	close (mdfile);	if (rc) {		switch (errno) {		case EBUSY:			printf ("Array %s is already running\n", 			    new_md_cfg->md_name);			break;		default:			perror(new_md_cfg->md_name);		}		return "RAID-5 Superblock update error";	}	return 0;}/* the following func is lifted (and edited) from the kernel sources *//* * Input: a 'big' sector number, * Output: index of the data and parity disk, and the sector # in them. */static unsigned longraid5_compute_sector (unsigned long r_sector,     unsigned int *dd_idx,    unsigned int *pd_idx,     raid5_driver_private_t *ctx){	unsigned long stripe;	unsigned long chunk_number;	unsigned int chunk_offset;# ifdef TESTING# define PU(V)	printf ("%s = %lu ", #V, V)# else# define PU(V)# endif /* TESTING */	/* First compute the information on this sector */	/*	 * Compute the chunk number and the sector offset inside the chunk	 */	chunk_number = r_sector / ctx->blocks_per_chunk;	chunk_offset = r_sector % ctx->blocks_per_chunk;	PU (r_sector);	PU (chunk_number);	PU (chunk_offset);	/*	 * Compute the stripe number	 */	stripe = chunk_number / ctx->data_disks;	PU (stripe);	/*	 * Compute the data disk and parity disk indexes inside the stripe	 */	*dd_idx = chunk_number % ctx->data_disks;	/*	 * Select the parity disk based on the user selected algorithm.	 *//***********************************************************	if (ctx->level == 4)		*pd_idx = ctx->data_disks;	else ***********************************************************/	switch (ctx->algorithm) {	case RAID5_ALGORITHM_LEFT_ASYMMETRIC:		*pd_idx = ctx->data_disks - stripe % ctx->raid_disks;		if (*dd_idx >= *pd_idx)			(*dd_idx)++;		break;	case RAID5_ALGORITHM_RIGHT_ASYMMETRIC:		*pd_idx = stripe % ctx->raid_disks;		if (*dd_idx >= *pd_idx)			(*dd_idx)++;		break;	case RAID5_ALGORITHM_LEFT_SYMMETRIC:		*pd_idx = ctx->data_disks - stripe % ctx->raid_disks;		*dd_idx = (*pd_idx + 1 + *dd_idx) % ctx->raid_disks;		break;	case RAID5_ALGORITHM_RIGHT_SYMMETRIC:		*pd_idx = stripe % ctx->raid_disks;		*dd_idx = (*pd_idx + 1 + *dd_idx) % ctx->raid_disks;		break;	default:		fprintf (stderr, "raid5: unsupported algorithm %d\n", 		    ctx->algorithm);	}	PU (*dd_idx);	PU (*pd_idx);	/*	 * Finally, compute the new sector number	 */# ifdef TESTING	printf ("old sector # = %lu, new sector # = %lu\n", r_sector,	    stripe * blocks_per_chunk + chunk_offset);# endif	return stripe * ctx->blocks_per_chunk + chunk_offset;}static const char *raid5_map_global_to_local (void *context, unsigned long gblock, int *diskid,    unsigned long *lblock){	raid5_driver_private_t *ctx = (raid5_driver_private_t *) context;	int disk_idx, parity_id;# define ROUTINE	"raid5_map_global_to_local"	*lblock = raid5_compute_sector (gblock, &disk_idx, &parity_id, ctx);	if (*lblock >= ctx->disk_total_blocks[disk_idx]) {		fprintf (stderr, 		    "\n%s: disk %d block out of range: %lu (%lu) gblock = %lu\n",		    ROUTINE, disk_idx, *lblock, 		    ctx->disk_total_blocks[disk_idx], gblock);		abort ();	}	*diskid = ctx->disks[disk_idx].disk_id;	return (NULL);# undef ROUTINE}/* the following func is lifted from the kernel sources also */static unsigned longcompute_blocknr (raid5_driver_private_t *ctx, int i, unsigned long dblock){	int raid_disks = ctx->raid_disks, data_disks = raid_disks - 1;	unsigned long new_sector = dblock;	unsigned long stripe = new_sector / ctx->blocks_per_chunk;	int chunk_offset = new_sector % ctx->blocks_per_chunk;	int chunk_number, pd_idx;	unsigned long r_sector, blocknr;	/* compute the parity disk index "pd_idx" */	pd_idx = stripe % raid_disks;	if (ctx->algorithm == RAID5_ALGORITHM_LEFT_ASYMMETRIC ||	    ctx->algorithm == RAID5_ALGORITHM_LEFT_SYMMETRIC)		pd_idx = data_disks - pd_idx;	if (pd_idx == i)	/* parity block, flag it */		return (ULONG_MAX);	/* adjust the data disk index "i" */	switch (ctx->algorithm) {	case RAID5_ALGORITHM_LEFT_ASYMMETRIC:	case RAID5_ALGORITHM_RIGHT_ASYMMETRIC:		if (i > pd_idx)			i--;		break;	case RAID5_ALGORITHM_LEFT_SYMMETRIC:	case RAID5_ALGORITHM_RIGHT_SYMMETRIC:		if (i < pd_idx)			i += raid_disks;		i -= (pd_idx + 1);		break;	default:		fprintf (stderr, "raid5: unsupported algorithm %d\n", 		    ctx->algorithm);	}	/* calculate the new sector & block number */	chunk_number = stripe * data_disks + i;	r_sector = chunk_number * ctx->blocks_per_chunk + chunk_offset;	blocknr = r_sector;	return blocknr;}/* return the global block number from a sink disk id and disk-block */static unsigned longraid5_map_local_to_global (void *context, int disk_idx, unsigned long dblock){	raid5_driver_private_t *ctx = (raid5_driver_private_t *) context;	int disk_id = ctx->disks[ctx->disk_id_idx[disk_idx]].disk_id;	return compute_blocknr (ctx, disk_id, dblock);}/* for each block above gblock, mark as free */static voidraid5_free_blocks_above_gblock (void *context, unsigned long gblock){	raid5_driver_private_t *ctx = (raid5_driver_private_t *) context;	unsigned long block, dblock;	unsigned long tot_blocks = ctx->tot_chunks * ctx->blocks_per_chunk;	for (block = gblock; block < tot_blocks; ++block) {		int diskid;		raid5_map_global_to_local (ctx, block, &diskid, &dblock);		unchecked_mark_disk_block_free (diskid, dblock);	}}static voidraid5_unfree_all_blocks (void *context){	raid5_driver_private_t *ctx = (raid5_driver_private_t *) context;	int disk;	for (disk = 0; disk < ctx->raid_disks; ++disk) {		unsigned long block;		for (block = 0; block < ctx->disk_total_blocks[disk]; ++block)			mark_disk_block_unfree (ctx->disks[disk].disk_id, 			    block);	}}level_driver_t *new_raid5_driver (void){	level_driver_t *drv = malloc (sizeof (level_driver_t));	raid5_driver_private_t *ctx = malloc (sizeof (raid5_driver_private_t));	if (!drv || !ctx)		return (0);		drv->initialize = raid5_initialize;	drv->request_blocks = raid5_request_blocks;	drv->update_super = raid5_update_super;	drv->map_global_to_local = raid5_map_global_to_local;	drv->map_local_to_global = raid5_map_local_to_global;	drv->free_blocks_above_gblock = raid5_free_blocks_above_gblock;	drv->unfree_all_blocks = raid5_unfree_all_blocks;	drv->priv = ctx;	ctx->algorithm = -1;	ctx->raid_disks = 0;	ctx->data_disks = 0;	ctx->chunk_size = 0;	ctx->disks = NULL;	ctx->tot_chunks = 0;	ctx->blocks_per_chunk = 0;	ctx->disk_total_blocks = NULL;	return drv;}/* die on error from malloc */static void *emalloc (int size){	void *ret;	ret = malloc ((size_t) size);	if (ret == NULL) {		fprintf (stderr, "Out of memory: abort ()\n");		abort ();	}	return (ret);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产a| 亚洲午夜在线观看视频在线| 亚洲精品免费在线观看| 狠狠色狠狠色综合日日91app| 91麻豆精品在线观看| 久久久久久久一区| 日本在线播放一区二区三区| 91性感美女视频| 日本一区二区视频在线观看| 另类小说欧美激情| 精品视频一区二区不卡| 亚洲欧美一区二区三区国产精品| 国产一区二区剧情av在线| 欧美一区二区三区视频免费| 亚洲影院理伦片| 日本高清无吗v一区| 久久精品视频免费观看| 精品一区二区三区的国产在线播放| 欧美视频自拍偷拍| 一二三区精品视频| 91天堂素人约啪| 国产精品第四页| 成人综合在线观看| 国产精品网站在线播放| 成人深夜福利app| 国产欧美一区二区精品婷婷| 韩国毛片一区二区三区| 久久精品夜夜夜夜久久| 国产一区二区三区视频在线播放| 精品国产网站在线观看| 精品一区二区在线免费观看| 欧美videos中文字幕| 国产在线视频精品一区| 久久婷婷国产综合精品青草| 国产精品一区二区91| 国产亚洲欧美日韩在线一区| 国产91清纯白嫩初高中在线观看| 国产亚洲欧美日韩日本| av动漫一区二区| 自拍偷拍亚洲综合| 欧美三级视频在线观看| 午夜国产不卡在线观看视频| 日韩女优制服丝袜电影| 国产精品77777竹菊影视小说| 久久精品综合网| 91蜜桃视频在线| 天堂影院一区二区| 精品国产一区二区三区忘忧草 | 麻豆传媒一区二区三区| 日韩欧美一级特黄在线播放| 国模无码大尺度一区二区三区| 国产午夜精品久久久久久免费视| 风间由美一区二区av101| 亚洲精品视频观看| 日韩一区二区三区免费观看| 国产成都精品91一区二区三| 樱花草国产18久久久久| 日韩免费看的电影| 99久久综合精品| 日韩精品成人一区二区三区| 久久久亚洲高清| 在线视频观看一区| 国产在线视频精品一区| 亚洲美女区一区| 欧美成人一区二区三区片免费 | 欧美激情一区二区三区在线| 91老司机福利 在线| 午夜精品一区二区三区免费视频| 欧美v亚洲v综合ⅴ国产v| 91欧美激情一区二区三区成人| 午夜影院久久久| 国产日产欧美一区| 欧美精选一区二区| 成人动漫一区二区| 蜜桃在线一区二区三区| 亚洲视频电影在线| 久久久亚洲午夜电影| 欧美丝袜丝nylons| 成人国产免费视频| 日本v片在线高清不卡在线观看| 中文字幕一区在线观看| 亚洲精品一区二区三区精华液| 91麻豆成人久久精品二区三区| 久草在线在线精品观看| 一区二区三区**美女毛片| 久久亚洲私人国产精品va媚药| 色婷婷综合久久| 成人午夜激情片| 久久国产麻豆精品| 午夜精品一区二区三区电影天堂| 亚洲欧洲99久久| 2020日本不卡一区二区视频| 欧美日韩三级一区| 欧美亚洲综合久久| 91婷婷韩国欧美一区二区| 国产成人8x视频一区二区| 久久精品久久99精品久久| 亚洲成a人片在线不卡一二三区 | 99re热视频精品| 国产一区二区看久久| 六月丁香婷婷色狠狠久久| 日韩综合一区二区| 亚洲第一av色| 亚洲永久免费视频| 亚洲国产精品视频| 亚洲成人自拍一区| 亚洲精品欧美在线| 亚洲黄色性网站| 亚洲免费观看高清完整 | 久久精品无码一区二区三区| 日韩女优av电影在线观看| 日韩欧美久久久| 精品播放一区二区| 久久亚洲春色中文字幕久久久| 亚洲精品在线观看视频| www国产精品av| 久久久久久久免费视频了| 国产视频一区二区三区在线观看| 久久久精品影视| 日本一区二区三区国色天香 | 国产女人18水真多18精品一级做| 久久精品夜夜夜夜久久| 欧美激情中文字幕一区二区| 国产亚洲精品超碰| 国产精品色哟哟| 一区二区三区欧美亚洲| 亚洲午夜一区二区| 久久国产精品免费| 韩国精品免费视频| 成人精品视频一区二区三区尤物| 97se亚洲国产综合自在线不卡| 色激情天天射综合网| 欧美精品色一区二区三区| 欧美一区二区精品久久911| 2014亚洲片线观看视频免费| 国产精品国产自产拍高清av| 亚洲男人的天堂在线aⅴ视频| 亚洲观看高清完整版在线观看| 日本vs亚洲vs韩国一区三区| 国产精品1区2区3区在线观看| 不卡高清视频专区| 在线91免费看| 中文字幕欧美三区| 亚洲午夜激情网页| 国产麻豆91精品| 色呦呦网站一区| 欧美电影免费观看高清完整版在 | 国产999精品久久| 一本到高清视频免费精品| 欧美一区二区三区色| 国产精品少妇自拍| 蜜臀av性久久久久蜜臀av麻豆| www.欧美精品一二区| 91精品国产综合久久精品图片| 国产区在线观看成人精品| 亚洲v中文字幕| 成人做爰69片免费看网站| 日韩一区二区三区四区| 亚洲精品中文字幕乱码三区| 黄色日韩三级电影| 欧美喷水一区二区| 国产精品美女www爽爽爽| 日本不卡视频在线观看| 色综合色狠狠天天综合色| 欧美精品一区二区三区高清aⅴ | 91丨九色porny丨蝌蚪| 欧美mv日韩mv| 亚洲成人三级小说| 97国产一区二区| 久久久不卡影院| 精品亚洲porn| 日韩一区二区三区四区| 亚洲线精品一区二区三区八戒| 成人美女视频在线观看18| 欧美电影免费提供在线观看| 午夜精品一区二区三区电影天堂 | 国产欧美一区二区精品忘忧草| 日韩成人一级大片| 欧美日韩一区二区三区在线看| 国产精品美日韩| 国产黑丝在线一区二区三区| 日韩视频免费直播| 亚洲福利一区二区三区| 91免费观看视频| 国产精品卡一卡二| 成人小视频在线观看| 久久亚洲综合色一区二区三区| 毛片av一区二区| 日韩欧美电影一二三| 免费三级欧美电影| 91麻豆精品国产91久久久使用方法| 一区二区三区**美女毛片| 91美女片黄在线观看| 中文字幕一区三区| 91香蕉国产在线观看软件| 亚洲私人影院在线观看| 不卡一区中文字幕| 亚洲日本va午夜在线影院| 97久久超碰精品国产| 亚洲精品视频在线|