diff options
Diffstat (limited to 'fs/exofs')
| -rw-r--r-- | fs/exofs/Kconfig.ore | 2 | ||||
| -rw-r--r-- | fs/exofs/file.c | 10 | ||||
| -rw-r--r-- | fs/exofs/inode.c | 33 | ||||
| -rw-r--r-- | fs/exofs/ore.c | 145 | ||||
| -rw-r--r-- | fs/exofs/ore_raid.c | 60 | ||||
| -rw-r--r-- | fs/exofs/ore_raid.h | 21 | ||||
| -rw-r--r-- | fs/exofs/super.c | 2 | 
7 files changed, 157 insertions, 116 deletions
diff --git a/fs/exofs/Kconfig.ore b/fs/exofs/Kconfig.ore index 1ca7fb7b6ba..2daf2329c28 100644 --- a/fs/exofs/Kconfig.ore +++ b/fs/exofs/Kconfig.ore @@ -9,4 +9,6 @@ config ORE  	tristate  	depends on EXOFS_FS || PNFS_OBJLAYOUT  	select ASYNC_XOR +	select RAID6_PQ +	select ASYNC_PQ  	default SCSI_OSD_ULD diff --git a/fs/exofs/file.c b/fs/exofs/file.c index 491c6c078e7..71bf8e4fb5d 100644 --- a/fs/exofs/file.c +++ b/fs/exofs/file.c @@ -67,17 +67,17 @@ static int exofs_flush(struct file *file, fl_owner_t id)  const struct file_operations exofs_file_operations = {  	.llseek		= generic_file_llseek, -	.read		= do_sync_read, -	.write		= do_sync_write, -	.aio_read	= generic_file_aio_read, -	.aio_write	= generic_file_aio_write, +	.read		= new_sync_read, +	.write		= new_sync_write, +	.read_iter	= generic_file_read_iter, +	.write_iter	= generic_file_write_iter,  	.mmap		= generic_file_mmap,  	.open		= generic_file_open,  	.release	= exofs_release_file,  	.fsync		= exofs_file_fsync,  	.flush		= exofs_flush,  	.splice_read	= generic_file_splice_read, -	.splice_write	= generic_file_splice_write, +	.splice_write	= iter_file_splice_write,  };  const struct inode_operations exofs_file_inode_operations = { diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c index a52a5d23c30..3f9cafd7393 100644 --- a/fs/exofs/inode.c +++ b/fs/exofs/inode.c @@ -577,7 +577,7 @@ static struct page *__r4w_get_page(void *priv, u64 offset, bool *uptodate)  		if (offset >= i_size) {  			*uptodate = true; -			EXOFS_DBGMSG("offset >= i_size index=0x%lx\n", index); +			EXOFS_DBGMSG2("offset >= i_size index=0x%lx\n", index);  			return ZERO_PAGE(0);  		} @@ -596,10 +596,10 @@ static struct page *__r4w_get_page(void *priv, u64 offset, bool *uptodate)  			*uptodate = true;  		else  			*uptodate = PageUptodate(page); -		EXOFS_DBGMSG("index=0x%lx uptodate=%d\n", index, *uptodate); +		EXOFS_DBGMSG2("index=0x%lx uptodate=%d\n", index, *uptodate);  		return page;  	} else { -		EXOFS_DBGMSG("YES that_locked_page index=0x%lx\n", +		EXOFS_DBGMSG2("YES that_locked_page index=0x%lx\n",  			     pcol->that_locked_page->index);  		*uptodate = true;  		return pcol->that_locked_page; @@ -611,11 +611,11 @@ static void __r4w_put_page(void *priv, struct page *page)  	struct page_collect *pcol = priv;  	if ((pcol->that_locked_page != page) && (ZERO_PAGE(0) != page)) { -		EXOFS_DBGMSG("index=0x%lx\n", page->index); +		EXOFS_DBGMSG2("index=0x%lx\n", page->index);  		page_cache_release(page);  		return;  	} -	EXOFS_DBGMSG("that_locked_page index=0x%lx\n", +	EXOFS_DBGMSG2("that_locked_page index=0x%lx\n",  		     ZERO_PAGE(0) == page ? -1 : page->index);  } @@ -961,6 +961,14 @@ static void exofs_invalidatepage(struct page *page, unsigned int offset,  	WARN_ON(1);  } + + /* TODO: Should be easy enough to do proprly */ +static ssize_t exofs_direct_IO(int rw, struct kiocb *iocb, +		struct iov_iter *iter, loff_t offset) +{ +	return 0; +} +  const struct address_space_operations exofs_aops = {  	.readpage	= exofs_readpage,  	.readpages	= exofs_readpages, @@ -974,7 +982,7 @@ const struct address_space_operations exofs_aops = {  	/* Not implemented Yet */  	.bmap		= NULL, /* TODO: use osd's OSD_ACT_READ_MAP */ -	.direct_IO	= NULL, /* TODO: Should be trivial to do */ +	.direct_IO	= exofs_direct_IO,  	/* With these NULL has special meaning or default is not exported */  	.get_xip_mem	= NULL, @@ -1010,7 +1018,7 @@ static int _do_truncate(struct inode *inode, loff_t newsize)  	if (likely(!ret))  		truncate_setsize(inode, newsize); -	EXOFS_DBGMSG("(0x%lx) size=0x%llx ret=>%d\n", +	EXOFS_DBGMSG2("(0x%lx) size=0x%llx ret=>%d\n",  		     inode->i_ino, newsize, ret);  	return ret;  } @@ -1094,14 +1102,13 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,  		/* If object is lost on target we might as well enable it's  		 * delete.  		 */ -		if ((ret == -ENOENT) || (ret == -EINVAL)) -			ret = 0; +		ret = 0;  		goto out;  	}  	ret = extract_attr_from_ios(ios, &attrs[0]);  	if (ret) { -		EXOFS_ERR("%s: extract_attr of inode_data failed\n", __func__); +		EXOFS_ERR("%s: extract_attr 0 of inode failed\n", __func__);  		goto out;  	}  	WARN_ON(attrs[0].len != EXOFS_INO_ATTR_SIZE); @@ -1109,7 +1116,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,  	ret = extract_attr_from_ios(ios, &attrs[1]);  	if (ret) { -		EXOFS_ERR("%s: extract_attr of inode_data failed\n", __func__); +		EXOFS_ERR("%s: extract_attr 1 of inode failed\n", __func__);  		goto out;  	}  	if (attrs[1].len) { @@ -1124,7 +1131,7 @@ static int exofs_get_inode(struct super_block *sb, struct exofs_i_info *oi,  	ret = extract_attr_from_ios(ios, &attrs[2]);  	if (ret) { -		EXOFS_ERR("%s: extract_attr of inode_data failed\n", __func__); +		EXOFS_ERR("%s: extract_attr 2 of inode failed\n", __func__);  		goto out;  	}  	if (attrs[2].len) { @@ -1479,7 +1486,7 @@ void exofs_evict_inode(struct inode *inode)  	struct ore_io_state *ios;  	int ret; -	truncate_inode_pages(&inode->i_data, 0); +	truncate_inode_pages_final(&inode->i_data);  	/* TODO: should do better here */  	if (inode->i_nlink || is_bad_inode(inode)) diff --git a/fs/exofs/ore.c b/fs/exofs/ore.c index b7442288860..cfc0205d62c 100644 --- a/fs/exofs/ore.c +++ b/fs/exofs/ore.c @@ -58,9 +58,12 @@ int ore_verify_layout(unsigned total_comps, struct ore_layout *layout)  		layout->parity = 1;  		break;  	case PNFS_OSD_RAID_PQ: +		layout->parity = 2; +		break;  	case PNFS_OSD_RAID_4:  	default: -		ORE_ERR("Only RAID_0/5 for now\n"); +		ORE_ERR("Only RAID_0/5/6 for now received-enum=%d\n", +			layout->raid_algorithm);  		return -EINVAL;  	}  	if (0 != (layout->stripe_unit & ~PAGE_MASK)) { @@ -103,7 +106,7 @@ int ore_verify_layout(unsigned total_comps, struct ore_layout *layout)  	layout->max_io_length =  		(BIO_MAX_PAGES_KMALLOC * PAGE_SIZE - layout->stripe_unit) * -							layout->group_width; +					(layout->group_width - layout->parity);  	if (layout->parity) {  		unsigned stripe_length =  				(layout->group_width - layout->parity) * @@ -112,6 +115,8 @@ int ore_verify_layout(unsigned total_comps, struct ore_layout *layout)  		layout->max_io_length /= stripe_length;  		layout->max_io_length *= stripe_length;  	} +	ORE_DBGMSG("max_io_length=0x%lx\n", layout->max_io_length); +  	return 0;  }  EXPORT_SYMBOL(ore_verify_layout); @@ -286,7 +291,8 @@ int  ore_get_rw_state(struct ore_layout *layout, struct ore_components *oc,  	if (length) {  		ore_calc_stripe_info(layout, offset, length, &ios->si);  		ios->length = ios->si.length; -		ios->nr_pages = (ios->length + PAGE_SIZE - 1) / PAGE_SIZE; +		ios->nr_pages = ((ios->offset & (PAGE_SIZE - 1)) + +				 ios->length + PAGE_SIZE - 1) / PAGE_SIZE;  		if (layout->parity)  			_ore_post_alloc_raid_stuff(ios);  	} @@ -430,8 +436,12 @@ int ore_check_io(struct ore_io_state *ios, ore_on_dev_error on_dev_error)  		if (likely(!ret))  			continue; -		if (OSD_ERR_PRI_CLEAR_PAGES == osi.osd_err_pri) { -			/* start read offset passed endof file */ +		if ((OSD_ERR_PRI_CLEAR_PAGES == osi.osd_err_pri) && +		    per_dev->bio) { +			/* start read offset passed endof file. +			 * Note: if we do not have bio it means read-attributes +			 * In this case we should return error to caller. +			 */  			_clear_bio(per_dev->bio);  			ORE_DBGMSG("start read offset passed end of file "  				"offset=0x%llx, length=0x%llx\n", @@ -536,24 +546,28 @@ void ore_calc_stripe_info(struct ore_layout *layout, u64 file_offset,  	u64	H = LmodS - G * T;  	u32	N = div_u64(H, U); +	u32	Nlast;  	/* "H - (N * U)" is just "H % U" so it's bound to u32 */  	u32	C = (u32)(H - (N * U)) / stripe_unit + G * group_width; +	u32 first_dev = C - C % group_width;  	div_u64_rem(file_offset, stripe_unit, &si->unit_off);  	si->obj_offset = si->unit_off + (N * stripe_unit) +  				  (M * group_depth * stripe_unit); +	si->cur_comp = C - first_dev; +	si->cur_pg = si->unit_off / PAGE_SIZE;  	if (parity) {  		u32 LCMdP = lcm(group_width, parity) / parity;  		/* R     = N % LCMdP; */  		u32 RxP   = (N % LCMdP) * parity; -		u32 first_dev = C - C % group_width;  		si->par_dev = (group_width + group_width - parity - RxP) %  			      group_width + first_dev; -		si->dev = (group_width + C - RxP) % group_width + first_dev; +		si->dev = (group_width + group_width + C - RxP) % +			  group_width + first_dev;  		si->bytes_in_stripe = U;  		si->first_stripe_start = M * S + G * T + N * U;  	} else { @@ -568,6 +582,10 @@ void ore_calc_stripe_info(struct ore_layout *layout, u64 file_offset,  	si->length = T - H;  	if (si->length > length)  		si->length = length; + +	Nlast = div_u64(H + si->length + U - 1, U); +	si->maxdevUnits = Nlast - N; +  	si->M = M;  }  EXPORT_SYMBOL(ore_calc_stripe_info); @@ -583,13 +601,16 @@ int _ore_add_stripe_unit(struct ore_io_state *ios,  unsigned *cur_pg,  	int ret;  	if (per_dev->bio == NULL) { -		unsigned pages_in_stripe = ios->layout->group_width * -					(ios->layout->stripe_unit / PAGE_SIZE); -		unsigned nr_pages = ios->nr_pages * ios->layout->group_width / -					(ios->layout->group_width - -					 ios->layout->parity); -		unsigned bio_size = (nr_pages + pages_in_stripe) / -					ios->layout->group_width; +		unsigned bio_size; + +		if (!ios->reading) { +			bio_size = ios->si.maxdevUnits; +		} else { +			bio_size = (ios->si.maxdevUnits + 1) * +			     (ios->layout->group_width - ios->layout->parity) / +			     ios->layout->group_width; +		} +		bio_size *= (ios->layout->stripe_unit / PAGE_SIZE);  		per_dev->bio = bio_kmalloc(GFP_KERNEL, bio_size);  		if (unlikely(!per_dev->bio)) { @@ -609,8 +630,12 @@ int _ore_add_stripe_unit(struct ore_io_state *ios,  unsigned *cur_pg,  		added_len = bio_add_pc_page(q, per_dev->bio, pages[pg],  					    pglen, pgbase);  		if (unlikely(pglen != added_len)) { -			ORE_DBGMSG("Failed bio_add_pc_page bi_vcnt=%u\n", -				   per_dev->bio->bi_vcnt); +			/* If bi_vcnt == bi_max then this is a SW BUG */ +			ORE_DBGMSG("Failed bio_add_pc_page bi_vcnt=0x%x " +				   "bi_max=0x%x BIO_MAX=0x%x cur_len=0x%x\n", +				   per_dev->bio->bi_vcnt, +				   per_dev->bio->bi_max_vecs, +				   BIO_MAX_PAGES_KMALLOC, cur_len);  			ret = -ENOMEM;  			goto out;  		} @@ -632,6 +657,43 @@ out:	/* we fail the complete unit on an error eg don't advance  	return ret;  } +static int _add_parity_units(struct ore_io_state *ios, +			     struct ore_striping_info *si, +			     unsigned dev, unsigned first_dev, +			     unsigned mirrors_p1, unsigned devs_in_group, +			     unsigned cur_len) +{ +	unsigned do_parity; +	int ret = 0; + +	for (do_parity = ios->layout->parity; do_parity; --do_parity) { +		struct ore_per_dev_state *per_dev; + +		per_dev = &ios->per_dev[dev - first_dev]; +		if (!per_dev->length && !per_dev->offset) { +			/* Only/always the parity unit of the first +			 * stripe will be empty. So this is a chance to +			 * initialize the per_dev info. +			 */ +			per_dev->dev = dev; +			per_dev->offset = si->obj_offset - si->unit_off; +		} + +		ret = _ore_add_parity_unit(ios, si, per_dev, cur_len, +					   do_parity == 1); +		if (unlikely(ret)) +				break; + +		if (do_parity != 1) { +			dev = ((dev + mirrors_p1) % devs_in_group) + first_dev; +			si->cur_comp = (si->cur_comp + 1) % +						       ios->layout->group_width; +		} +	} + +	return ret; +} +  static int _prepare_for_striping(struct ore_io_state *ios)  {  	struct ore_striping_info *si = &ios->si; @@ -641,7 +703,6 @@ static int _prepare_for_striping(struct ore_io_state *ios)  	unsigned devs_in_group = group_width * mirrors_p1;  	unsigned dev = si->dev;  	unsigned first_dev = dev - (dev % devs_in_group); -	unsigned dev_order;  	unsigned cur_pg = ios->pages_consumed;  	u64 length = ios->length;  	int ret = 0; @@ -653,16 +714,13 @@ static int _prepare_for_striping(struct ore_io_state *ios)  	BUG_ON(length > si->length); -	dev_order = _dev_order(devs_in_group, mirrors_p1, si->par_dev, dev); -	si->cur_comp = dev_order; -	si->cur_pg = si->unit_off / PAGE_SIZE; -  	while (length) { -		unsigned comp = dev - first_dev; -		struct ore_per_dev_state *per_dev = &ios->per_dev[comp]; +		struct ore_per_dev_state *per_dev = +						&ios->per_dev[dev - first_dev];  		unsigned cur_len, page_off = 0; -		if (!per_dev->length) { +		if (!per_dev->length && !per_dev->offset) { +			/* First time initialize the per_dev info. */  			per_dev->dev = dev;  			if (dev == si->dev) {  				WARN_ON(dev == si->par_dev); @@ -671,13 +729,7 @@ static int _prepare_for_striping(struct ore_io_state *ios)  				page_off = si->unit_off & ~PAGE_MASK;  				BUG_ON(page_off && (page_off != ios->pgbase));  			} else { -				if (si->cur_comp > dev_order) -					per_dev->offset = -						si->obj_offset - si->unit_off; -				else /* si->cur_comp < dev_order */ -					per_dev->offset = -						si->obj_offset + stripe_unit - -								   si->unit_off; +				per_dev->offset = si->obj_offset - si->unit_off;  				cur_len = stripe_unit;  			}  		} else { @@ -691,11 +743,9 @@ static int _prepare_for_striping(struct ore_io_state *ios)  		if (unlikely(ret))  			goto out; -		dev += mirrors_p1; -		dev = (dev % devs_in_group) + first_dev; -  		length -= cur_len; +		dev = ((dev + mirrors_p1) % devs_in_group) + first_dev;  		si->cur_comp = (si->cur_comp + 1) % group_width;  		if (unlikely((dev == si->par_dev) || (!length && ios->sp2d))) {  			if (!length && ios->sp2d) { @@ -703,23 +753,16 @@ static int _prepare_for_striping(struct ore_io_state *ios)  				 * stripe. then operate on parity dev.  				 */  				dev = si->par_dev; -			} -			if (ios->sp2d) -				/* In writes cur_len just means if it's the -				 * last one. See _ore_add_parity_unit. -				 */ -				cur_len = length; -			per_dev = &ios->per_dev[dev - first_dev]; -			if (!per_dev->length) { -				/* Only/always the parity unit of the first -				 * stripe will be empty. So this is a chance to -				 * initialize the per_dev info. -				 */ -				per_dev->dev = dev; -				per_dev->offset = si->obj_offset - si->unit_off; +				/* If last stripe operate on parity comp */ +				si->cur_comp = group_width - ios->layout->parity;  			} -			ret = _ore_add_parity_unit(ios, si, per_dev, cur_len); +			/* In writes cur_len just means if it's the +			 * last one. See _ore_add_parity_unit. +			 */ +			ret = _add_parity_units(ios, si, dev, first_dev, +						mirrors_p1, devs_in_group, +						ios->sp2d ? length : cur_len);  			if (unlikely(ret))  					goto out; @@ -730,6 +773,8 @@ static int _prepare_for_striping(struct ore_io_state *ios)  			/* Next stripe, start fresh */  			si->cur_comp = 0;  			si->cur_pg = 0; +			si->obj_offset += cur_len; +			si->unit_off = 0;  		}  	}  out: @@ -1098,7 +1143,7 @@ int ore_truncate(struct ore_layout *layout, struct ore_components *oc,  		size_attr->attr = g_attr_logical_length;  		size_attr->attr.val_ptr = &size_attr->newsize; -		ORE_DBGMSG("trunc(0x%llx) obj_offset=0x%llx dev=%d\n", +		ORE_DBGMSG2("trunc(0x%llx) obj_offset=0x%llx dev=%d\n",  			     _LLU(oc->comps->obj.id), _LLU(obj_size), i);  		ret = _truncate_mirrors(ios, i * ios->layout->mirrors_p1,  					&size_attr->attr); diff --git a/fs/exofs/ore_raid.c b/fs/exofs/ore_raid.c index 7682b970d0f..7f20f25c232 100644 --- a/fs/exofs/ore_raid.c +++ b/fs/exofs/ore_raid.c @@ -21,12 +21,12 @@  #undef ORE_DBGMSG2  #define ORE_DBGMSG2 ORE_DBGMSG -struct page *_raid_page_alloc(void) +static struct page *_raid_page_alloc(void)  {  	return alloc_page(GFP_KERNEL);  } -void _raid_page_free(struct page *p) +static void _raid_page_free(struct page *p)  {  	__free_page(p);  } @@ -218,22 +218,28 @@ static unsigned _sp2d_max_pg(struct __stripe_pages_2d *sp2d)  static void _gen_xor_unit(struct __stripe_pages_2d *sp2d)  {  	unsigned p; +	unsigned tx_flags = ASYNC_TX_ACK; + +	if (sp2d->parity == 1) +		tx_flags |= ASYNC_TX_XOR_ZERO_DST; +  	for (p = 0; p < sp2d->pages_in_unit; p++) {  		struct __1_page_stripe *_1ps = &sp2d->_1p_stripes[p];  		if (!_1ps->write_count)  			continue; -		init_async_submit(&_1ps->submit, -			ASYNC_TX_XOR_ZERO_DST | ASYNC_TX_ACK, -			NULL, -			NULL, NULL, -			(addr_conv_t *)_1ps->scribble); - -		/* TODO: raid6 */ -		_1ps->tx = async_xor(_1ps->pages[sp2d->data_devs], _1ps->pages, -				     0, sp2d->data_devs, PAGE_SIZE, -				     &_1ps->submit); +		init_async_submit(&_1ps->submit, tx_flags, +			NULL, NULL, NULL, (addr_conv_t *)_1ps->scribble); + +		if (sp2d->parity == 1) +			_1ps->tx = async_xor(_1ps->pages[sp2d->data_devs], +						_1ps->pages, 0, sp2d->data_devs, +						PAGE_SIZE, &_1ps->submit); +		else /* parity == 2 */ +			_1ps->tx = async_gen_syndrome(_1ps->pages, 0, +						sp2d->data_devs + sp2d->parity, +						PAGE_SIZE, &_1ps->submit);  	}  	for (p = 0; p < sp2d->pages_in_unit; p++) { @@ -404,9 +410,8 @@ static int _add_to_r4w_last_page(struct ore_io_state *ios, u64 *offset)  	ore_calc_stripe_info(ios->layout, *offset, 0, &si); -	p = si.unit_off / PAGE_SIZE; -	c = _dev_order(ios->layout->group_width * ios->layout->mirrors_p1, -		       ios->layout->mirrors_p1, si.par_dev, si.dev); +	p = si.cur_pg; +	c = si.cur_comp;  	page = ios->sp2d->_1p_stripes[p].pages[c];  	pg_len = PAGE_SIZE - (si.unit_off % PAGE_SIZE); @@ -534,9 +539,8 @@ static int _read_4_write_last_stripe(struct ore_io_state *ios)  		goto read_it;  	ore_calc_stripe_info(ios->layout, offset, 0, &read_si); -	p = read_si.unit_off / PAGE_SIZE; -	c = _dev_order(ios->layout->group_width * ios->layout->mirrors_p1, -		       ios->layout->mirrors_p1, read_si.par_dev, read_si.dev); +	p = read_si.cur_pg; +	c = read_si.cur_comp;  	if (min_p == sp2d->pages_in_unit) {  		/* Didn't do it yet */ @@ -620,7 +624,7 @@ static int _read_4_write_execute(struct ore_io_state *ios)  int _ore_add_parity_unit(struct ore_io_state *ios,  			    struct ore_striping_info *si,  			    struct ore_per_dev_state *per_dev, -			    unsigned cur_len) +			    unsigned cur_len, bool do_xor)  {  	if (ios->reading) {  		if (per_dev->cur_sg >= ios->sgs_per_dev) { @@ -640,17 +644,16 @@ int _ore_add_parity_unit(struct ore_io_state *ios,  		si->cur_pg = _sp2d_min_pg(sp2d);  		num_pages  = _sp2d_max_pg(sp2d) + 1 - si->cur_pg; -		if (!cur_len) /* If last stripe operate on parity comp */ -			si->cur_comp = sp2d->data_devs; -  		if (!per_dev->length) {  			per_dev->offset += si->cur_pg * PAGE_SIZE;  			/* If first stripe, Read in all read4write pages  			 * (if needed) before we calculate the first parity.  			 */ -			_read_4_write_first_stripe(ios); +			if (do_xor) +				_read_4_write_first_stripe(ios);  		} -		if (!cur_len) /* If last stripe r4w pages of last stripe */ +		if (!cur_len && do_xor) +			/* If last stripe r4w pages of last stripe */  			_read_4_write_last_stripe(ios);  		_read_4_write_execute(ios); @@ -662,7 +665,7 @@ int _ore_add_parity_unit(struct ore_io_state *ios,  			++(ios->cur_par_page);  		} -		BUG_ON(si->cur_comp != sp2d->data_devs); +		BUG_ON(si->cur_comp < sp2d->data_devs);  		BUG_ON(si->cur_pg + num_pages > sp2d->pages_in_unit);  		ret = _ore_add_stripe_unit(ios,  &array_start, 0, pages, @@ -670,9 +673,10 @@ int _ore_add_parity_unit(struct ore_io_state *ios,  		if (unlikely(ret))  			return ret; -		/* TODO: raid6 if (last_parity_dev) */ -		_gen_xor_unit(sp2d); -		_sp2d_reset(sp2d, ios->r4w, ios->private); +		if (do_xor) { +			_gen_xor_unit(sp2d); +			_sp2d_reset(sp2d, ios->r4w, ios->private); +		}  	}  	return 0;  } diff --git a/fs/exofs/ore_raid.h b/fs/exofs/ore_raid.h index 2ffd2c3c6e4..cf6375d8212 100644 --- a/fs/exofs/ore_raid.h +++ b/fs/exofs/ore_raid.h @@ -31,24 +31,6 @@  #define ORE_DBGMSG2(M...) do {} while (0)  /* #define ORE_DBGMSG2 ORE_DBGMSG */ -/* Calculate the component order in a stripe. eg the logical data unit - * address within the stripe of @dev given the @par_dev of this stripe. - */ -static inline unsigned _dev_order(unsigned devs_in_group, unsigned mirrors_p1, -				  unsigned par_dev, unsigned dev) -{ -	unsigned first_dev = dev - dev % devs_in_group; - -	dev -= first_dev; -	par_dev -= first_dev; - -	if (devs_in_group == par_dev) /* The raid 0 case */ -		return dev / mirrors_p1; -	/* raid4/5/6 case */ -	return ((devs_in_group + dev - par_dev - mirrors_p1) % devs_in_group) / -	       mirrors_p1; -} -  /* ios_raid.c stuff needed by ios.c */  int _ore_post_alloc_raid_stuff(struct ore_io_state *ios);  void _ore_free_raid_stuff(struct ore_io_state *ios); @@ -56,7 +38,8 @@ void _ore_free_raid_stuff(struct ore_io_state *ios);  void _ore_add_sg_seg(struct ore_per_dev_state *per_dev, unsigned cur_len,  		 bool not_last);  int _ore_add_parity_unit(struct ore_io_state *ios, struct ore_striping_info *si, -		     struct ore_per_dev_state *per_dev, unsigned cur_len); +		     struct ore_per_dev_state *per_dev, unsigned cur_len, +		     bool do_xor);  void _ore_add_stripe_page(struct __stripe_pages_2d *sp2d,  		       struct ore_striping_info *si, struct page *page);  static inline void _add_stripe_page(struct __stripe_pages_2d *sp2d, diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 9d976332873..ed73ed8ebbe 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c @@ -543,7 +543,7 @@ static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev,  	return !(odi->systemid_len || odi->osdname_len);  } -int __alloc_dev_table(struct exofs_sb_info *sbi, unsigned numdevs, +static int __alloc_dev_table(struct exofs_sb_info *sbi, unsigned numdevs,  		      struct exofs_dev **peds)  {  	struct __alloc_ore_devs_and_exofs_devs {  | 
