Re: [PATCH 1/10] dm snapshot: unify chunk_size

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

 



Alasdair G Kergon <[email protected]> wrote:
>
>  +	chunk_t chunk_size;

That's a sector_t.  (Bad DM people!  Why not just use sector_t?)

>   	r = chunk_io(ps, 0, READ);
>   	if (r)
>  @@ -210,8 +210,29 @@ static int read_header(struct pstore *ps
>   		*new_snapshot = 0;
>   		ps->valid = le32_to_cpu(dh->valid);
>   		ps->version = le32_to_cpu(dh->version);
>  -		ps->chunk_size = le32_to_cpu(dh->chunk_size);
>  -
>  +		chunk_size = le32_to_cpu(dh->chunk_size);
>  +		if (ps->snap->chunk_size != chunk_size) {
>  +			DMWARN("chunk size %llu in device metadata overrides "
>  +			       "table chunk size of %llu.",
>  +			       (unsigned long long)chunk_size,
>  +			       (unsigned long long)ps->snap->chunk_size);
>  +
>  +			/* We had a bogus chunk_size. Fix stuff up. */
>  +			dm_io_put(sectors_to_pages(ps->snap->chunk_size));
>  +			free_area(ps);
>  +
>  +			ps->snap->chunk_size = chunk_size;
>  +			ps->snap->chunk_mask = chunk_size - 1;
>  +			ps->snap->chunk_shift = ffs(chunk_size) - 1;

but ffs() takes an int.

I guess you weren't planning on chunks larger than 2TB ;)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux