aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/ext2fs/ext2_balloc.c
Commit message (Collapse)AuthorAgeFilesLines
* fs: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365070
* Add BE architectures support.Fedor Uporov2020-05-171-3/+4
| | | | | | | | | | | | Author of most initial version: pfg (https://reviews.freebsd.org/D23259) Reviewed by: pfg MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D24685 Notes: svn path=/head/; revision=361136
* ext2fs: Remove redundant brelse() after r294954Conrad Meyer2019-09-061-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coccinelle: @ rule1 @ identifier __error; @@ ... int __error; ... @ rule2 depends on rule1 @ identifier rule1.__error; identifier __bp; @@ __error = ( bread | bread_gb | breadn | breadn_flags ) (..., &__bp); if ( ( __error | __error != 0 ) ) { ... - brelse(__bp); ... } No functional change. Notes: svn path=/head/; revision=351926
* Remove ufs fragments logic.Fedor Uporov2019-07-071-71/+15
| | | | | | | | | | | | | | The ext2fs fragments are different from ufs fragments. In case of ext2fs the fragment should be equal or more then block size. The values more than block size are used only in case of bigalloc feature, which is does not supported for now. Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE Reported as: FS-22-EXT2-9: Denial of service in ftruncate-0 (ext2_balloc) MFC after: 2 weeks Notes: svn path=/head/; revision=349801
* Remove unneeded mount point unlock call.Fedor Uporov2019-07-071-1/+0
| | | | | | | | | | Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE Reported as: FS-11-EXT2-6: Denial Of Service in write-1 (ext2_balloc) MFC after: 2 weeks Notes: svn path=/head/; revision=349800
* Add 64bit feature support.Fedor Uporov2018-01-051-16/+23
| | | | | | | | | | | Reviewed by: kevlo, pfg (mentor) Approved by: pfg (mentor) MFC after: 6 months Differential Revision: https://reviews.freebsd.org/D11530 Notes: svn path=/head/; revision=327584
* sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326023
* Add inital extents read-write support.Fedor Uporov2017-10-171-0/+74
| | | | | | | | | | | Approved by: pfg (mentor) MFC after: 6 months RelNotes: Yes Differential Revision: https://reviews.freebsd.org/D12087 Notes: svn path=/head/; revision=324706
* prefix UFS symbols with UFS_ to reduce namespace pollutionEd Maste2017-02-151-3/+3
| | | | | | | | | | | | | | | | | | | | | Specifically: ROOTINO -> UFS_ROOTINO WINO -> UFS_WINO NXADDR -> UFS_NXADDR NDADDR -> UFS_NDADDR NIADDR -> UFS_NIADDR MAXSYMLINKLEN_UFS[12] -> UFS[12]_MAXSYMLINKLEN (for consistency) Also prefix ext2's and nandfs's NDADDR and NIADDR with EXT2_ and NANDFS_ Reviewed by: kib, mckusick Obtained from: NetBSD MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D9536 Notes: svn path=/head/; revision=313780
* style(9) cleanups.Pedro F. Giffuni2016-12-281-19/+23
| | | | | | | | | Just to reduce some of the issues found with indent(1). MFC after: 1 week Notes: svn path=/head/; revision=310705
* ext2fs: renumber the license clauses to avoid skipping #3.Pedro F. Giffuni2016-12-021-1/+1
| | | | | | | | | | This is to keep consistency with other files, and help license-checking utilities determine the number of clauses that apply. No functional change. Notes: svn path=/head/; revision=309439
* ext2fs: use of tab vs spaces.Pedro F. Giffuni2014-02-281-2/+2
| | | | | | | | | | | | | Consistently use a single tab after a #define as mentioned in style(9). Use tabs instead of space for indenting. Fix a typo: "hash_vesion". No functional change. MFC after: 3 days Notes: svn path=/head/; revision=262623
* Define ext2fs local types and use them.Pedro F. Giffuni2013-08-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Add definitions for e2fs_daddr_t, e4fs_daddr_t in addition to the already existing e2fs_lbn_t and adjust them for ext4. Other than making the code more readable these changes should fix problems related to big filesystems. Setting the proper types can be tricky so the process was helped by looking at UFS. In our implementation, logical block numbers can be negative and the code depends on it. In ext2, block numbers are unsigned so it is convenient to keep e2fs_daddr_t unsigned and use the complete 32 bits. In the case of e4fs_daddr_t, while the value should be unsigned, for ext4 we only need to support 48 bits so preserving an extra bit from the sign is not an issue. While here also drop the ext2_setblock() prototype that was never used. Discussed with: mckusick, bde MFC after: 3 weeks Notes: svn path=/head/; revision=254283
* Define and use e2fs_lbn_t in ext2fs.Pedro F. Giffuni2013-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | | In line to what is done in UFS, define an internal type e2fs_lbn_t for the logical block numbers. This change is basically a no-op as the new type is unchanged (int32_t) but it may be useful as bumping this may be required for ext4fs. Also, as pointed out by Bruce Evans: -Use daddr_t for daddr in ext2_bmaparray(). This seems to improve reliability with the reallocblks option. - Add a cast to the fsbtodb() macro as in UFS. Reviewed by: bde MFC after: 3 days Notes: svn path=/head/; revision=252103
* Re-sort ext2fs headers to make things easier to find.Pedro F. Giffuni2013-06-161-1/+3
| | | | | | | | | | | | | | | | | In the ext2fs driver we have a mixture of headers: - The ext2_ prefixed headers have strong influence from NetBSD and are carry specific ext2/3/4 information. - The unprefixed headers are inspired on UFS and carry implementation specific information. Do some small adjustments so that the information is easier to find coming from either UFS or the NetBSD implementation. MFC after: 3 days Notes: svn path=/head/; revision=251809
* Relax some unnecessary unsigned type changes in ext2fs.Pedro F. Giffuni2013-06-131-4/+4
| | | | | | | | | | | | | | | | While the changes in r245820 are in line with the ext2 spec, the code derived from UFS can use negative values so it is better to relax some types to keep them as they were, and somewhat more similar to UFS. While here clean some casts. Some of the original types are still wrong and will require more work. Discussed with: bde MFC after: 3 days Notes: svn path=/head/; revision=251677
* Turn DIAGNOSTICs to INVARIANTS in ext2fs.Pedro F. Giffuni2013-06-121-1/+1
| | | | | | | | | | This is done to be consistent with what other filesystems and particularly ffs already does (see r173464). MFC after: 5 days Notes: svn path=/head/; revision=251658
* s/file system/filesystem/gPedro F. Giffuni2013-06-111-1/+1
| | | | | | | | | Based on r96755 from UFS. MFC after: 3 days Notes: svn path=/head/; revision=251612
* Add currently unused flag argument to the cluster_read(),Konstantin Belousov2013-03-141-1/+1
| | | | | | | | | | | cluster_write() and cluster_wbuild() functions. The flags to be allowed are a subset of the GB_* flags for getblk(). Sponsored by: The FreeBSD Foundation Tested by: pho Notes: svn path=/head/; revision=248282
* ext2fs: Use prototype declarations for function definitionsPedro F. Giffuni2013-02-101-7/+2
| | | | | | | | Submitted by: Christoph Mallon MFC after: 2 weeks Notes: svn path=/head/; revision=246634
* ext2fs: make some inode fields match the ext2 spec.Pedro F. Giffuni2013-01-221-1/+1
| | | | | | | | | | | | | | | | | Ext2fs uses unsigned fields in its dinode struct. FreeBSD can have negative values in some of those fields and the inode is meant to interact with the system so we have never respected the unsigned nature of most of those fields. Block numbers and the NFS generation number do not need to be signed so redefine them as unsigned to better match the on-disk information. MFC after: 1 week Notes: svn path=/head/; revision=245820
* Style cleanups by jh@.Pedro F. Giffuni2011-12-161-1/+1
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=228583
* Sync with several changes in UFS/FFS:John Baldwin2011-04-281-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=221166
* Bring in the ext2fs work done by Aditya Sarawgi during and after Google SummerUlf Lilleengen2010-01-141-0/+292
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> Notes: svn path=/head/; revision=202283