Commit Graph

949 Commits

Author SHA1 Message Date
pgoyette 4746239292 Remove historic references to wapbl. 2015-11-14 22:03:54 +00:00
dholland f942ea8941 fix stupid typo in the 64-bit branch of the d_namlen accessor 2015-10-19 04:22:28 +00:00
dholland b53aa31418 Set the legacy ulfs fstype field to ULFS2 when mounting lfs64. Oops. 2015-10-19 04:22:18 +00:00
dholland b7c7abea00 improve some panic messages 2015-10-19 04:21:48 +00:00
dholland 19d34e9eca Enable mounting lfs64 volumes. 2015-10-15 06:25:34 +00:00
dholland 960bd58eff Remove stray #define of lfs_magic
(the last of the fake superblock structure field macros)
2015-10-15 06:24:21 +00:00
dholland ce301f42e4 For now bitflip the lfs64 magic number.
This will be unflipped when the format is finalized - right now I
still have pending changes to the superblock in mind (to reduce the
number of redundant fields) so anything created now is not future-
proof. However, the code's also nearing being ready for testing; so
I'm doing this before turning it on as a precaution.
2015-10-15 06:24:08 +00:00
dholland 1655608c85 Move stuff from struct ulfsmount to struct lfs. 2015-10-15 06:15:48 +00:00
dholland ae8888723f Fix minor bitrot in #if 0 or otherwise disabled code. 2015-10-10 22:34:33 +00:00
dholland 7e31609f91 Remove no longer needed explicit 32->64 sign extension.
This is the last 32-bit-on-disk item among those that were either
already tagged or readily discoverable.
2015-10-10 22:33:57 +00:00
dholland 791b636204 Add byteswapping to the inode block-pointer accessors. 2015-10-10 22:33:44 +00:00
dholland 5cc5e3bd23 Use accessors for some more indirect block manipulations. 2015-10-10 22:33:31 +00:00
hannken 7de3300bb9 Remove dubious vhold()/holdrele() from lfs_reserve().
The vnodes are always referenced on entry.

If we changed ulfs_remove() and ulfs_rmdir() to return the locked dvp
the vnodes were always locked on entry.

Remove an outdated comment from lfs_reserveavail(), unlocking/relocking
the vnode was removed in rev 1.49.
2015-10-03 09:31:29 +00:00
dholland 896006c986 Drop an explicit sign-extension in fsck that shouldn't be needed any
more.
2015-10-03 08:29:48 +00:00
dholland 93f2a7d5e8 Add lfs_checkword type for reading checksum data out of structures.
This is always uint32_t, but having a name for it both makes things
clearer and avoids confusion about whether it should be 32 or 64 bit.

Note: deployed in only one place (that was erroneously tagged
ondisk32) so far.
2015-10-03 08:29:34 +00:00
dholland a407c8d218 Use IINFO in lfs_writeinode().
(both the kernel and the userland copies)
2015-10-03 08:28:15 +00:00
dholland 99646ab5f8 Use the new IINFO in the rfw code, eliminating hardwired 32-bit values. 2015-10-03 08:27:55 +00:00
dholland 8f0c85a18e 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.
2015-10-03 08:27:38 +00:00
dholland cfe9c0210f 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.
2015-09-21 01:24:58 +00:00
dholland 7ac462185b 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.
2015-09-21 01:24:39 +00:00
dholland 947343ea0e 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.)
2015-09-21 01:24:23 +00:00
dholland 80201f5aa5 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.
2015-09-21 01:22:18 +00:00
dholland 75caa729bb Clean up struct lfs_dirtemplate. 2015-09-20 04:51:43 +00:00
dholland 105e003c9a Fix glaringly stupid overflow/sizing bug in -r1.25. The part I don't
get is how it passed testing...
2015-09-20 04:50:58 +00:00
dholland 7ad6b1a922 Remove struct lfs_direct (no longer used) and update the big block
comment about directories.
2015-09-15 15:02:40 +00:00
dholland 805a8504cb Pass around struct lfs_dirheader instead of struct lfs_direct. 2015-09-15 15:02:25 +00:00
dholland 98320dbc87 Add an accessor function for directory names. 2015-09-15 15:02:01 +00:00
dholland 653d6346b1 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.
2015-09-15 15:01:38 +00:00
dholland 06be19e226 Tidyups/fixes preparatory to making d_name[] in struct lfs_direct size
0 instead of size LFS_MAXNAMLEN+1, and preparatory to having accessor
functions for d_name. In particular, don't create prototype entries
and copy them, and access the name field only for directory structures
that are in buffers with space for the name to exist.
2015-09-15 15:01:22 +00:00
dholland c96fd3a912 Kill off the ulfs_direct_cache pool.
We no longer allocate temporary struct directs, so we don't need a
pool for them.
2015-09-15 15:01:03 +00:00
dholland 53a3e07718 Tidy up ulfs_direnter: don't malloc a temporary struct lfs_direct
and double-copy it. Just write to the destination buffer.
2015-09-15 15:00:49 +00:00
dholland 54671fde93 Kill off ulfs_makedirentry; just pass the data to ulfs_direnter instead.
For now, move one copy of the code that allocates and fills in a
temporary struct lfs_direct to the top of ulfs_direnter; but it should
go away shortly.
2015-09-15 15:00:32 +00:00
dholland c2c4048b2d 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.)
2015-09-15 14:59:58 +00:00
dholland 5a97d9e5b6 Add and use accessor functions for more of the directory entry fields. 2015-09-15 14:58:05 +00:00
dholland 8f73830c5d Fix wrong code in lfs_valloc_fixed(). It was overwriting the inode
number it was supposed to be allocating with the head of the inode
freelist, then applying the wrong test to that result. Net result:
unless the freelist was empty (in which case it would always fail),
it would in general drop a bunch of entries from the freelist.

This code seems to have been broken when the first version of lfsv2
was imported onto the perseant-lfsv2 branch in -r1.47.2.1, and
remained broken since, in spite of having been moved to lfs_rfw.c and
back and rearranged quite a bit in the meantime.

Sigh.

Found by Coverity in a rather confusing way as CID 1316545.
2015-09-13 07:53:37 +00:00
dholland ec175d5025 Add new accessors for the d_type and d_namlen fields of struct lfs_direct.
Napalm the old byteswap access logic for these.
2015-09-01 06:16:58 +00:00
dholland 3911af9340 Comments on directories.
This includes a description of the struct direct byteswap horrors that
ought to be propagated to ufs/ufs.
2015-09-01 06:15:46 +00:00
dholland 98320d1917 Fix up indirect block handling in truncate to be 32/64 clean. 2015-09-01 06:13:09 +00:00
dholland 30c3aa6e8a Tidy the MAXSYMLINKLEN macros. 2015-09-01 06:12:33 +00:00
dholland eb2560adae 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)
2015-09-01 06:12:04 +00:00
dholland 4b344787e1 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.
2015-09-01 06:11:06 +00:00
dholland 4d398b859d 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.
2015-09-01 06:10:16 +00:00
dholland da32f22c2a 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.
2015-09-01 06:08:37 +00:00
mlelstv a78588c68c Fix IFILE pointer calculation when scanning freelist. 2015-08-29 21:04:22 +00:00
hannken ff601864ae lfs_writevnodes: replace mnt_vnodelist traversal with vfs_vnode_iterator. 2015-08-21 07:35:56 +00:00
dholland c9cfc4bd98 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.
2015-08-19 20:33:29 +00:00
dholland b1828e0ba3 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.)
2015-08-12 18:28:00 +00:00
dholland 1c8e2a4061 Make the inode number in the 64-bit dinode 64 bits wide, like the
other lfs64 on-disk inode numbers; I've been doing that since this is
a new format and we may as well take the opportunity. This does assume
that more than 4 billion files on a single volume becomes desirable;
but for an average file size of 10K all that takes is a 40 TB volume,
and it's not that hard to make one of those these days if you want to
badly enough.
2015-08-12 18:27:18 +00:00
dholland e54b457c15 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.
2015-08-12 18:27:01 +00:00
dholland 2e090556c4 Make 32-bit and 64-bit versions of SEGSUM.
Also fix some of the FINFO handling as it's closely entangled.
2015-08-12 18:26:26 +00:00