When creating a snapshot, create a list of initially allocated blocks.

Whenever doing a copy-on-write check, first look in the list of
initially allocated blocks to see if it is there. If so, no further
check is needed. If not, fall through and do the full check. This
change eliminates one of two known deadlocks caused by snapshots.
Handling the second deadlock will be the subject of another check-in.
This change also reduces the cost of the copy-on-write check by
speeding up the verification of frequently checked blocks.

Sponsored by:	DARPA & NAI Labs.
This commit is contained in:
Kirk McKusick 2002-10-09 07:28:35 +00:00
parent 3f521b6022
commit 98d275df37

View File

@ -62,7 +62,9 @@
*/
struct inode {
LIST_ENTRY(inode) i_hash;/* Hash chain. */
TAILQ_ENTRY(inode) i_nextsnap; /* snapshot file list */
TAILQ_ENTRY(inode) i_nextsnap; /* snapshot file list. */
daddr_t i_snaplistsize; /* size of snapblklist. */
daddr_t *i_snapblklist; /* list of known snapshot blocks. */
struct vnode *i_vnode;/* Vnode associated with this inode. */
struct ufsmount *i_ump;/* Ufsmount point associated with this inode. */
struct vnode *i_devvp;/* Vnode for block I/O. */