Deleted Added
full compact
ffs_snapshot.c (92640) ffs_snapshot.c (92728)
1/*
2 * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
3 *
4 * Further information about snapshots can be obtained from:
5 *
6 * Marshall Kirk McKusick http://www.mckusick.com/softdep/
7 * 1614 Oxford Street mckusick@mckusick.com
8 * Berkeley, CA 94709-1608 +1-510-843-9542

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)ffs_snapshot.c 8.11 (McKusick) 7/23/00
1/*
2 * Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
3 *
4 * Further information about snapshots can be obtained from:
5 *
6 * Marshall Kirk McKusick http://www.mckusick.com/softdep/
7 * 1614 Oxford Street mckusick@mckusick.com
8 * Berkeley, CA 94709-1608 +1-510-843-9542

--- 17 unchanged lines hidden (view full) ---

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)ffs_snapshot.c 8.11 (McKusick) 7/23/00
34 * $FreeBSD: head/sys/ufs/ffs/ffs_snapshot.c 92640 2002-03-19 04:09:21Z bde $
34 * $FreeBSD: head/sys/ufs/ffs/ffs_snapshot.c 92728 2002-03-19 22:40:48Z alfred $
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/conf.h>
40#include <sys/bio.h>
41#include <sys/buf.h>
42#include <sys/proc.h>

--- 12 unchanged lines hidden (view full) ---

55#include <ufs/ufs/ufs_extern.h>
56
57#include <ufs/ffs/fs.h>
58#include <ufs/ffs/ffs_extern.h>
59
60#define KERNCRED thread0.td_ucred
61#define DEBUG 1
62
35 */
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/conf.h>
40#include <sys/bio.h>
41#include <sys/buf.h>
42#include <sys/proc.h>

--- 12 unchanged lines hidden (view full) ---

55#include <ufs/ufs/ufs_extern.h>
56
57#include <ufs/ffs/fs.h>
58#include <ufs/ffs/ffs_extern.h>
59
60#define KERNCRED thread0.td_ucred
61#define DEBUG 1
62
63static int cgaccount __P((int, struct vnode *, struct buf *, int));
64static int expunge __P((struct vnode *, struct inode *, struct fs *,
65 int (*) __P((struct vnode *, ufs_daddr_t *, ufs_daddr_t *, struct fs *,
66 ufs_daddr_t, int)), int));
67static int indiracct __P((struct vnode *, struct vnode *, int, ufs_daddr_t,
68 int, int, int, int, struct fs *, int (*) __P((struct vnode *,
69 ufs_daddr_t *, ufs_daddr_t *, struct fs *, ufs_daddr_t, int)), int));
70static int fullacct __P((struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
71 struct fs *, ufs_daddr_t, int));
72static int snapacct __P((struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
73 struct fs *, ufs_daddr_t, int));
74static int mapacct __P((struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
75 struct fs *, ufs_daddr_t, int));
76static int ffs_copyonwrite __P((struct vnode *, struct buf *));
77static int readblock __P((struct buf *, daddr_t));
63static int cgaccount(int, struct vnode *, struct buf *, int);
64static int expunge(struct vnode *, struct inode *, struct fs *,
65 int (*)(struct vnode *, ufs_daddr_t *, ufs_daddr_t *, struct fs *,
66 ufs_daddr_t, int), int);
67static int indiracct(struct vnode *, struct vnode *, int, ufs_daddr_t,
68 int, int, int, int, struct fs *, int (*)(struct vnode *,
69 ufs_daddr_t *, ufs_daddr_t *, struct fs *, ufs_daddr_t, int), int);
70static int fullacct(struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
71 struct fs *, ufs_daddr_t, int);
72static int snapacct(struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
73 struct fs *, ufs_daddr_t, int);
74static int mapacct(struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
75 struct fs *, ufs_daddr_t, int);
76static int ffs_copyonwrite(struct vnode *, struct buf *);
77static int readblock(struct buf *, daddr_t);
78
79/*
80 * To ensure the consistency of snapshots across crashes, we must
81 * synchronously write out copied blocks before allowing the
82 * originals to be modified. Because of the rather severe speed
83 * penalty that this imposes, the following flag allows this
84 * crash persistence to be disabled.
85 */

--- 523 unchanged lines hidden (view full) ---

609 * that this snapshot knows that it need not copy them
610 * if the other snapshot holding them is freed.
611 */
612static int
613expunge(snapvp, cancelip, fs, acctfunc, expungetype)
614 struct vnode *snapvp;
615 struct inode *cancelip;
616 struct fs *fs;
78
79/*
80 * To ensure the consistency of snapshots across crashes, we must
81 * synchronously write out copied blocks before allowing the
82 * originals to be modified. Because of the rather severe speed
83 * penalty that this imposes, the following flag allows this
84 * crash persistence to be disabled.
85 */

--- 523 unchanged lines hidden (view full) ---

609 * that this snapshot knows that it need not copy them
610 * if the other snapshot holding them is freed.
611 */
612static int
613expunge(snapvp, cancelip, fs, acctfunc, expungetype)
614 struct vnode *snapvp;
615 struct inode *cancelip;
616 struct fs *fs;
617 int (*acctfunc) __P((struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
618 struct fs *, ufs_daddr_t, int));
617 int (*acctfunc)(struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
618 struct fs *, ufs_daddr_t, int);
619 int expungetype;
620{
621 int i, len, error, numblks, blksperindir;
622 ufs_daddr_t lbn, rlbn, blkno, indiroff;
623 struct thread *td = curthread;
624 struct dinode *dip;
625 struct buf *bp;
626

--- 66 unchanged lines hidden (view full) ---

693 struct vnode *cancelvp;
694 int level;
695 ufs_daddr_t blkno;
696 int lbn;
697 int rlbn;
698 int remblks;
699 int blksperindir;
700 struct fs *fs;
619 int expungetype;
620{
621 int i, len, error, numblks, blksperindir;
622 ufs_daddr_t lbn, rlbn, blkno, indiroff;
623 struct thread *td = curthread;
624 struct dinode *dip;
625 struct buf *bp;
626

--- 66 unchanged lines hidden (view full) ---

693 struct vnode *cancelvp;
694 int level;
695 ufs_daddr_t blkno;
696 int lbn;
697 int rlbn;
698 int remblks;
699 int blksperindir;
700 struct fs *fs;
701 int (*acctfunc) __P((struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
702 struct fs *, ufs_daddr_t, int));
701 int (*acctfunc)(struct vnode *, ufs_daddr_t *, ufs_daddr_t *,
702 struct fs *, ufs_daddr_t, int);
703 int expungetype;
704{
705 int subblksperindir, error, last, num, i;
706 struct indir indirs[NIADDR + 2];
707 ufs_daddr_t *bap;
708 struct buf *bp;
709
710 if ((error = ufs_getlbns(cancelvp, rlbn, indirs, &num)) != 0)

--- 688 unchanged lines hidden ---
703 int expungetype;
704{
705 int subblksperindir, error, last, num, i;
706 struct indir indirs[NIADDR + 2];
707 ufs_daddr_t *bap;
708 struct buf *bp;
709
710 if ((error = ufs_getlbns(cancelvp, rlbn, indirs, &num)) != 0)

--- 688 unchanged lines hidden ---