Commit Graph

133 Commits

Author SHA1 Message Date
Pedro F. Giffuni
3cc6ae1f57 Update the data structures with some fields reserved for
ext4 but that can be used in ext3 mode.

Also adjust the internal inode to carry the birthtime,
like in UFS, which is starting to get some use when
big inodes are available.

Right now these are just placeholders for features
to come.

Approved by:	jhb (mentor)
MFC after:	2 weeks
2012-02-07 22:31:28 +00:00
Konstantin Belousov
c480f781ea Current implementations of sync(2) and syncer vnode fsync() VOP uses
mnt_noasync counter to temporary remove MNTK_ASYNC mount option, which
is needed to guarantee a synchronous completion of the initiated i/o
before syscall or VOP return.  Global removal of MNTK_ASYNC option is
harmful because not only i/o started from corresponding thread becomes
synchronous, but all i/o is synchronous on the filesystem which is
initiated during sync(2) or syncer activity.

Instead of removing MNTK_ASYNC from mnt_kern_flag, provide a local
thread flag to disable async i/o for current thread only. Use the
opportunity to move DOINGASYNC() macro into sys/vnode.h and
consistently use it through places which tested for MNTK_ASYNC.

Some testing demonstrated 60-70% improvements in run time for the
metadata-intensive operations on async-mounted UFS volumes, but still
with great deviation due to other reasons.

Reviewed by:	mckusick
Tested by:	scottl
MFC after:	2 weeks
2012-02-06 11:04:36 +00:00
Ed Schouten
8f8d30274a Migrate ufs and ext2fs from skpc() to memcchr().
While there, remove a useless check from the code. memcchr() always
returns characters unequal to 0xff in this case, so inosused[i] ^ 0xff
can never be equal to zero. Also, the fact that memcchr() returns a
pointer instead of the number of bytes until the end, makes conversion
to an offset far more easy.
2012-01-01 20:47:33 +00:00
Pedro F. Giffuni
5ed5554f0a Style cleanups by jh@.
Fix a comment from the previous commit.
Use M_ZERO instead of bzero() in ext2_vfsops.c
Add include guards from PR.

PR:		162564
Approved by:	jhb (mentor)
MFC after:	2 weeks
2011-12-16 15:47:43 +00:00
Pedro F. Giffuni
5b63c1252b Bring in reallocblk to ext2fs.
The feature has been standard for a while in UFS as a means to reduce
fragmentation, therefore maintaining consistent performance with
filesystem aging. This is also very similar to what ext4 calls
"delayed allocation".

In his 2010 GSoC, Zheng Liu ported and benchmarked the missing
FANCY_REALLOC code to find more consistent performance improvements than
with the preallocation approach.

PR:		159233
Author:		Zheng Liu <gnehzuil AT SPAMFREE gmail DOT com>
Sponsored by:	Google Inc.
Approved by:	jhb (mentor)
MFC after:	2 weeks
2011-12-15 20:31:18 +00:00
Pedro F. Giffuni
c14d4ad1c6 Merge ext2_readwrite.c into ext2_vnops.c as done in UFS in r101729.
This removes the obfuscations mentioned in ext2_readwrite and
places the clustering funtion in a location similar to other
UFS-based implementations.

No performance or functional changeses are expected from
this move.

PR:		kern/159232
Suggested by:	bde
Approved by:	jhb (mentor)
MFC after:	2 weeks
2011-12-14 22:04:14 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Rick Macklem
694a586a43 Add a lock flags argument to the VFS_FHTOVP() file system
method, so that callers can indicate the minimum vnode
locking requirement. This will allow some file systems to choose
to return a LK_SHARED locked vnode when LK_SHARED is specified
for the flags argument. This patch only adds the flag. It
does not change any file system to use it and all callers
specify LK_EXCLUSIVE, so file system semantics are not changed.

Reviewed by:	kib
2011-05-22 01:07:54 +00:00
John Baldwin
5b4f35a4f0 Merge comments about converting directory entries to be more direct and
concise.

Inspired by:	Gleb Kurtsou
2011-05-14 01:10:57 +00:00
Konstantin Belousov
4417ac326a Clarify the comment.
MFC after:	1 week
2011-04-30 13:49:03 +00:00
John Baldwin
7d74606889 Update a comment since ext2fs does not use SU.
Reviewed by:	kib
2011-04-28 20:25:15 +00:00
John Baldwin
466a71d75e The b_dep field of buffers is always empty for ext2fs, it is only used
for SU in FFS.

Reported by:	kib
2011-04-28 17:36:26 +00:00
John Baldwin
9e880b876d Sync with several changes in UFS/FFS:
- 77115: Implement support for O_DIRECT.
- 98425: Fix a performance issue introduced in 70131 that was causing
  reads before writes even when writing full blocks.
- 98658: Rename the BALLOC flags from B_* to BA_* to avoid confusion with
  the struct buf B_ flags.
- 100344: Merge the BA_ and IO_ flags so so that they may both be used in
  the same flags word. This merger is possible by assigning the IO_ flags
  to the low sixteen bits and the BA_ flags the high sixteen bits.
- 105422: Fix a file-rewrite performance case.
- 129545: Implement IO_INVAL in VOP_WRITE() by marking the buffer as
  "no cache".
- Readd the DOINGASYNC() macro and use it to control asynchronous writes.
  Change i-node updates to honor DOINGASYNC() instead of always being
  synchronous.
- Use a PRIV_VFS_RETAINSUGID check instead of checking cr_uid against 0
  directly when deciding whether or not to clear suid and sgid bits.

Submitted by:	Pedro F. Giffuni  giffunip at yahoo
2011-04-28 14:27:17 +00:00
John Baldwin
bbfe24fbf2 Use a private EXT2_ROOTINO constant instead of redefining ROOTINO.
Submitted by:	Pedro F. Giffuni  giffunip at yahoo
2011-04-27 18:25:35 +00:00
John Baldwin
4d2ede6798 Various style fixes including using uint*_t instead of u_int*_t.
Submitted by:	Pedro F. Giffuni  giffunip at yahoo
2011-04-27 18:15:34 +00:00
John Baldwin
056c6c933c Use ffs() to locate free bits in the inode and block bitmaps rather than
loops with bit shifts.
2011-02-24 22:11:36 +00:00
John Baldwin
73dd6d1f8f After reading a bitmap block for i-nodes or blocks, recheck the count of
free i-nodes or blocks to handle a race where another thread might have
allocated the last i-node or block while we were waiting for the buffer.

Tested by:	dougb
2011-02-08 13:02:25 +00:00
John Baldwin
a3ebd02675 Collapse duplicate definitions of EXT2_SB().
Submitted by:	Pedro F. Giffuni  giffunip at yahoo
2011-02-04 14:20:27 +00:00
John Baldwin
8e42a40607 Fix build with DIAGNOSTIC enabled.
Pointy hat to:	jhb
2011-02-02 14:59:05 +00:00
John Baldwin
45641afb72 Some cosmetic fixes and remove a duplicate constant.
Submitted by:	Pedro F. Giffuni  giffunip at yahoo
2011-02-01 18:30:52 +00:00
John Baldwin
c767faa558 - Set the next_alloc fields for an i-node after allocating a new block
so that future allocations start with most recently allocated block
  rather than the beginning of the filesystem.
- Fix ext2_alloccg() to properly scan for 8 block chunks that are not
  aligned on 8-bit boundaries.  Previously this was causing new blocks
  to be allocated in a highly fragmented fashion (block 0 of a file at
  lbn N, block 1 at lbn N + 8, block 2 at lbn N + 16, etc.).
- Cosmetic tweaks to the currently-disabled fancy realloc sysctls.

PR:		kern/153584
Discussed with:	bde
Tested by:	Pedro F. Giffuni  giffunip at yahoo, Zheng Liu (lz)
2011-02-01 18:21:45 +00:00
John Baldwin
cd2895aab0 - Move special inode constants to ext2_dinode.h and rename them to match
NetBSD.
- Add a constant for the HASJOURNAL compat flag.

PR:		kern/153584
Submitted by:	Pedro F. Giffuni  giffunip at yahoo
2011-01-21 22:00:40 +00:00
John Baldwin
84edda0a2c Restore support for the 'async' and 'sync' mount options lost when
switching to nmount(2).  While here, sort the options.

PR:		kern/153584
Submitted by:	Pedro F. Giffuni  giffunip at yahoo
MFC after:	1 week
2011-01-21 21:33:46 +00:00
John Baldwin
a2add8d070 Fix build with KDB defined.
Pointy hat to:	jhb
Submitted by:	jkim
2011-01-19 19:49:48 +00:00
John Baldwin
08b1d53573 Whitespace and style fixes. 2011-01-19 16:55:32 +00:00
John Baldwin
f82a066c72 Move calculation of 'bmask' earlier to match it's current location in
ufs_lookup().
2011-01-19 16:52:22 +00:00
John Baldwin
007c620744 Merge 118969 from UFS:
Eliminate the i_devvp field from the incore inodes, we can get the same
value from ip->i_ump->um_devvp.

Submitted by:	Pedro F. Giffuni  giffunip at yahoo
MFC after:	1 week
2011-01-19 16:46:13 +00:00
Konstantin Belousov
730b63b0c2 Remove prtactive variable and related printf()s in the vop_inactive
and vop_reclaim() methods. They seems to be unused, and the reported
situation is normal for the forced unmount.

MFC after:   1 week
X-MFC-note:  keep prtactive symbol in vfs_subr.c
2010-11-19 21:17:34 +00:00
Ulf Lilleengen
0cc17ce608 - Remove duplicate comment.
PR:		kern/148820
Submitted by:	pluknet <pluknet - at - gmail.com>
2010-09-01 05:34:17 +00:00
Edward Tomasz Napierala
b5f770bd86 Move checking against RLIMIT_FSIZE into one place, vn_rlimit_fsize().
Reviewed by:	kib
2010-05-05 16:44:25 +00:00
Ulrich Spörlein
8fa03d08ca Fix common misspelling of hierarchy
Pointed out by:		bf1783 at gmail
Approved by:		np (cxgb), kientzle (tar, etc.), philip (mentor)
2010-02-20 10:19:19 +00:00
Ulf Lilleengen
2ab38c399e Revert parts of r202283:
- Return EOPNOTSUPP before EROFS to be consistent with other filesystems.
- Fix setting of the nodump flag for users without PRIV_VFS_SYSFLAGS privilege.

Submitted by:	jh@
2010-01-18 19:09:16 +00:00
Ulf Lilleengen
e09c00cada Bring in the ext2fs work done by Aditya Sarawgi during and after Google Summer
of Code 2009:

- BSDL block and inode allocation policies for ext2fs. This involves the use
  FFS1 style block and inode allocation for ext2fs. Preallocation was removed
  since it was GPL'd.
- Make ext2fs MPSAFE by introducing locks to per-mount datastructures.
- Fixes for kern/122047 PR.
- Various small bugfixes.
- Move out of gnu/ directory.

Sponsored by:   Google Inc.
Submitted by:	Aditya Sarawgi <sarawgi.aditya AT SPAMFREE gmail DOT com>
2010-01-14 14:30:54 +00:00