The NetBSD Project

CVS log for src/sys/ufs/lfs/lfs_accessors.h

[BACK] Up to [cvs.NetBSD.org] / src / sys / ufs / lfs

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.51 / (download) - annotate - [select for diffs], Sun Apr 24 20:32:44 2022 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, bouyer-sunxi-drm-base, bouyer-sunxi-drm, HEAD
Changes since 1.50: +103 -103 lines
Diff to previous 1.50 (colored)

lfs: fix lint warning about empty declaration

Revision 1.50 / (download) - annotate - [select for diffs], Mon Sep 7 02:28:12 2020 UTC (2 years, 5 months ago) by riastradh
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-i2c-spi-conf, thorpej-futex2-base, thorpej-futex2, thorpej-futex-base, thorpej-futex, thorpej-cfargs2-base, thorpej-cfargs2, thorpej-cfargs-base, thorpej-cfargs, cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.49: +37 -1 lines
Diff to previous 1.49 (colored)

Suppress -Waddress-of-packed-member just for lfs_accessors.h.

We can remove -Wno-error=address-of-packed-member from various
makefiles now.

Revision 1.48.12.1 / (download) - annotate - [select for diffs], Mon Aug 17 10:30:22 2020 UTC (2 years, 5 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE
Changes since 1.48: +3 -22 lines
Diff to previous 1.48 (colored) next main 1.49 (colored)

Pull up following revision(s) (requested by riastradh in ticket #1050):

	sys/ufs/lfs/lfs_subr.c: revision 1.101
	sys/ufs/lfs/lfs_subr.c: revision 1.102
	sys/ufs/lfs/lfs_inode.c: revision 1.158
	sys/ufs/lfs/lfs_inode.h: revision 1.25
	sys/ufs/lfs/lfs_balloc.c: revision 1.95
	sys/ufs/lfs/lfs_pages.c: revision 1.21
	sys/ufs/lfs/lfs_vnops.c: revision 1.330
	sys/ufs/lfs/lfs_alloc.c: revision 1.140 (patch)
	sys/ufs/lfs/lfs_alloc.c: revision 1.141 (patch)
	lib/libp2k/p2k.c: revision 1.72
	sys/ufs/lfs/lfs.h: revision 1.205
	sys/ufs/lfs/lfs.h: revision 1.206
	sys/ufs/lfs/lfs_segment.c: revision 1.284
	sys/ufs/lfs/lfs.h: revision 1.207
	sys/ufs/lfs/lfs_segment.c: revision 1.285
	sys/ufs/lfs/lfs_debug.c: revision 1.55
	sys/ufs/lfs/lfs_rename.c: revision 1.23
	usr.sbin/dumplfs/dumplfs.c: revision 1.65
	sys/ufs/lfs/lfs_vfsops.c: revision 1.371
	sys/arch/i386/stand/efiboot/bootx64/Makefile: revision 1.3
	sys/ufs/lfs/lfs_vfsops.c: revision 1.372
	sys/ufs/lfs/lfs_vfsops.c: revision 1.373
	sbin/fsck_lfs/pass1.c: revision 1.46
	sys/ufs/lfs/lfs_vnops.c: revision 1.326
	sys/ufs/lfs/lfs_vnops.c: revision 1.327
	sys/ufs/lfs/lfs_vfsops.c: revision 1.375 (patch)
	sys/ufs/lfs/lfs_vnops.c: revision 1.328
	sys/ufs/lfs/lfs_subr.c: revision 1.98
	sys/ufs/lfs/lfs_extern.h: revision 1.116
	sys/ufs/lfs/lfs_vnops.c: revision 1.329
	sys/ufs/lfs/lfs_subr.c: revision 1.99
	sys/ufs/lfs/lfs_extern.h: revision 1.117
	sys/ufs/lfs/lfs_accessors.h: revision 1.49
	sys/ufs/lfs/lfs_extern.h: revision 1.118
	sys/rump/fs/lib/liblfs/Makefile: revision 1.15
	sys/ufs/lfs/lfs_bio.c: revision 1.146 (patch)
	sys/ufs/lfs/lfs_bio.c: revision 1.147
	sys/ufs/lfs/lfs_subr.c: revision 1.100

Fix kassert in lfs by initializing vp first.

Use a marker node to iterate lfs_dchainhd / i_lfs_dchain.

I believe elements can be removed while the lock is dropped,
including the next node we're hanging on to.

Just use VOP_BWRITE for lfs_bwrite_log.
Hope this doesn't cause trouble with vfs_suspend.

Teach lfs to transition ro<->rw.

Prevent new dirops while we issue lfs_flush_dirops.

lfs_flush_dirops assumes (by KASSERT((ip->i_state & IN_ADIROP) == 0))
that vnodes on the dchain will not become involved in active dirops
even while holding no other locks (lfs_lock, v_interlock), so we must
set lfs_writer here.  All other callers already set lfs_writer.

We set fs->lfs_writer++ without explicitly doing lfs_writer_enter
because
(a) we already waited for the dirops to drain, and
(b) we hold lfs_lock and cannot drop it before setting lfs_writer.

Assert lfs_writer where I think we can now prove it.

Serialize access to the splay tree with lfs_lock.

Change some cheap KDASSERT into KASSERT.

Take a reference and fix assertions in lfs_flush_dirops.
Fixes panic:
KASSERT((ip->i_state & IN_ADIROP) == 0) at lfs_vnops.c:1670
lfs_flush_dirops
lfs_check
lfs_setattr
VOP_SETATTR
change_mode
sys_fchmod
syscall

This assertion -- and the assertion that vp->v_uflag has VU_DIROP set
-- is valid only until we release lfs_lock, because we may race with
lfs_unmark_dirop which will remove the nodes and change the flags.

Further, vp itself is valid only as long as it is referenced, which it
is as long as it's on the dchain, but lfs_unmark_dirop drops the
dchain's reference.

Don't lfs_writer_enter while holding v_interlock.

There's no need to lfs_writer_enter at all here, as far as I can see.
lfs_flush_fs will do it for us.

Break deadlock in PR kern/52301.

The lock order is lfs_writer -> lfs_seglock.  The problem in 52301 is
that lfs_segwrite violates this lock order by sometimes doing
lfs_seglock -> lfs_writer, either (a) when doing a checkpoint or (b),
opportunistically, when there are no dirops pending.  Both cases can
deadlock, because dirops sometimes take the seglock (lfs_truncate,
lfs_valloc, lfs_vfree):
(a) There may be dirops pending, and they may be waiting for the
seglock, so we can't wait for them to complete while holding the
seglock.
(b) The test for fs->lfs_dirops == 0 happens unlocked, and the state
may change by the time lfs_writer_enter acquires lfs_lock.

To resolve this in each case:
(a) Do lfs_writer_enter before lfs_seglock, since we will need it
unconditionally anyway.  The worst performance impact of this should
be that some dirops get delayed a little bit.
(b) Create a new lfs_writer_tryenter to use at this point so that the
test for fs->lfs_dirops == 0 and the acquisition of lfs_writer happen
atomically under lfs_lock.

Initialize/destroy lfs_allclean_wakeup in modcmd, not lfs_mountfs.

Fixes reloading lfs.kmod.

In lfs_update, hold lfs_writer around lfs_vflush.

Otherwise, we might do
lfs_vflush
-> lfs_seglock
-> lfs_segwait(SEGM_CKP)
   -> lfs_writer_enter
which is the reverse of the lfs_writer -> lfs_seglock ordering.

Call lfs_orphan in lfs_rename while we're still in the dirop.
lfs_writer_enter can't fail; keep it simple and don't pretend it can.

Assert that mtsleep can't fail either -- it doesn't catch signals and
there's no timeout.

Teach LFS_ORPHAN_NEXTFREE about lfs64.

Dust off the orphan detection code and try to make it work.

Fix !DIAGNOSTIC compile

Fix userland references to LFS_ORPHAN_NEXTFREE.

Forgot to grep for these or do a full distribution build, oops!

Fix missing <sys/evcnt.h> by removing the evcnts instead.

Just wanted to confirm that a race might happen, and indeed it did.
These serve little diagnostic value otherwise.

OR into bp->b_cflags; don't overwrite.

CTASSERT lfs on-disk structure sizes.

Avoid misaligned access to lfs64 on-disk records in memory.
lfs64 directory entries are only 32-bit aligned in order to conserve
space in directory blocks, and we had a hack to stuff a 64-bit inode
in them.  This replaces the hack by __aligned(4) __packed, and goes
further:

1. It's not clear that all the other lfs64 data structures are 64-bit
   aligned on disk to begin with.  We can go through these later and
   upgrade them from
        struct foo64 {
                ...
        } __aligned(4) __packed;
        union foo {
                struct foo64 f64;
                ...
        };
   to
        struct foo64 {
                ...
        };
        union foo {
                struct foo64 f64 __aligned(8);
                ...
        } __aligned(4) __packed;
   if we really want to take advantage of 64-bit memory accesses.
   However, the __aligned(4) __packed must remain on the union
   because:
2. We access even the lfs32 data structures via a union that has
   lfs64 members, and it turns out that compilers will assume access
   through a union with 64-bit aligned members implies the whole
   union has 64-bit alignment, even if we're only accessing a 32-bit
   aligned member.

Fix clang build after packed lfs64 accessor change.

Suppress spurious address-of-packed error in rump lfs too.

Revision 1.48.8.1 / (download) - annotate - [select for diffs], Wed Apr 8 14:09:04 2020 UTC (2 years, 10 months ago) by martin
Branch: phil-wifi
Changes since 1.48: +3 -22 lines
Diff to previous 1.48 (colored) next main 1.49 (colored)

Merge changes from current as of 20200406

Revision 1.49 / (download) - annotate - [select for diffs], Sat Mar 21 06:11:05 2020 UTC (2 years, 10 months ago) by riastradh
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh
Changes since 1.48: +3 -22 lines
Diff to previous 1.48 (colored)

Avoid misaligned access to lfs64 on-disk records in memory.

lfs64 directory entries are only 32-bit aligned in order to conserve
space in directory blocks, and we had a hack to stuff a 64-bit inode
in them.  This replaces the hack by __aligned(4) __packed, and goes
further:

1. It's not clear that all the other lfs64 data structures are 64-bit
   aligned on disk to begin with.  We can go through these later and
   upgrade them from

	struct foo64 {
		...
	} __aligned(4) __packed;

	union foo {
		struct foo64 f64;
		...
	};

   to

	struct foo64 {
		...
	};

	union foo {
		struct foo64 f64 __aligned(8);
		...
	} __aligned(4) __packed;

   if we really want to take advantage of 64-bit memory accesses.

   However, the __aligned(4) __packed must remain on the union
   because:

2. We access even the lfs32 data structures via a union that has
   lfs64 members, and it turns out that compilers will assume access
   through a union with 64-bit aligned members implies the whole
   union has 64-bit alignment, even if we're only accessing a 32-bit
   aligned member.

Revision 1.48.4.2 / (download) - annotate - [select for diffs], Sun Dec 3 11:39:22 2017 UTC (5 years, 2 months ago) by jdolecek
Branch: tls-maxphys
Changes since 1.48.4.1: +1531 -0 lines
Diff to previous 1.48.4.1 (colored) to branchpoint 1.48 (colored) next main 1.49 (colored)

update from HEAD

Revision 1.47.8.1 / (download) - annotate - [select for diffs], Mon Oct 30 09:29:04 2017 UTC (5 years, 3 months ago) by snj
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, matt-nb8-mediatek-base, matt-nb8-mediatek
Changes since 1.47: +15 -15 lines
Diff to previous 1.47 (colored) next main 1.48 (colored)

Pull up following revision(s) (requested by maya in ticket #330):
	sbin/fsck_lfs/inode.c: 1.69
	sbin/fsck_lfs/lfs.c: 1.73
	sbin/fsck_lfs/pass6.c: 1.50
	sbin/fsck_lfs/segwrite.c: 1.46
	sys/ufs/lfs/lfs.h: 1.202-1.203
	sys/ufs/lfs/lfs_accessors.h: 1.48
	sys/ufs/lfs/lfs_alloc.c: 1.136-1.137
	sys/ufs/lfs/lfs_balloc.c: 1.94
	sys/ufs/lfs/lfs_bio.c: 1.141
	sys/ufs/lfs/lfs_extern.h: 1.113
	sys/ufs/lfs/lfs_inode.c: 1.156-1.157
	sys/ufs/lfs/lfs_inode.h: 1.20, 1.21, 1.23
	sys/ufs/lfs/lfs_itimes.c: 1.20
	sys/ufs/lfs/lfs_pages.c: 1.13-1.15
	sys/ufs/lfs/lfs_rename.c: 1.22
	sys/ufs/lfs/lfs_segment.c: 1.270-1.275
	sys/ufs/lfs/lfs_subr.c: 1.94-1.97
	sys/ufs/lfs/lfs_syscalls.c: 1.175
	sys/ufs/lfs/lfs_vfsops.c: 1.360
	sys/ufs/lfs/lfs_vnops.c: 1.316-1.321
	sys/ufs/lfs/ulfs_inode.c: 1.20
	sys/ufs/lfs/ulfs_inode.h: 1.24
	sys/ufs/lfs/ulfs_lookup.c: 1.41
	sys/ufs/lfs/ulfs_quota2.c: 1.31
	sys/ufs/lfs/ulfs_readwrite.c: 1.24
	sys/ufs/lfs/ulfs_vnops.c: 1.49-1.50
Update inode member i_flag --> i_state to keep up with kernel changes
Move definition of IN_ALLMOD near the flag it's a mask for.
Now we can see that it doesn't match all the flags, but changing that will
require more careful thought.
Correct confusion between i_flag and i_flags
These will have to be renamed.
Spotted by Riastradh, thanks!
Add an XXX about the missing flags so it's not buried in a commit
message.
now the XXX count for LFS is 260
Rename i_flag to i_state.
The similarity to i_flags has previously caused errors.
Use continue to denote the no-op loop to match netbsd style
newline for extra clarity.
It isn't safe to drain dirops with seglock held, it'll deadlock if there
are any dirops. drain before grabbing seglock.
lfs_dirops == 0 is always true (as we already drained dirops), so omit
that part of the comparison.
Fixes a lot of LFS deadlocks. PR kern/52301
Many thanks to dholland for help analyzing coredumps
Ifdef out KDASSERT which fires on my machine.
Deduplicate sanity check that seglock is held on segunlock
Revert r1.272 fix to PR kern/52301, the performance hit is making things
unusable.
change lfs_nextsegsleep and lfs_allclean_wakeup to use condvar
XXX had to use lfs_lock in lfs_segwait, removed kernel_lock, is this
appropriate?
fix buffer overflow/KASSERT when cookies are supplied
lfs no longer uses the ffs-style struct direct, use the correct minimum
size
from dholland
XXX more wrong
Consistently use {,UN}MARK_VNODE macros rather than function calls.
Not much point doing anything after a panic call
Ask some question about the code in a XXX comment
XXX question our double-flushing of dirops
Fix typo in comment

Revision 1.33.2.7 / (download) - annotate - [select for diffs], Mon Aug 28 17:53:17 2017 UTC (5 years, 5 months ago) by skrll
Branch: nick-nhusb
Changes since 1.33.2.6: +15 -15 lines
Diff to previous 1.33.2.6 (colored) to branchpoint 1.33 (colored) next main 1.34 (colored)

Sync with HEAD

Revision 1.48.4.1, Sat Jun 10 05:29:36 2017 UTC (5 years, 7 months ago) by jdolecek
Branch: tls-maxphys
Changes since 1.48: +0 -1531 lines
FILE REMOVED

file lfs_accessors.h was added on branch tls-maxphys on 2017-12-03 11:39:22 +0000

Revision 1.48 / (download) - annotate - [select for diffs], Sat Jun 10 05:29:36 2017 UTC (5 years, 7 months ago) by maya
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202, phil-wifi-base, phil-wifi-20191119, phil-wifi-20190609, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, perseant-stdc-iso10646-base, perseant-stdc-iso10646, nick-nhusb-base-20170825, netbsd-9-base, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, isaki-audio2-base, isaki-audio2, is-mlppp-base, is-mlppp, ad-namecache-base3, ad-namecache-base2, ad-namecache-base1, ad-namecache-base, ad-namecache
Branch point for: tls-maxphys, phil-wifi, netbsd-9
Changes since 1.47: +15 -15 lines
Diff to previous 1.47 (colored)

Rename i_flag to i_state.

The similarity to i_flags has previously caused errors.

Revision 1.46.2.1 / (download) - annotate - [select for diffs], Mon Mar 20 06:57:54 2017 UTC (5 years, 10 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.46: +7 -7 lines
Diff to previous 1.46 (colored) next main 1.47 (colored)

Sync with HEAD

Revision 1.33.2.6 / (download) - annotate - [select for diffs], Sun Feb 5 13:41:01 2017 UTC (6 years ago) by skrll
Branch: nick-nhusb
Changes since 1.33.2.5: +7 -7 lines
Diff to previous 1.33.2.5 (colored) to branchpoint 1.33 (colored)

Sync with HEAD

Revision 1.47 / (download) - annotate - [select for diffs], Thu Jan 12 18:40:02 2017 UTC (6 years ago) by christos
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, pgoyette-localcount-20170320, nick-nhusb-base-20170204, netbsd-8-base, jdolecek-ncq-base, jdolecek-ncq, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Branch point for: netbsd-8
Changes since 1.46: +7 -7 lines
Diff to previous 1.46 (colored)

fix sign confusion

Revision 1.33.2.5 / (download) - annotate - [select for diffs], Sat Jul 9 20:25:25 2016 UTC (6 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.33.2.4: +55 -55 lines
Diff to previous 1.33.2.4 (colored) to branchpoint 1.33 (colored)

Sync with HEAD

Revision 1.46 / (download) - annotate - [select for diffs], Mon Jun 20 03:25:46 2016 UTC (6 years, 7 months ago) by dholland
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20170107, pgoyette-localcount-20161104, pgoyette-localcount-20160806, pgoyette-localcount-20160726, nick-nhusb-base-20161204, nick-nhusb-base-20161004, nick-nhusb-base-20160907, localcount-20160914
Branch point for: pgoyette-localcount
Changes since 1.45: +54 -54 lines
Diff to previous 1.45 (colored)

Massedit u_int{8,16,32,64}_t to uint{8,16,32,64}_t. This effectively
merges ufs/dinode.h 1.25.

Revision 1.45 / (download) - annotate - [select for diffs], Sun Jun 19 22:38:23 2016 UTC (6 years, 7 months ago) by dholland
Branch: MAIN
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored)

we are actually synced with ufs/dinode.h 1.24 and ufs/dir.h 1.25.

Revision 1.33.2.4 / (download) - annotate - [select for diffs], Sat Mar 19 11:30:39 2016 UTC (6 years, 10 months ago) by skrll
Branch: nick-nhusb
Changes since 1.33.2.3: +86 -81 lines
Diff to previous 1.33.2.3 (colored) to branchpoint 1.33 (colored)

Sync with HEAD

Revision 1.44 / (download) - annotate - [select for diffs], Fri Feb 19 04:18:32 2016 UTC (6 years, 11 months ago) by riastradh
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529, nick-nhusb-base-20160422, nick-nhusb-base-20160319
Changes since 1.43: +5 -5 lines
Diff to previous 1.43 (colored)

Explicitly cast between char and unsigned char here.

Revision 1.43 / (download) - annotate - [select for diffs], Fri Feb 19 03:43:42 2016 UTC (6 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.42: +21 -16 lines
Diff to previous 1.42 (colored)

Various housekeeping.

- Include <ufs/lfs/lfs.h> for union lfs_dinode &c.
- Include <string.h> or <sys/systm.h> for memcpy.
- Avoid signedness mismatch in lfs dino accessor for `rdev'.
- Avoid shadowing global `index'.

Revision 1.42 / (download) - annotate - [select for diffs], Sun Jan 10 16:14:27 2016 UTC (7 years ago) by christos
Branch: MAIN
Changes since 1.41: +62 -62 lines
Diff to previous 1.41 (colored)

there is no reason to use __unused here.

Revision 1.41 / (download) - annotate - [select for diffs], Sun Jan 10 02:40:21 2016 UTC (7 years ago) by dholland
Branch: MAIN
Changes since 1.40: +3 -3 lines
Diff to previous 1.40 (colored)

Fix two functions that were accidentally "static __unused" instead of
"static __unused inline". Oops; but probably not actually harmful.

Revision 1.33.2.3 / (download) - annotate - [select for diffs], Sun Dec 27 12:10:19 2015 UTC (7 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.33.2.2: +55 -15 lines
Diff to previous 1.33.2.2 (colored) to branchpoint 1.33 (colored)

Sync with HEAD (as of 26th Dec)

Revision 1.40 / (download) - annotate - [select for diffs], Mon Oct 19 04:22:28 2015 UTC (7 years, 3 months ago) by dholland
Branch: MAIN
CVS Tags: nick-nhusb-base-20151226
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

fix stupid typo in the 64-bit branch of the d_namlen accessor

Revision 1.39 / (download) - annotate - [select for diffs], Mon Oct 19 04:21:48 2015 UTC (7 years, 3 months ago) by dholland
Branch: MAIN
Changes since 1.38: +8 -5 lines
Diff to previous 1.38 (colored)

improve some panic messages

Revision 1.38 / (download) - annotate - [select for diffs], Thu Oct 15 06:24:21 2015 UTC (7 years, 3 months ago) by dholland
Branch: MAIN
Changes since 1.37: +1 -2 lines
Diff to previous 1.37 (colored)

Remove stray #define of lfs_magic
(the last of the fake superblock structure field macros)

Revision 1.37 / (download) - annotate - [select for diffs], Sat Oct 10 22:33:44 2015 UTC (7 years, 3 months ago) by dholland
Branch: MAIN
Changes since 1.36: +9 -9 lines
Diff to previous 1.36 (colored)

Add byteswapping to the inode block-pointer accessors.

Revision 1.36 / (download) - annotate - [select for diffs], Sat Oct 3 08:29:48 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.35: +3 -1 lines
Diff to previous 1.35 (colored)

Drop an explicit sign-extension in fsck that shouldn't be needed any
more.

Revision 1.35 / (download) - annotate - [select for diffs], Sat Oct 3 08:28:16 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.34: +4 -1 lines
Diff to previous 1.34 (colored)

Use IINFO in lfs_writeinode().
(both the kernel and the userland copies)

Revision 1.34 / (download) - annotate - [select for diffs], Sat Oct 3 08:27:38 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.33: +34 -1 lines
Diff to previous 1.33 (colored)

Add an IINFO struct, which is like the FINFO struct but for the inode
blocks portion of the segment summary.

A segment summary block begins with a header (SEGSUM); the rest of the
block contains FINFO structures describing file blocks growing upward
from the bottom (after the header), and IINFO structures describing
inode blocks grown downward from the end of the block. (When they meet
the segment is full regardless of how many blocks might be left.)

IINFO contains just a block number, and until now this information was
handled by just using uint32_t*; switching to a structure will make
the code a lot easier to read, and also make it easier to have 32-bit
and 64-bit versions without making a mess.

This commit just adds the structures and accessors; they'll be
deployed into the code in subsequent commits.

Revision 1.33.2.2 / (download) - annotate - [select for diffs], Tue Sep 22 12:06:17 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.33.2.1: +1486 -0 lines
Diff to previous 1.33.2.1 (colored) to branchpoint 1.33 (colored)

Sync with HEAD

Revision 1.33.2.1, Mon Sep 21 01:24:58 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.33: +0 -1486 lines
FILE REMOVED

file lfs_accessors.h was added on branch nick-nhusb on 2015-09-22 12:06:17 +0000

Revision 1.33 / (download) - annotate - [select for diffs], Mon Sep 21 01:24:58 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
CVS Tags: nick-nhusb-base-20150921
Branch point for: nick-nhusb
Changes since 1.32: +6 -3 lines
Diff to previous 1.32 (colored)

Fix some assorted 32-bit assumptions not yet otherwise handled.

Also apply patch to fix the overt problem in PR 50246: newfs was
calculating ifpb wrong for volumes with non-default block sizes.

Revision 1.32 / (download) - annotate - [select for diffs], Mon Sep 21 01:24:39 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

Oops, I forgot to make the atime in the 64-bit IFILE 64 bits.
Correct that. Incompatible change, but no LFS64 volumes can have been
created yet.

Revision 1.31 / (download) - annotate - [select for diffs], Mon Sep 21 01:24:23 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.30: +110 -31 lines
Diff to previous 1.30 (colored)

Add 64-bit directory entry structures, and adjust accessors accordingly.

The LFS64 directory entry has a 64-bit inode number. This is stored as
two 32-bit values to avoid inducing 64-bit alignment requirements.

The exposed type for manipulating directory entries is now
LFS_DIRHEADER, following the same convention as e.g. IFILE and SEGUSE.
(But with LFS_ on it, because.)

Revision 1.30 / (download) - annotate - [select for diffs], Mon Sep 21 01:22:18 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.29: +11 -3 lines
Diff to previous 1.29 (colored)

Oops; LFS_DIRECTSIZ() is going to need the fs as an argument.

Also, it turns out that dirhash needs a compile-time-constant version
of LFS_DIRECTSIZ(LFS_MAXNAMLEN+1), independent of 64-vs-32, so create
LFS_MAXDIRENTRYSIZE for this. Sigh.

Revision 1.29 / (download) - annotate - [select for diffs], Sun Sep 20 04:51:43 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.28: +1 -73 lines
Diff to previous 1.28 (colored)

Clean up struct lfs_dirtemplate.

Revision 1.28 / (download) - annotate - [select for diffs], Sun Sep 20 04:50:58 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.27: +8 -3 lines
Diff to previous 1.27 (colored)

Fix glaringly stupid overflow/sizing bug in -r1.25. The part I don't
get is how it passed testing...

Revision 1.27 / (download) - annotate - [select for diffs], Tue Sep 15 15:02:25 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.26: +23 -23 lines
Diff to previous 1.26 (colored)

Pass around struct lfs_dirheader instead of struct lfs_direct.

Revision 1.26 / (download) - annotate - [select for diffs], Tue Sep 15 15:02:01 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.25: +7 -1 lines
Diff to previous 1.25 (colored)

Add an accessor function for directory names.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Sep 15 15:01:38 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.24: +12 -1 lines
Diff to previous 1.24 (colored)

Add a function lfs_copydirname() to copy directory names in place; use
it in place of (variously) memcpy and strlcpy. (The latter isn't even
correct; was probably changed blindly from strncpy at some point.)

The new function zeroes the padding in the directory entry instead of
leaving trash behind.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Sep 15 14:59:58 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.23: +11 -11 lines
Diff to previous 1.23 (colored)

Move the header part of struct lfs_direct to its own structure.
(lfs_dirheader)

Take the opportunity to improve the directory generation code in
make_lfs.c. (Everything else was unaffected by virtue of using
accessor functions.)

Revision 1.23 / (download) - annotate - [select for diffs], Tue Sep 15 14:58:06 2015 UTC (7 years, 4 months ago) by dholland
Branch: MAIN
Changes since 1.22: +28 -1 lines
Diff to previous 1.22 (colored)

Add and use accessor functions for more of the directory entry fields.

Revision 1.22 / (download) - annotate - [select for diffs], Tue Sep 1 06:16:59 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.21: +152 -1 lines
Diff to previous 1.21 (colored)

Add new accessors for the d_type and d_namlen fields of struct lfs_direct.
Napalm the old byteswap access logic for these.

Revision 1.21 / (download) - annotate - [select for diffs], Tue Sep 1 06:13:09 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.20: +1 -6 lines
Diff to previous 1.20 (colored)

Fix up indirect block handling in truncate to be 32/64 clean.

Revision 1.20 / (download) - annotate - [select for diffs], Tue Sep 1 06:12:33 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.19: +8 -4 lines
Diff to previous 1.19 (colored)

Tidy the MAXSYMLINKLEN macros.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Sep 1 06:12:04 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

The ifile's inode number is constant. (it is always 1)

Therefore, storing the value in the superblock and reading it out
again is silly and offers the opportunity for it to become corrupted.
So, don't do that (most of the code already didn't) and use the
existing constant instead. Initialize new 32-bit superblocks with
the value for the sake of old userland programs, but don't keep the
value in the 64-bit superblock at all.

(approved by Margo Seltzer)

Revision 1.18 / (download) - annotate - [select for diffs], Tue Sep 1 06:11:06 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

Make the inode fields in the 64-bit superblock 64 bits wide.
Reasoning as before.

Note that I am not going through and checking for 64->32 truncations
in inode numbers; I'm sure there are quite a few, but that's a project
for later.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Sep 1 06:10:16 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.16: +46 -5 lines
Diff to previous 1.16 (colored)

Add byteswapping to the dinode accessors.

This prevents regressions in the ulfs code when switching to the new
accessors. Note that while adding byteswapping to the other accessors
is straightforward, I haven't done it yet; and that also is not enough
to make LFS_EI work, because there are places lying around that bypass
the accessors for one reason and another and all of them need to be
updated. That is going to have to wait for a later day as LFS_EI is
not on the critical path right now.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Sep 1 06:08:37 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.15: +49 -3 lines
Diff to previous 1.15 (colored)

Use the lfs dinode accessors in place of the ufs-derived ones.
(Mostly.)

The ufs-derived ones are fake structure member macros, which are gross
and not very safe. Also, it seems that a lot of places in the lfs code
were using the ffsv1 branch of them unconditionally, and this way it's
guaranteed all those places have been updated.

Found while doing this: for non-devices, have getattr produce NODEV
in the rdev field instead of leaking the address of the first direct
block.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Aug 29 21:04:22 2015 UTC (7 years, 5 months ago) by mlelstv
Branch: MAIN
Changes since 1.14: +10 -1 lines
Diff to previous 1.14 (colored)

Fix IFILE pointer calculation when scanning freelist.

Revision 1.14 / (download) - annotate - [select for diffs], Wed Aug 19 20:33:29 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.13: +18 -1 lines
Diff to previous 1.13 (colored)

Part two of dinodes; use the same union everywhere.
(previously the ufs-derived code had things set up slightly different)

Remove a bunch of associated mess.

Revision 1.13 / (download) - annotate - [select for diffs], Wed Aug 12 18:28:01 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.12: +95 -3 lines
Diff to previous 1.12 (colored)

Hack up dinode usage to be 64 vs. 32 as needed. Part 1.

(This part changes the native lfs code; the ufs-derived code already
has 64 vs. 32 logic, but as aspects of it are unsafe, and don't
entirely interoperate cleanly with the lfs 64/32 stuff, pass 2 will be
rehashing that.)

Revision 1.12 / (download) - annotate - [select for diffs], Wed Aug 12 18:27:01 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.11: +150 -4 lines
Diff to previous 1.11 (colored)

Provide 32-bit and 64-bit versions of FINFO.

This also entailed sorting out part of struct segment, as that
contains a pointer into the current FINFO data.

Revision 1.11 / (download) - annotate - [select for diffs], Wed Aug 12 18:26:27 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.10: +115 -2 lines
Diff to previous 1.10 (colored)

Make 32-bit and 64-bit versions of SEGSUM.
Also fix some of the FINFO handling as it's closely entangled.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Aug 12 18:25:52 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.9: +39 -4 lines
Diff to previous 1.9 (colored)

Add IFILE32 and IFILE64 structures for the on-disk ifile entries.
Add and use accessors. There are also a bunch of places that cast and
I hope I've found them all...

Revision 1.9 / (download) - annotate - [select for diffs], Wed Aug 12 18:25:04 2015 UTC (7 years, 5 months ago) by dholland
Branch: MAIN
Changes since 1.8: +69 -18 lines
Diff to previous 1.8 (colored)

Make 32-bit and 64-bit versions of CLEANERINFO.

XXX: while this is written to disk, it seems like much of it would
XXX: be better set up as a commpage shared with the cleaner.

Revision 1.8 / (download) - annotate - [select for diffs], Sun Aug 2 18:18:46 2015 UTC (7 years, 6 months ago) by dholland
Branch: MAIN
Changes since 1.7: +5 -1 lines
Diff to previous 1.7 (colored)

Pass the fs object to LFS_MAX_DADDR so it can check lfs_is64.

Remove some hackish intentional 64->32 truncations next to the checks
using LFS_MAX_DADDR, and tackle the problem they handled in bmap
instead.

The problem: the magic block pointer value UNWRITTEN has magic value
-2, and if it's not handled specifically, uint32 -> uint64 promotion
turns it into 4294967294, which then causes consternation and
monkeyhouse downstream.

What's here is still kind of a hack, but it's a step forward.

Revision 1.7 / (download) - annotate - [select for diffs], Sun Aug 2 18:18:10 2015 UTC (7 years, 6 months ago) by dholland
Branch: MAIN
Changes since 1.6: +65 -12 lines
Diff to previous 1.6 (colored)

Add a (draft) 64-bit superblock. Make things build again.

Add pieces of support for using both superblock types where
convenient, and specifically to the superblock accessors, but don't
actually enable it anywhere.

First substantive step on PR 50000.

Revision 1.6 / (download) - annotate - [select for diffs], Sun Aug 2 18:14:16 2015 UTC (7 years, 6 months ago) by dholland
Branch: MAIN
Changes since 1.5: +8 -8 lines
Diff to previous 1.5 (colored)

Use accessor functions for the version field of the lfs superblock.
I thought at first maybe the cases that test the version should be
rolled into the accessors, but on the whole I think the conclusion on
that is no.

Revision 1.5 / (download) - annotate - [select for diffs], Sun Aug 2 18:10:08 2015 UTC (7 years, 6 months ago) by dholland
Branch: MAIN
Changes since 1.4: +8 -8 lines
Diff to previous 1.4 (colored)

Second batch of 64 -> 32 truncations in lfs, along with more minor
tidyups and corrections in passing.

Revision 1.4 / (download) - annotate - [select for diffs], Sun Aug 2 18:08:13 2015 UTC (7 years, 6 months ago) by dholland
Branch: MAIN
Changes since 1.3: +51 -18 lines
Diff to previous 1.3 (colored)

Fix assorted 64 -> 32 truncations in lfs. Also, some minor tidyups and
corrections in passing.

Revision 1.3 / (download) - annotate - [select for diffs], Sun Aug 2 17:57:27 2015 UTC (7 years, 6 months ago) by dholland
Branch: MAIN
Changes since 1.2: +7 -5 lines
Diff to previous 1.2 (colored)

Allow superblock accessors that widen 32-bit disk fields to 64-bit
memory values.

Revision 1.2 / (download) - annotate - [select for diffs], Tue Jul 28 05:14:23 2015 UTC (7 years, 6 months ago) by dholland
Branch: MAIN
Changes since 1.1: +4 -4 lines
Diff to previous 1.1 (colored)

Use lfs_accessors.h in conjunction with the cleaner's struct clfs.
Remove previous hacks.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Jul 28 05:09:34 2015 UTC (7 years, 6 months ago) by dholland
Branch: MAIN

Add a new lfs header file: lfs_accessors.h.

This contains all the accessor functions and macros out of lfs.h.
Add an include of lfs_accessors.h after all uses of lfs.h... except
for code that wants to define its own struct lfs-alike that the
accessors are supposed to play along with. For these, set STRUCT_LFS
and include lfs_accessors.h after the necessary structure has been
defined, so that lfs_accessors.h can emit functions in terms of it.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>