[dm-devel] [PATCH 2/3] dm thin metadata: do not write metadata if no changes occurred

Mike Snitzer snitzer at redhat.com
Tue Apr 16 02:39:03 UTC 2019


On Mon, Apr 15 2019 at  5:17pm -0400,
Mike Snitzer <snitzer at redhat.com> wrote:

> Otherwise, just loading a thin-pool and then removing it will cause its
> metadata to be changed (e.g. superblock written) -- even without any
> thin devices being made active or metadata snapshot being manipulated.
> 
> Add 'changed' flag to struct dm_pool_metadata.  Set both td->changed and
> pmd->changed using __set_thin_changed() -- this assures pmd->changed is
> always set when td->changed is.  For methods that don't involve changing
> a td, set pmd->changed directly.
> 
> Rename __delete_device() to __delete_thin() -- improves symmetry with
> __create_thin().
> 
> Update dm_pool_changed_this_transaction() to simply return pmd->changed.
> 
> Fix dm_pool_commit_metadata() to open the next transaction if the return
> from __commit_transaction() is 0.  Not seeing why the early return ever
> made since for a return of 0 given that dm-io's async_io(), as used by
> bufio, always returns 0.

This v1 patch was incomplete.  However this approach's need to establish
pmd->changed everywhere that alters metadata, without doing so in terms
of a thin device, is like whack-a-mole.

But I think this could be simplified to only set a 'pmd->accessed'
(never clear it) and only__commit_transaction() if pmd->accessed --
so only pool messages that change metadata would need to set
pmd->accessed.




More information about the dm-devel mailing list