Home | History | Annotate | Download | only in ext2fs
History log of /src/sys/ufs/ext2fs/ext2fs_alloc.c
RevisionDateAuthorComments
 1.59  27-Jun-2025  andvar s/quadradically/quadratically/ in comments.
 1.58  14-May-2024  andvar branches: 1.58.2;
fix recently committed typos by msaitoh in few more places, as well as few more.
mainly s/contigous/contiguous/ and s/miliseconds/milliseconds/ in comments.
 1.57  13-May-2024  msaitoh s/contigous/contiguous/ in comment.
 1.56  26-Aug-2023  christos fix incorrect test
 1.55  26-Aug-2023  christos Fix metadata_cksum (Vladimir Serbinenko)

Current code always assumes that CG uses crc16. Yet when metadata_cksum is
enabled then it uses truncated crc32c. This patch doesn't implement full
metadata_cksum, just allows volumes with metadata_cksum to be mounted
read-only.
 1.54  26-Aug-2023  riastradh ext2fs: Nix trailing whitespace.
 1.53  25-Aug-2023  christos Support INCOMPAT_64BIT on ext4 (Vladimir 'phcoder' Serbinenko)
 1.52  28-May-2017  hannken Change ext2fs to use vcache_new like we did for ffs:
- Change ext2fs_valloc to return an inode number.
- Make ext2fs_makeinode private to ext2fs_vnops.c and
pass vattr instead of mode.
 1.51  20-Aug-2016  jdolecek modify the comment to note code needs to brele() to have a shot on actually
working
 1.50  20-Aug-2016  jdolecek #if 0 the check for ext2fs_mapsearch() failure (similar what was done
for ffs counterpart), it actually never fails, it panics instead
 1.49  20-Aug-2016  jdolecek add support for GDT_CSUM AKA uninit_bg feature
 1.48  13-Aug-2016  christos KNF, no functional changes...
 1.47  03-Aug-2016  jdolecek support arbitrary ext3/ext4 inode size, add all the new ext4 fields ext2fs_dinode, and add support for loading the extra inode data
 1.46  28-Mar-2015  maxv branches: 1.46.2;
Remove the 'cred' argument from bread(). Remove a now unused var in
ffs_snapshot.c. Update the man page accordingly.

ok hannken@
 1.45  23-Jun-2013  dholland branches: 1.45.10;
fsbtodb() -> FFS_FSBTODB(), EXT2_FSBTODB(), or MFS_FSBTODB()
dbtofsb() -> FFS_DBTOFSB() or EXT2_DBTOFSB()

(Christos already did the lfs ones a few days back)
 1.44  20-Dec-2012  hannken Change bread() and breadn() to never return a buffer on
error and modify all callers to not brelse() on error.

Welcome to 6.99.16

PR kern/46282 (6.0_BETA crash: msdosfs_bmap -> pcbmap -> bread -> bio_doread)
 1.43  21-Nov-2012  jakllsch Write support for the Ext4 Read-only Compatible Feature "huge_file".

Primarily, this feature extends the inode block count field to 48 bits.
Additionally, this feature allows this field to be represented in file
system block size units rather than DEV_BSIZE units.
 1.42  06-Mar-2011  rmind branches: 1.42.4; 1.42.14;
{ffs_nodealloccg,ext2fs_nodealloccg,ext2fs_mapsearch}: use XOR and ffs()
to find free bits in the inode and block bitmaps, instead of the loop.

Obtained from FreeBSD (changes by jhb).
 1.41  19-Oct-2009  bouyer branches: 1.41.4; 1.41.6;
Remove closes 3 & 4 from my licence. Lots of thanks to Soren Jacobsen
for the booring work !
 1.40  12-Sep-2009  tsutsui Whitespace nits.
 1.39  07-May-2009  elad Introduce several actions/requests for authorizing file-system related
operations, specifically quota and block allocation from reserved space.

Modify ufs_quotactl() to accomodate passing "mp" earlier by vfs_busy()ing
it a little bit higher.

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/04/26/msg004936.html

Note that the umapfs request mentioned in this thread was NOT added as
there is still on-going discussion regarding the proper implementation.
 1.38  11-Jan-2009  christos branches: 1.38.2;
merge christos-time_t
 1.37  23-Nov-2008  mrg add support for 32 bit uid/gid fields in ext2, but only do so for
when the revision is > REV0.
 1.36  16-May-2008  hannken branches: 1.36.4; 1.36.6; 1.36.8;
Make sure all cached buffers with valid, not yet written data have been
run through copy-on-write. Call fscow_run() with valid data where possible.

The LP_UFSCOW hack is no longer needed to protect ffs_copyonwrite() against
endless recursion.

- Add a flag B_MODIFY to bread(), breada() and breadn(). If set the caller
intends to modify the buffer returned.

- Always run copy-on-write on buffers returned from ffs_balloc().

- Add new function ffs_getblk() that gets a buffer, assigns a new blkno,
may clear the buffer and runs copy-on-write. Process possible errors
from getblk() or fscow_run(). Part of PR kern/38664.

Welcome to 4.99.63

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
 1.35  08-Oct-2007  ad branches: 1.35.6; 1.35.18; 1.35.20; 1.35.22; 1.35.24; 1.35.26;
Merge ffs locking & brelse changes from the vmlocking branch.
 1.34  04-Jan-2007  elad branches: 1.34.6; 1.34.18; 1.34.20; 1.34.22;
Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.33  09-Dec-2006  chs several ext2fs fixes provided by Barry Bouwsma:
- set ip->i_e2fs_dtime to time_second, not time_uptime.
- don't allow ipref to go negative
- fs->e2fs.e2fs_icount is a valid inode number, allow it.
 1.32  16-Nov-2006  christos branches: 1.32.2;
__unused removal on arguments; approved by core.
 1.31  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.30  07-Jun-2006  kardel branches: 1.30.6; 1.30.8;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.29  14-May-2006  elad branches: 1.29.2;
integrate kauth.
 1.28  11-Dec-2005  christos branches: 1.28.4; 1.28.6; 1.28.8; 1.28.10; 1.28.12;
merge ktrace-lwp.
 1.27  02-Nov-2005  yamt merge yamt-vop branch. remove following VOPs.

VOP_BLKATOFF
VOP_VALLOC
VOP_BALLOC
VOP_REALLOCBLKS
VOP_VFREE
VOP_TRUNCATE
VOP_UPDATE
 1.26  30-Aug-2005  xtraeme branches: 1.26.2;
* Remove __P()
* Use ANSI function declarations on ext2fs and mfs
 1.25  19-Aug-2005  christos 64 bit inode changes.
 1.24  29-May-2005  christos branches: 1.24.2;
- sprinkle const
- avoid shadow variables.
 1.23  26-Feb-2005  perry nuke trailing whitespace
 1.22  22-Mar-2004  bouyer branches: 1.22.8; 1.22.10;
Fix disclaimer in my copyright. Pointed out by Thomas Klausner.
 1.21  05-Oct-2003  bouyer Remove references to University of California from my copyright notices.
 1.20  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.19  29-Jun-2003  fvdl branches: 1.19.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.18  29-Jun-2003  thorpej Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.17  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.16  24-Apr-2003  gmcgarry More ufs2 merge fall-out. Pass the correct pointer to the dinode
for clearing. Fixes PR#21241.
 1.15  24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.14  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.13  08-Nov-2001  lukem add RCSID
 1.12  26-Oct-2001  lukem remove #include <ufs/ufs/quota.h> where it was just to appease
<ufs/ufs/inode.h>, since the latter now includes the former. leave the former
in source that obviously uses specific bits of it (for completeness.)
 1.11  24-Aug-2001  wiz branches: 1.11.4;
heirarchy -> hierarchy
 1.10  05-Jul-2001  toshii branches: 1.10.2;
Fix typo. s/extention/extension/
 1.9  28-Jun-2000  mrg branches: 1.9.2;
remove include of <vm/vm.h> and <uvm/uvm_extern.h>
 1.8  19-May-2000  thorpej NULL != 0
 1.7  30-Mar-2000  augustss Remove register declarations.
 1.6  10-Feb-1999  bouyer branches: 1.6.8; 1.6.14;
Make sure a buffer optained from bread() is always bresle()'d in case of
error. Closes PR kern/1448 from Wolfgang Solfrank.
 1.5  23-Oct-1998  thorpej For consistency w/ FFS/LFS, define EXT2_DINODE_SIZE, and use it instead
of pointer arithmetic and/or sizeof(struct ext2fs_dinode).
 1.4  09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.3  01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.2  09-Oct-1997  bouyer Add byte-swapping functions (bswap16, bswap32, bswap64) to libkern.
Only assembly version for i386 bswap16 and bswap32 for now (bswap64 uses
bswap32). Contribution of assembly versions of these are welcome.
Add byte-swapping of ext2fs metadata for big-endian systems.
Tested on i386 and sparc.
 1.1  11-Jun-1997  bouyer branches: 1.1.4;
The ext2fs layer, based on the ffs/ufs one. Uses a few functions from
sys/ufs/ufs/
 1.1.4.1  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.14.1  21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.6.8.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.9.2.4  18-Oct-2002  nathanw Catch up to -current.
 1.9.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.9.2.2  21-Sep-2001  nathanw Catch up to -current.
 1.9.2.1  24-Aug-2001  nathanw Catch up with -current.
 1.10.2.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.2.1  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.11.4.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.19.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.19.2.5  21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.4  18-Sep-2004  skrll Sync with HEAD.
 1.19.2.3  24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.19.2.2  03-Aug-2004  skrll Sync with HEAD
 1.19.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.22.10.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.8.1  29-Apr-2005  kent sync with -current
 1.24.2.4  27-Oct-2007  yamt sync with head.
 1.24.2.3  26-Feb-2007  yamt sync with head.
 1.24.2.2  30-Dec-2006  yamt sync with head.
 1.24.2.1  21-Jun-2006  yamt sync with head.
 1.26.2.1  20-Oct-2005  yamt adapt ufs.
 1.28.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.28.10.2  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.28.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.28.8.2  26-Jun-2006  yamt sync with head.
 1.28.8.1  24-May-2006  yamt sync with head.
 1.28.6.2  01-Jun-2006  kardel Sync with head.
 1.28.6.1  04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.28.4.1  09-Sep-2006  rpaulo sync with head
 1.29.2.1  19-Jun-2006  chap Sync with head.
 1.30.8.2  10-Dec-2006  yamt sync with head.
 1.30.8.1  22-Oct-2006  yamt sync with head
 1.30.6.2  12-Jan-2007  ad Sync with head.
 1.30.6.1  18-Nov-2006  ad Sync with head.
 1.32.2.1  12-Jan-2007  bouyer Pull up following revision(s) (requested by chs in ticket #346):
sys/ufs/ext2fs/ext2fs_inode.c: revision 1.56
sys/ufs/ext2fs/ext2fs_alloc.c: revision 1.33
several ext2fs fixes provided by Barry Bouwsma:
- set ip->i_e2fs_dtime to time_second, not time_uptime.
- don't allow ipref to go negative
- fs->e2fs.e2fs_icount is a valid inode number, allow it.
 1.34.22.1  14-Oct-2007  yamt sync with head.
 1.34.20.1  06-Nov-2007  matt sync with HEAD
 1.34.18.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.34.6.2  19-Oct-2007  ad ext2fs_vfree: the in-core root inode can have nlinks == 0. Don't try to
free it during reclaim. XXX Needs further investigation.
 1.34.6.1  13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.35.26.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.35.24.4  11-Mar-2010  yamt sync with head
 1.35.24.3  16-Sep-2009  yamt sync with head
 1.35.24.2  16-May-2009  yamt sync with head
 1.35.24.1  04-May-2009  yamt sync with head.
 1.35.22.1  18-May-2008  yamt sync with head.
 1.35.20.4  30-Dec-2008  christos fix dev_t printfs
 1.35.20.3  27-Dec-2008  christos merge with head.
 1.35.20.2  01-Nov-2008  christos Sync with head.
 1.35.20.1  29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.35.18.2  17-Jan-2009  mjf Sync with HEAD.
 1.35.18.1  02-Jun-2008  mjf Sync with HEAD.
 1.35.6.2  30-Dec-2007  ad Fix remaining problems with ext2fs on this branch.
 1.35.6.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.36.8.1  29-Nov-2008  snj Pull up following revision(s) (requested by mrg in ticket #147):
sys/ufs/ext2fs/ext2fs_alloc.c: revision 1.37
sys/ufs/ext2fs/ext2fs_bswap.c: revision 1.14
sys/ufs/ext2fs/ext2fs_dinode.h: revision 1.17
sys/ufs/ext2fs/ext2fs_lookup.c: revision 1.56
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.83
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.140
sys/ufs/ufs/inode.h: revision 1.55
add support for 32 bit uid/gid fields in ext2, but only do so for
when the revision is > REV0.
 1.36.6.1  19-Jan-2009  skrll Sync with HEAD.
 1.36.4.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.38.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.41.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.41.4.1  21-Apr-2011  rmind sync with head
 1.42.14.3  03-Dec-2017  jdolecek update from HEAD
 1.42.14.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.14.1  25-Feb-2013  tls resync with head
 1.42.4.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.42.4.2  23-Jan-2013  yamt sync with head
 1.42.4.1  16-Jan-2013  yamt sync with (a bit old) head
 1.45.10.3  28-Aug-2017  skrll Sync with HEAD
 1.45.10.2  05-Oct-2016  skrll Sync with HEAD
 1.45.10.1  06-Apr-2015  skrll Sync with HEAD
 1.46.2.1  06-Aug-2016  pgoyette Sync with HEAD
 1.58.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed