aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/ext2fs/ext2_inode_cnv.c
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* Improve extents verification logicFedor Uporov2021-12-301-4/+4
| | | | | | | | | | | | | Add functionality for extents validation inside the filesystem extents block. The main logic is implemented under ext4_validate_extent_entries() function, which verifies extents or extents indexes depending of extent depth value. PR: 259112 Reported by: Robert Morris Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33375
* Add more accurate check for root inodeFedor Uporov2021-12-301-9/+10
| | | | | | | | Check that root inode has links and is directory. PR: 259105 Reported by: Robert Morris MFC after: 2 weeks
* Make encode/decode extra time functions inline.Fedor Uporov2021-05-081-2/+2
| | | | | Mentioned by: pfg MFC after: 2 weeks
* Make inode extra time fields updating logic more closer to linux.Fedor Uporov2021-05-071-15/+38
| | | | | | | | | Found using pjdfstest: pjdfstest/tests/utimensat/09.t Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29933
* Improve extents verification logic.Fedor Uporov2021-05-071-1/+1
| | | | | | | | | | It is possible to walk thru inode extents if EXT2FS_PRINT_EXTENTS macro is defined. The extents headers magics and physical blocks ranges are checked during extents walk. Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29932
* Add chr/blk devices support.Fedor Uporov2021-05-071-2/+52
| | | | | | | | | | The dev field is placed into the inode structure. The major/minor numbers conversion to/from linux compatile format happen during on-disk inodes writing/reading. Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29930
* fs: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365070
* extfs: remove redundant little endian conversion.Pedro F. Giffuni2020-08-201-4/+4
| | | | | | | | | | | | | The XTIME_TO_NSEC macro already calls the htole32(), so there is no need to call it twice. This code does nothing on LE platforms and affects only nanosecond and birthtime fields so it's difficult to notice on regular use. Hinted by: DragonFlyBSD (git ae503f8f6f4b9a413932ffd68be029f20c38cab4) X-MFC with: r361136 Notes: svn path=/head/; revision=364416
* extfs: remove redundant little endian conversion.Pedro F. Giffuni2020-08-171-4/+4
| | | | | | | | | | | The NSEC_TO_XTIME macro already calls the htole32(), so there is no need to call it twice. This code does nothing on LE platforms and affects only nanosecond and birthtime fields so it's difficult to notice on regular use. X-MFC with: r361136 Notes: svn path=/head/; revision=364308
* Add BE architectures support.Fedor Uporov2020-05-171-74/+102
| | | | | | | | | | | | 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: Initial version of DTrace support.Fedor Uporov2019-04-161-7/+16
| | | | | | | | | | Reviewed by: pfg, gnn MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D19848 Notes: svn path=/head/; revision=346267
* Add additional on-disk inode checks.Fedor Uporov2019-03-041-1/+23
| | | | | | | | | | Reviewed by: pfg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D19323 Notes: svn path=/head/; revision=344752
* Fix directory blocks checksumming.Fedor Uporov2018-05-131-1/+2
| | | | | | | | | | Reviewed by: pfg MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D15396 Notes: svn path=/head/; revision=333586
* Fix on-disk inode checksum calculation logic.Fedor Uporov2018-05-131-8/+1
| | | | | | | | | | Reviewed by: pfg MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D15395 Notes: svn path=/head/; revision=333585
* Fix EXT2FS_DEBUG definition usage.Fedor Uporov2018-05-131-5/+7
| | | | | | | | | | Reviewed by: pfg MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D15394 Notes: svn path=/head/; revision=333584
* Fix mistake in case of zeroed inode check.Fedor Uporov2018-01-291-1/+4
| | | | | | | | Reported by: pho MFC after: 6 months Notes: svn path=/head/; revision=328566
* Add metadata_csum feature support.Fedor Uporov2018-01-141-1/+12
| | | | | | | | | | | Reviewed by: pfg (mentor) Approved by: pfg (mentor) MFC after: 6 months Differential Revision: https://reviews.freebsd.org/D13810 Notes: svn path=/head/; revision=327977
* SPDX: Complete license IDs for ext2fs.Pedro F. Giffuni2017-12-021-0/+2
| | | | Notes: svn path=/head/; revision=326474
* Add inital extents read-write support.Fedor Uporov2017-10-171-25/+19
| | | | | | | | | | | Approved by: pfg (mentor) MFC after: 6 months RelNotes: Yes Differential Revision: https://reviews.freebsd.org/D12087 Notes: svn path=/head/; revision=324706
* Add check to avoid raw inode iblocks fields overflow in case of huge_file ↵Fedor Uporov2017-09-271-3/+18
| | | | | | | | | | | | | | feature. Use the Linux logic for now. Reviewed by: pfg (mentor) Approved by: pfg (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D12131 Notes: svn path=/head/; revision=324064
* Remove stale comments.Pedro F. Giffuni2017-07-091-2/+2
| | | | | | | | | There's no real advantage in using memcpy here. Dicussed with: bde (long ago) Notes: svn path=/head/; revision=320842
* ext2fs: Support e2di_uid_high and e2di_gid_high.Pedro F. Giffuni2017-06-271-2/+6
| | | | | | | | | | | | | The fields exist on all versions of the filesystem and using them is a mount option on linux. For FreeBSD, the corresponding i_uid and i_gid are always long enough so use them by default. Reviewed by: Fedor Uporov MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D11354 Notes: svn path=/head/; revision=320408
* ext2fs: add read-write support for Extended Attributes.Pedro F. Giffuni2017-05-031-2/+4
| | | | | | | | | | | | | | | | | Extended attributes and their particular implementation in linux are different from FreeBSD so in this case we have started diverging from the UFS EA implementation, which would be the natural reference. Depending on future progress implementing ACLs this approach may change but for now bring to the tree an implementation that is consistent and can be tested. Submitted by: Fedor Uporov Differential Revision: https://reviews.freebsd.org/D10460 Notes: svn path=/head/; revision=317779
* ext2fs: Initial support for Extended Attributes.Pedro F. Giffuni2017-04-011-0/+2
| | | | | | | | | | | Currently read-only. Submitted by: Fedor Uporov MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D10151 Notes: svn path=/head/; revision=316341
* prefix UFS symbols with UFS_ to reduce namespace pollutionEd Maste2017-02-151-4/+4
| | | | | | | | | | | | | | | | | | | | | 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-25/+26
| | | | | | | | | Just to reduce some of the issues found with indent(1). MFC after: 1 week Notes: svn path=/head/; revision=310705
* Revert r294695:Pedro F. Giffuni2016-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 Notes: svn path=/head/; revision=295209
* ext2fs: passthrough any extra timestamps to the dinode struct.Pedro F. Giffuni2016-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 Notes: svn path=/head/; revision=294695
* Rename some directory index constants.Pedro F. Giffuni2016-01-241-2/+2
| | | | | | | | | 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. Notes: svn path=/head/; revision=294653
* ifdef ext2_print_inode which is not really used.Pedro F. Giffuni2014-11-121-0/+2
| | | | | | | | | | | | ext2_print_inode is not really used but it was nice to have for initial development work. #ifdef it under a new EXT2FS_DEBUG knob so that we don't spend time compiling it. MFC after: 3 days Notes: svn path=/head/; revision=274437
* ext2fs: use of tab vs spaces.Pedro F. Giffuni2014-02-281-1/+1
| | | | | | | | | | | | | 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
* ext2fs: Use i_flag instead of i_flags for Ext4 inode flags.Pedro F. Giffuni2014-01-281-2/+4
| | | | | | | | | | | | | | | | The ext4 inode flags do not have equivalents for chflags (1) and hold information that is private to the implementation. The i_flag field in the inode is a better place to hold the Ext4 inode flags as it saves us from masking flags while setting or getting attributes. It should also make things cleaner if we implement write support for Ext4. Suggested by: bde Tested by: Mike Ma MFC after: 3 days Notes: svn path=/head/; revision=261235
* ext2fs: Translate the EXT4_EXTENTS and EXT4_INDEX to the inode flags.Pedro F. Giffuni2014-01-211-0/+2
| | | | | | | | | | | | | | | | | r260545 cleared the inode flags to fix corruption problems but we still need to pass some EXT4 flags for the ext4 read-only mode. None of these attributes has an equivalent in FreeBSD and are uninteresting for the system utilities so they should be innaccessible in ext2_getattrib(). Note: we also use EXT4_HUGE_FILE but we use it directly from the dinode structure so it is not necessary to translate it, Suggested by: bde MFC after: 3 days Notes: svn path=/head/; revision=260988
* ext2fs: fix inode flag conversion.Pedro F. Giffuni2014-01-111-2/+2
| | | | | | | | | | | | | | | | | | | | | After r252890 we are naively attempting to pass through the inode flags. This is technically incorrect as the ext2 inode flags don't match the UFS/system values used in FreeBSD and a clean conversion is needed. Some filtering was left in place so the change didn't cause significant changes in FreeBSD but some of the garbage passed is likely to be the cause for warning messages in linux. Fix the issue by resetting the flags before conversion as was done previously. This also means we will not pass the EXT4_* inode flags into FreeBSD's inode. PR: kern/185448 MFC after: 3 days Notes: svn path=/head/; revision=260545
* Add read-only support for extents in ext2fs.Pedro F. Giffuni2013-08-121-9/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basic support for extents was implemented by Zheng Liu as part of his Google Summer of Code in 2010. This support is read-only at this time. In addition to extents we also support the huge_file extension for read-only purposes. This works nicely with the additional support for birthtime/nanosec timestamps and dir_index that have been added lately. The implementation may not work for all ext4 filesystems as it doesn't support some features that are being enabled by default on recent linux like flex_bg. Nevertheless, the feature should be very useful for migration or simple access in filesystems that have been converted from ext2/3 or don't use incompatible features. Special thanks to Zheng Liu for his dedication and continued work to support ext2 in FreeBSD. Submitted by: Zheng Liu (lz@) Reviewed by: Mike Ma, Christoph Mallon (previous version) Sponsored by: Google Inc. MFC after: 3 weeks Notes: svn path=/head/; revision=254260
* Initial implementation of the HTree directory index.Pedro F. Giffuni2013-07-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | This is a port of NetBSD's GSoC 2012 Ext3 HTree directory indexing by Vyacheslav Matyushin. It was cleaned up and enhanced for FreeBSD by Zheng Liu (lz@). This is an excellent example of work shared among different projects: Vyacheslav was able to look at an early prototype from Zheng Liu who was also able to check the code from Haiku (with permission). As in linux, the feature is not available by default and must be enabled explicitly with tune2fs. We still do not support the workarounds required in readdir for NFS. Submitted by: Zheng Liu Tested by: Mike Ma Sponsored by: Google Inc. MFC after: 1 week Notes: svn path=/head/; revision=252890
* ext2fs: space vs tab.Pedro F. Giffuni2013-06-031-1/+1
| | | | | | | | Obtained from: Christoph Mallon MFC after: 3 days Notes: svn path=/head/; revision=251346
* ext2fs: Use prototype declarations for function definitionsPedro F. Giffuni2013-02-101-8/+3
| | | | | | | | Submitted by: Christoph Mallon MFC after: 2 weeks Notes: svn path=/head/; revision=246634
* More constant renaming in preparation for newer features.Pedro F. Giffuni2012-12-201-2/+3
| | | | | | | | | | | | | | | | | | We also try to make better use of the fs flags instead of trying adapt the code according to the fs structures. In the case of subsecond timestamps and birthtime we now check that the feature is explicitly enabled: previously we only checked that the reserved space was available and silently wrote them. This approach is much safer, especially if the filesystem happens to use embedded inodes or support EAs. Discussed with: Zheng Liu MFC after: 5 days Notes: svn path=/head/; revision=244475
* Fix up kernel sources to be ready for a 64-bit ino_t.Matthew D Fleming2012-09-271-1/+1
| | | | | | | Original code by: Gleb Kurtsou Notes: svn path=/head/; revision=241011
* Add support for ns timestamps and birthtime to the ext2/3 driver.Pedro F. Giffuni2012-03-081-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using big inodes there is sufficient space in ext3 to keep extra resolution and birthtime (creation) timestamps. The appropriate fields in the on-disk inode have been approved for a long time but support for this in ext3 has not been widely distributed. In preparation for ext4 most linux distributions have enabled by default such bigger inodes and some people use nanosecond timestamps in ext3. We now support those when the inode is big enough and while we do recognize the EXT4F_ROCOMPAT_EXTRA_ISIZE, we maintain the extra timestamps even when they are not used. An additional note by Bruce Evans: We blindly accept unrepresentable tv_nsec in VOP_SETATTR(), but all file systems have always done that. When POSIX gets around to specifying the behaviour, it will probably require certain rounding to the fs's resolution and not rejecting the request. This unfortunately means that syscalls that set times can't really tell if they succeeded without reading back the times using stat() or similar and checking that they were set close enough. Reviewed by: bde Approved by: jhb (mentor) MFC after: 2 weeks Notes: svn path=/head/; revision=232703
* Bring in the ext2fs work done by Aditya Sarawgi during and after Google SummerUlf Lilleengen2010-01-141-0/+138
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