Re: [PATCH 1/6] fs/bio-integrity: remove duplicate code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +static int bio_integrity_generate_verify(struct bio *bio, int operate)
>  {

> +	if (operate)
> +		sector = bio->bi_iter.bi_sector;
> +	else
> +		sector = bio->bi_integrity->bip_iter.bi_sector;

> +		if (operate) {
> +			bi->generate_fn(&bix);
> +		} else {
> +			ret = bi->verify_fn(&bix);
> +			if (ret) {
> +				kunmap_atomic(kaddr);
> +				return ret;
> +			}
> +		}

I was glad to see this replaced with explicit sector and func arguments
in later refactoring in the 6/ patch.

But I don't think the function poiner casts in that 6/ patch are wise
(Or even safe all the time, given crazy function pointer trampolines?
Is that still a thing?).  I'd have made a single walk_fn type that
returns and have the non-returning iterators just return 0.

- z

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]