[Crash-utility] [PATCH v2 5/5] diskdump: Warn on incomplete dumps
Roman Bolshakov
r.bolshakov at yadro.com
Thu Jul 8 13:40:17 UTC 2021
On Mon, Jun 21, 2021 at 06:02:51AM +0000, HAGIO KAZUHITO(萩尾 一仁) wrote:
> -----Original Message-----
> > +
> > + if (read_pd(dd->dfd, offset, &pd)) {
> > + /*
> > + * Truncated page descriptor at most
> > + * references full page.
> > + */
> > + expected_size += block_size;
> > + goto next;
> > + }
> > +
> > + if (pd.offset == 0) {
> > + if (!first_empty_pd)
> > + first_empty_pd = page_idx;
> > + /*
> > + * Incomplete pages at most use the
> > + * whole page.
> > + */
> > + expected_size += block_size;
> > + } else if (!pd.flags) {
> > + /*
> > + * Zero page has no compression flags.
> > + */
>
> Non-compressed page also has no compression flags.
>
> So something like (pd.offset == dd->data_offset) is needed to determine
> whether the page is zero page? although it's not exact without excluding
> zero pages.
>
Hi Kazu,
Yes, you're right. Thanks for spotting it.
I've added a code path for a case when zero pages are not it's excluded.
It's a no brainer. However, I've got some issues figuring out whether a
page descriptor references zero page when we start to differentiate
zero/non-zero uncompressed pages and calculate expected size accordingly.
dd->data_offset points to the beginning of page descriptors and it
doesn't help to find zero page:
data_offset -> pd for pfn 0
pd for pfn 1
...
pd for pfn N
... <-some gap ???
zero page
pfn 0
The essense of what I've got so far is the following:
if (page_idx == 0)
first_page_offset = pd.offset;
[...]
} else if (!pd.flags) {
/* The page is not compressed */
if (dd->flags & ZERO_EXCLUDED) {
/*
* Zero page is located just before the first
* dumpable pfn. The following pages are non-zero.
*/
if (pd.offset >= first_page_offset)
expected_size += block_size;
} else {
expected_size += block_size;
}
} else if (pd.flags) {
[...]
As you can see it would work but only if pd for pfn 0 doesn't reference
zero page. Do you have any idea how can we reliably determine zero page
offset?
Looking forward to your advice,
Roman
More information about the Crash-utility
mailing list