summaryrefslogtreecommitdiffstats
path: root/sys/fs/ext2fs
Commit message (Collapse)AuthorAgeFilesLines
* MFC r313897:pfg2017-02-241-1/+0
| | | | | | | | ext2fs: Remove unused assignment. The value is re-assigned a few lines later without being read. Found by: Clang static analyzer
* MFC r310705, r310706:pfg2017-01-0420-279/+294
| | | | | | style(9) cleanups. Just to reduce some of the issues found with indent(1).
* MFC r309179:pfg2016-12-031-1/+2
| | | | | | ext2fs: avoid possible overflow when calculating malloc size. This is inspired on r308064 for the case of mounting UFS.
* MFC r303799, r303800:pfg2016-09-062-0/+15
| | | | | | | | | | ext2fs: Add defines for some missing ext4 features and inode flags. These are currently unused in our implementation and some even appear to have not been implemented yet on linux but it is good to keep them for reference. Obtained from: NetBSD
* Fix a style bug.kevlo2016-06-081-1/+1
|
* ext2fs: Stop dropping and reacquiring Giant around geom calls.pfg2016-06-071-12/+0
| | | | As in UFS r300366.
* ext2fs: rearrange ext4_bmapext().pfg2016-06-071-17/+16
| | | | | | | While here assign error a bit later. Reviewed by: Damjan Jovanovich Obtained from: NetBSD
* ext2fs(5): Cosmetic cleanups, mostly to the ext4 code.pfg2016-06-073-16/+16
| | | | Obtained from: NetBSD
* ext2fs: cleanup generation number management.pfg2016-06-072-11/+3
| | | | | | | | | | | | | | Ext2/3/4 manages generation numbers differently than UFS so adopt some rules that should work well. When allocating a new inode, make sure we generate a "good" random value specifically avoiding zero. Don't interfere with the numbers that are already generated in the filesystem: ext2fs doesn't have the backwards compatibility issues where there were no generation numbers. Reviewed by: kevlo MFC after: 1 week
* arc4random() returns 0 to (2**32)−1, use an alternative to initializekevlo2016-05-222-2/+4
| | | | | | | | i_gen if it's zero rather than a divide by 2. With inputs from delphij, mckusick, rmacklem Reviewed by: mckusick
* fs/ext2fs: spelling fixes on comment.pfg2016-04-291-1/+1
| | | | No functional change.
* ext2fs: make use of the howmany() macro when available.pfg2016-04-261-4/+4
| | | | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read. MFC after: 2 weeks
* ext2_htree_release(): prevent signed integer overflow in a loop.pfg2016-04-231-1/+1
| | | | | | | | | | h_levels_num, as most data structs in ext2fs, is unsigned so the index that addresses it has to be unsigned as well. To get to overflow here we would probably be considering a degenerate case though. MFC after: 5 days
* sys: use our roundup2/rounddown2() macros when param.h is available.pfg2016-04-211-1/+1
| | | | | | | | | | rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted.
* ext2fs: replace 0 with NULL for pointers.pfg2016-04-111-1/+2
| | | | | | | | | While here do late initialization of ebap, similar as was done in UFS. Found with devel/coccinelle. MFC after: 2 weeks
* Fix comment.kevlo2016-04-081-3/+3
|
* Add four new RCTL resources - readbps, readiops, writebps and writeiops,trasz2016-04-071-0/+8
| | | | | | | | | | | | | | | for limiting disk (actually filesystem) IO. Note that in some cases these limits are not quite precise. It's ok, as long as it's within some reasonable bounds. Testing - and review of the code, in particular the VFS and VM parts - is very welcome. MFC after: 1 month Relnotes: yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5080
* Update comment: Linux does set a randomized generation number of an inodekevlo2016-04-011-3/+1
| | | | | | | | | on ext2/3/4. While here use arc4random() instead of random(). Reviewed by: pfg MFC after: 3 days
* Update superblock and inode structs for ext4.kevlo2016-03-282-17/+47
| | | | Reviewed by: pfg
* Ext2: cleanup setting of ctime/mtime/birthtime.pfg2016-02-191-5/+3
| | | | | | | | | | | This adopts the same change as r291936 for UFS. Directly clear IN_ACCESS or IN_UPDATE when user supplied the time, and copy the value into the inode. This keeps the behaviour cleaner and is consistent with UFS. Reviewed by: bde MFC after: 1 month (only 10)
* ext2fs: Remove panics for rename() race conditions.pfg2016-02-141-5/+8
| | | | | | | | | | | | Sync with r84642 from UFS: The panics are inappropriate because the IN_RENAME flag only fixes a few of the huge number of race conditions that can result in the source path becoming invalid even prior to the VOP_RENAME() call. Found accidentally while checking an issue from PVS Static Analysis. MFC after: 3 days
* Ext4: Use boolean type instead of '0' and '1'pfg2016-02-112-8/+8
| | | | | | There are precedents of uses of bool in the kernel and it is incorrect style to use integers as replacement for a boolean type.
* Ext4: fix handling of files with sparse blocks before extent's index.pfg2016-02-112-15/+44
| | | | | | | | | | | | | | | | This is ongoing work from Damjan Jovanovic to improve ext4 read support with sparse files: Keep track of the first and last block in each extent as it descends down the extent tree, thus being able to work out that some blocks are sparse earlier. This solves an issue on r293680. In ext4_bmapext() start supporting the runb parameter, which appears to be the number of adjacent blocks prior to the block being converted in the same way that runp is the number of blocks after, speding up random access to mmaped files. PR: 206652
* Revert r294695:pfg2016-02-031-5/+7
| | | | | | | | | | ext2fs: passthrough any extra timestamps to the dinode struct. While it passed the classic testing, the change appears to have caused some regression and still requires some more precautions. PR: 206820 MFC after: 3 days
* ext2fs: passthrough any extra timestamps to the dinode struct.pfg2016-01-241-7/+5
| | | | | | | | | | | | | In general we don't trust any of the extended timestamps unless the EXT2F_ROCOMPAT_EXTRA_ISIZE feature is set. However, in the case where we freshly allocated a new inode the information is valid and it is better to pass it along instead of leaving the value undefined. This should have no practical effect but should reduce the amount of garbage if EXT2F_ROCOMPAT_EXTRA_ISIZE is set, like in cases where the filesystem is converted from ext3 to ext4. MFC after: 4 days
* ext2: rename some directory index constants.pfg2016-01-241-1/+1
| | | | | | Missed from r294653. Pointyhat: me
* Fix comment.pfg2016-01-241-1/+1
|
* Rename some directory index constants.pfg2016-01-244-7/+7
| | | | | | Directory index was introduced in ext3. We don't always use the prefix to denote the ext2 variant they belong to but when we do we should try to be accurate.
* ext2: Initialize i_flag after allocation.pfg2016-01-241-0/+1
| | | | | | | | | | | | | | We use i_flag to carry some flags like IN_E4INDEX which newer ext2fs variants uses internally. fsck.ext3 rightfully complains after our implementation tags non-directory inodes with INDEX_FL. Initializing i_flag during allocation removes the noise factor and quiets down fsck. Patch from: Damjan Jovanovic PR: 206530
* ext2fs: Bring back the htree dir_index implementation.pfg2016-01-217-115/+1492
| | | | | | | | | | | | | | | | | | The htree dir_index is perhaps one of the most characteristic features of the linux ext3 implementation. It was removed in r281670, due to repeated bug reports. Damjan Jovanic detected and fixed three bugs and did some stress testing by building Apache OpenOffice on top of it so it is now in good shape to bring back. Differential Revision: https://reviews.freebsd.org/D5007 Submitted by: Damjan Jovanovic Reviewed by: pfg Tested by: pho Relnotes: Yes MFC after: 2 months (only 10.x)
* ext4: mount panic from freeing invalid pointerspfg2016-01-111-1/+1
| | | | | | | | | | Initialize the struct with those fields to zeroes on allocation, preventing the panic. Patch by: Damjan Jovanovic. PR: 206056 MFC after: 3 days
* ext4: add support for reading sparse filespfg2016-01-114-34/+80
| | | | | | | | | | Add support for sparse files in ext4. Also implement read-ahead, which greatly increases the performance when transferring files from ext4. Both features implemented by Damjan Jovanovic. PR: 205816 MFC after: 1 week
* ext2fs: reading mmaped file in Ext4 causes panicpfg2016-01-071-6/+13
| | | | | | | | | Always call brelse(path.ep_bp), fixing reading EXT4 files using mmap(). Patch by Damjan Jovanovic. PR: 205938 MFC after: 1 week
* ext2: recognize ext4 INCOMPAT_RECOVER flagpfg2015-12-291-0/+3
| | | | | | | | | This is a flag specific for journalling in ext4. Add it to the list of ext4 features we ignore for read-only purposes. PR: 205668 MFC after: 1 week
* - Remove some dead code copied from ffs.jeff2015-07-291-32/+0
|
* Provide VOP_GETPAGES_ASYNC() for extfs.pfg2015-05-281-0/+1
| | | | | | | | | | Merge the filesystem specific part from r274914 to ext2fs. I only did regular testing with the change but UFS and our ext2fs are similar enough that the code should just work with the new sendfile. Discussed with: glebius
* Drop experimental dir_index support.pfg2015-04-177-1492/+115
| | | | | | | | | | | | | | | | | | | | | | | The htree directory index is a highly desirable feature for research purposes and was meant to improve performance in our ext2/3 driver. Unfortunately our implementation has two problems: - It never really delivered any performance improvement. - It appears to corrupt the filesystem in undetermined circumstances. Strictly speaking dir_index is not required for read/write support in ext2/3 and our limited ext4 support still works fine without it. Regain stability in the ext2 driver by removing it. We may need it back (fixed) if we want to support encrypted ext4 support but thanks to the wonders of version control we can always revert this change and bring it back. PR: 191895 PR: 198731 PR: 199309 MFC after: 5 days
* File systems that do not use the buffer cache (such as ZFS) mustrmacklem2015-04-151-1/+2
| | | | | | | | | | | | | use VOP_FSYNC() to perform the NFS server's Commit operation. This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which is set by file systems that use the buffer cache. If this flag is not set, the NFS server always does a VOP_FSYNC(). This should be ok for old file system modules that do not set MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although it might not be optimal for file systems that use the buffer cache. Reviewed by: kib MFC after: 2 weeks
* ext2fs: Plug small memory leakpfg2015-02-151-1/+2
| | | | | | | free() e2fs_contigdirs upon error. Undo zeroing of e2fs_gd as this was actually a false positive. X-MFC with: 278790
* Reuse value of cursize instead of recalculating.pfg2015-02-151-1/+1
| | | | | Reported by: Clang static checker MFC after: 1 week
* Initialize the allocation of variables related to the ext2 allocator.pfg2015-02-151-6/+6
| | | | | | | | | | | | The e2fs_gd struct was not being initialized and garbage was being used for hinting the ext2 allocator variant. Use malloc to clear the values and also initialize e2fs_contigdirs during allocation to keep consistency. While here clean up small style issues. Reported by: Clang static analyser MFC after: 1 week
* Fix the build when INVARIANTS is defined by restoring `bo`'s definition inngie2015-01-191-0/+6
| | | | | | | ext2_truncate(..) and by putting it under INVARIANTS ifdefs X-MFC with: r277354 MFC after: 2 weeks
* ext2: Garbage-collect some unused variablespfg2015-01-197-14/+2
| | | | | Reported by: clang static analysis MFC after: 2 weeks
* ext2: fix for uninitialized pointer read.pfg2015-01-181-1/+1
| | | | | | | path.ep_bp was being used uninitialized in ext4_ext_find_extent(). CID: 1062344 MFC after: 1 week
* Remove dead code.pfg2015-01-181-6/+3
| | | | | | | | | | | After the ext2 variant of the "orlov allocator" was implemented, the case for a negative or zero dirsize disappeared. Drop the dead code and unsign dirsize given that it can't be negative anyways. CID: 1008669 MFC after: 1 week
* ext2: cosmetical issuespfg2015-01-171-2/+5
| | | | | | Minor sorting and note when the cases are expected to fall through. MFC after: 1 week
* Handle MAKEENTRY cnp flag in the VOP_CREATE(). Curiously, somekib2014-12-211-1/+3
| | | | | | | | fs, e.g. smbfs, already did it. Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* The VOP_LOOKUP() implementations for CREATE op do not put the namekib2014-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | into namecache, to avoid cache trashing when doing large operations. E.g., tar archive extraction is not usually followed by access to many of the files created. Right now, each VOP_LOOKUP() implementation explicitely knowns about this quirk and tests for both MAKEENTRY flag presence and op != CREATE to make the call to cache_enter(). Centralize the handling of the quirk into VFS, by deciding to cache only by MAKEENTRY flag in VOP. VFS now sets NOCACHE flag for CREATE namei() calls. Note that the change in semantic is backward-compatible and could be merged to the stable branch, and is compatible with non-changed third-party filesystems which correctly handle MAKEENTRY. Suggested by: Chris Torek <torek@pi-coral.com> Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Adjust printf format specifiers for dev_t and ino_t in kernel.gleb2014-12-173-9/+11
| | | | | | ino_t and dev_t are about to become uint64_t. Reviewed by: kib, mckusick
* ext2fs: Fix old out-of-bounds access.pfg2014-12-091-6/+16
| | | | | | | | | | | | | | Overrunning buffer pointed to by (caddr_t)&oip->i_db[0] of 48 bytes by passing it to a function which accesses it at byte offset 59 using argument 60UL. The issue was inherited from an older FFS implementation and fixed there with by merging UFS2 in r98542. We follow the FFS fix. Discussed with: bde CID: 1007665 MFC after: 3 days
OpenPOWER on IntegriCloud