summaryrefslogtreecommitdiff
path: root/lib/ext2fs
AgeCommit message (Collapse)AuthorFilesLines
2010-06-24Fix Makefile dependencies for test programs in lib/ext2fsTheodore Ts'o1-1/+5
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-24Add support for Next3 snapshot superblock fields to dumpe2fs and debugfsTheodore Ts'o1-0/+6
We also support for byte-swapping the Next3 fields, although the current Next3 implementation doesn't support big-endian systems. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13libext2fs: make fs->group_desc opaqueEric Sandeen2-182/+123
To prevent direct array indexing of fs->group_desc[i] (because the group_desc may be a different size for different filesystems) make it an opaque pointer that may only be accessed through the accessor functions in blknum.c. The type itself is still available in a public header; if we have a group_desc that we know is one type or another, it's ok to access its fields directly. This change only prevents us from indexing off fs->group_desc[i] directly. Old-style applications who don't want to change their source code can (as a temporary short-term hack) #define EXT2FS_OLD_32_COMPAT before including ext2fs.h. Change the accessors in blknum.c to use ext4fs_group_desc(), a version of ext2fs_group_desc() which returns a ext4_group_desc pointer. This simplifies and collapses a fair bit of code in blknum.c Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13mke2fs: Fix up mke2fs to be able to make 64-bit file systemsJose R. Santos1-2/+4
Use 64-bit interfaces in mke2fs. This should be most most of whats needed to support creating a 64-bit filesystem. Signed-off-by: Jose R. Santos <jrs@us.ibm.com> Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Nick Dokos <nicholas.dokos@hp.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13libext2fs: More random 64-bit fixes, lots of block_iterate3Valerie Aurora Henson13-44/+50
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13libext2fs: Create 64-bit dblist functionsTheodore Ts'o5-51/+203
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-13libext2fs: Teach *_initialize and *_allocate_group to be 64-bit safeTheodore Ts'o2-18/+31
This is needed to enable 64-bit mke2fs to work correctly. Signed-off-by: Jose R. Santos <jrs@us.ibm.com> Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Nick Dokos <nicholas.dokos@hp.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-07Merge branch 'maint' into nextTheodore Ts'o87-195/+246
Conflicts: e2fsck/journal.c e2fsck/pass1.c e2fsck/pass2.c misc/mke2fs.c
2010-06-02Reserve feature flags and fields needed for the Next3 snapshot featureTheodore Ts'o1-1/+15
The documentation is not (as of this writing) fully complete, but there is some documentation here: http://sourceforge.net/apps/mediawiki/next3/index.php?title=Code_documentation http://sourceforge.net/apps/mediawiki/next3/index.php?title=On-disk_format http://sourceforge.net/projects/next3/files/Next3_Snapshots.pdf/download ... which will hopefully be updated soon to be fully up to date with these assignments and more details about how things work. For now, the assignments should avoid collisions with other new work that people might want to do on ext3/4. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-02Reserve the EXT4_FEATURE_INCOMPAT_DIRDATA feature flagAndreas Dilger1-0/+1
Reserve the EXT4_FEATURE_INCOMPAT_DIRDATA feature flag for adding extra file data in ext2_dir_entry_2 entries. This changes the on-disk layout in the following way. Firstly, the ext2_dir_entry_2 file_type field now has a mask: that limits the "filetype" information to the low 4 bits of this field. Since these values are sequentially assigned, this allows for up to 7 more filetypes to be assigned. When reading the "filetype" field, the high 4 bits should be masked off when converting to DT_* filetypes for userspace. The high 4 bits of "filetype" are used as a bitmask to register up to 4 different "extended" directory entry fields. Extended data fields are packed without alignment into the directory entry after the "name" field in order of increasing bitmask value, for each field where bit is set. In order to avoid the need to "understand" each of the extended fields, the first byte of each extended data field holds the size of that data field (including the size itself), so they can be skipped if not understood. For fields that change the semantics of the filesystem it is expected that a separate ROCOMPAT or INCOMPAT field is registered. There is a single dirent data type defined currently, for Lustre: which holds a 128-bit file identifier. It is expected that if there are 64-bit inode values that this will be assigned the 0x20 value. Should a need ever arise to use all 4 of the extended dirent data fields, it would be possible to keep the last bit (0x80) for use as a multiplexor that stores a 1-byte aggregate data size, then a series of "<u8_size><u8_type><data>" records in the last extended data record. It is not expected that this will actually be needed in the lifetime of ext4. Signed-off-by: Andreas Dilger <adilger@sun.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-06-02Reserve the EXT4_INCOMPAT_EA_INODE feature flagAndreas Dilger1-0/+2
Reserve the EXT4_INCOMPAT_EA_INODE feature flag for use with large extended attributes that are stored in a separate inode. This changes the on-disk format in several ways: First, replace the e_value_block field with e_value_inum, so that an xattr entry can reference an external inode. This field is currently unused, as all of the entries live in the same block. struct ext2_ext_attr_entry { __u8 e_name_len; /* length of name */ __u8 e_name_index; /* attribute name index */ __le16 e_value_offs; /* offset in disk block of value */ > __le32 e_value_inum; /* inode in which the value is stored */ __le32 e_value_size; /* size of attribute value */ __le32 e_hash; /* hash value of name and value */ char e_name[0]; /* attribute name */ } Second, add a flag to the inode that indicates it is using a large (external) extended attribute. This is needed so that when unlinking an inode the xattrs will be scanned to unlink the xattr inodes referenced by the main inode. Third, for inodes that have a number of xattrs that are larger than a single block, but not large enough to justify an external inode (less than 64kB total xattr size, due to e_value_offs limitation) the ext2_ext_attr_header->h_blocks field can grow beyond a single block to represent a contiguous allocation of blocks for the xattr. Signed-off-by: Andreas Dilger <adilger@sun.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-31libext2fs: Remove #include of <linux/types.h> from fiemap.hTheodore Ts'o1-2/+0
The system header file can end up causing type conflicts, and including kernel header files is always dodgy/dangerous (and this case not needed). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-17mke2fs: account for physical as well as logical sector sizeTheodore Ts'o3-6/+44
Some devices, notably 4k sector drives, may have a 512 logical sector size, mapped onto a 4k physical sector size. When mke2fs is ratcheting down the blocksize for small filesystems, or when a blocksize is specified on the commandline, we should not willingly go below the physical sector size of the device. When a blocksize is specified, we -must- not go below the logical sector size of the device. Add a new library function, ext2fs_get_device_phys_sectsize() to get the physical sector size if possible, and adjust the logic in mke2fs to enforce the above rules. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-17libe2p, libext2fs: Update file copyright permission states to match COPYINGTheodore Ts'o84-185/+182
The top-level COPYING file states that the e2p and ext2fs libraries are available under the LGPLv2. The files were incorrectly labelled. Alex Thomas/Luster has been consulted wrt to the ext3_extents.h file; the rest of the files were primarily authored by Theodore Ts'o. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-17Always build namei.o so that building with "configure --disable-debugfs" worksTheodore Ts'o1-1/+2
namei.o is also needed by e2initrd_helper. Long term, if we care about reduced e2fsprogs builds, we need a more general solution for deciding what .o files are needed for a particular build. Given that install floppies are going (gone?) the way the dodo bird, we probably don't care, though. Addresses-Sourceforge-Bug: #2911433 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-03-15Merge branch 'maint' into nextTheodore Ts'o2-3/+6
2010-03-11ext2fs: Optimize extending an extent-mapped file using ext2fs_block_iterate2()Theodore Ts'o1-1/+3
When ext2fs_block_iterate2() is called on an extent-mapped file with a depth > 1, it will erroneously calling the callback function starting all over again with an offset of logical block 0. It shouldn't do this, and it cases mke2fs to become very slow when creating files with very large journals. Fix this. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-02-24e2fsck: don't complain about i_size for known blocks past EOFEric Sandeen1-2/+3
This is the userspace side of Jiaying's EOFBLOCKS patch. With Aneesh's patches for .33, Jiaying's patch, and this one, xfstests 013/fsstress (even with direct IO enabled) has held up through many runs. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-02-15libext2fs: Fix byte swapping bugsTheodore Ts'o2-12/+36
The 64-bit patches broke compiles on big endian systems. In addition the block group checksum test was failing, due to bugs in both the test case and the checksum code itself. This commit addresses these problems. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-01-31Merge branch 'maint' into nextTheodore Ts'o2-4/+3
Conflicts: configure lib/ext2fs/alloc_tables.c misc/mke2fs.c
2010-01-30libext2fs: Add some fail-safe checks to the 32-bit bitmap codeTheodore Ts'o3-1/+95
If a 64-bit bitmap is passed to a 32-bit bitmap function, add some checks to make sure that we print a useful error message so we can better catch potential problems. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-30libext2fs: Improve flex_bg inode table placement algorithmTheodore Ts'o1-0/+2
When trying to find the best place for the inode table in the last flex block group, use the true size for the flex_bg's portion of the inode table instead of the worst case required size of the inode table fragment if the file system is resized. This fixes a corner case where if the size of the filesystem is just big enough that there is only room for a single block group in the last flex_bg, and that partial block group is too small for the full portion of the inode table, the inode table is placed in the very first block group: Group 64: (Blocks 2097152-2099199) [INODE_UNINIT, ITABLE_ZEROED] Checksum 0xd305, unused inodes 8080 Block bitmap at 2097152 (+0), Inode bitmap at 2097168 (+16) Inode table at 8626-9130 (+4292878770) ^^^^^^^^^ Thanks to Vyacheslav Dubeyko for pointing this out. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29libext2fs: Fix SET_BMAP bugs in ext2fs_bmap() and ext2fs_bmap2()Theodore Ts'o1-4/+1
Don't byte-swap the block number when setting i_block[x], since the write_inode function will take of byte swapping the inode. The phys_blk parameter contains an input parameter in the SET_BMAP case, so it must be passed to ext2fs_bmap2() from the legacy function ext2fs_bmap(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-16Merge branch 'maint' into nextTheodore Ts'o2-2/+22
Conflicts: misc/mke2fs.c
2009-11-13libext2fs: handle <=linux-2.6.19 bug in /proc/swapsKarel Zak1-1/+11
Linux <= 2.6.19 contained a bug in the /proc/swaps code where the header would not be displayed (the first line). This issue has been reported by Mike Frysinger for swapon(8). Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-11-12libext2fs: don't swap extent-based journal backupEric Sandeen1-1/+11
The f_illitable_flexbg test was failing on ppc, because e2fsck_move_ext3_journal is doing a direct memcmp of i_block with s_jnl_blocks, and failing. This is because we don't swap extent data on read from disk; rather we do it when we access the extents. However, ext2fs_swap_super was swapping s_jnl_blocks unconditionally, so these didn't match. Looks like we need to treat s_jnl_blocks the same as i_block, and swap it on access, not on read. Except for the last i_size bit... Reviewed-by: Andreas Dilger <adilger@sun.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-10-25Add 64bit option to known incompatible file system optionsValerie Aurora Henson1-1/+2
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25Convert ext2fs_group_{first,last}_block() to *block2()Theodore Ts'o2-9/+9
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25Convert ext2fs_group_of_blk() to ext2fs_group_of_blk2()Theodore Ts'o2-4/+4
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25Convert ext2fs_block_alloc_stats() calls to block_alloc_stats2()Valerie Aurora Henson5-6/+7
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25libext2fs: Byte-swap 64-bit block group descriptorsTheodore Ts'o5-14/+39
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25Convert to use block group accessor functionsValerie Aurora Henson14-95/+98
Convert direct accesses to use the following block group accessor functions: ext2fs_block_bitmap_loc(), ext2fs_inode_bitmap_loc(), ext2fs_inode_table_loc(), ext2fs_bg_itable_unused(), ext2fs_block_bitmap_loc_set(), ext2fs_inode_bitmap_loc_set(), ext2fs_inode_table_loc_set(), ext2fs_bg_free_inodes_count(), ext2fs_ext2fs_bg_used_dirs_count(), ext2fs_bg_free_inodes_count_set(), ext2fs_bg_free_blocks_count_set(), ext2fs_bg_used_dirs_count_set() Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Nick Dokos <nicholas.dokos@hp.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25libext2fs: Convert ext2fs_bg_flag_test() to ext2fs_bg_flags_test()Theodore Ts'o5-9/+9
After cleaning up ext2fs_bg_flag_set() and ext2fs_bg_flag_clear(), we're left with ext2fs_bg_flag_test(). Convert it to ext2fs_bg_flags_test(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25libext2fs: clean up ext2fs_bg_flags_ interfacesEric Sandeen9-45/+27
The ext2fs_bg_flag* functions were confusing. Currently we have this: void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags); void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,__u16 bg_flags); (_set (unused) sets exactly bg_flags; _clear clears all and ignores bg_flags) and these, which can twiddle individual bits in bg_flags: void ext2fs_bg_flag_set(ext2_filsys fs, dgrp_t group, __u16 bg_flag); void ext2fs_bg_flag_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flag); A better interface, after the patch below, is just: ext2fs_bg_flags_zap(fs, group) /* zeros bg_flags */ ext2fs_bg_flags_set(fs, group, flags) /* adds flags to bg_flags */ ext2fs_bg_flags_clear(fs, group, flags) /* clears flags in bg_flags */ and remove the original ext2fs_bg_flags_set / ext2fs_bg_flags_clear. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-24Merge branch 'maint' into nextTheodore Ts'o2-30/+45
Conflicts: configure configure.in
2009-10-21libext2fs: Fix FEATURE_RO_COMPAT_HUGE_FILE && !HUGE_FILE_FLTheodore Ts'o1-27/+40
If the RO compat HUGE_FILE feature flag is set, but the inode's HUGE_FILE_FL flag is not set, we should still pay attention to the high 32 bits of the i_blocks filed. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04Merge branch 'maint' into nextTheodore Ts'o4-3/+8
Conflicts: configure configure.in misc/mke2fs.c
2009-10-04libext2fs: Always build file_io.cTheodore Ts'o1-2/+2
Commit 1d9b818: dumpe2fs: Print more information about the inline journal caused dumpe2fs to use ext2fs_file_open2(). Previously the file_io functions were only used by debugfs, so if debugfs was disabled, file_io was not built. Now that dumpe2fs is also using file_io, we need to build it unconditionally. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-08libext2fs: Add error table initialization to test programsTheodore Ts'o4-1/+6
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count()Valerie Aurora Henson17-51/+56
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Nick Dokos <nicholas.dokos@hp.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Use ext2fs_file_acl_block() instead of using .i_file_acl directlyValerie Aurora Henson2-4/+4
This provides support for 48-bit file acl blocks. Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Fix overflow in calculation of total file system blocksValerie Aurora Henson2-3/+3
Blocks per group and group desc count are both 32-bit; multiplied they produce a 32-bit quantity which overflowed. Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07libext2fs: Round up the bitmap size when allocating a new bitmapTheodore Ts'o1-0/+2
The x86 BT assembly instructure can overshoot the end of a bit array when testing a bit at the end of the bit array, even if it never needs to look at those memory locations. This can cause a spurious segmentation fault. If we allocate a little extra memory, it avoids this problem. See: http://faydoc.tripod.com/cpu/bt.htm This doesn't happen on Linux, probably because of the glibc's malloc() function works, but apparently it's a major problem on the *BSD operating systems. Addresses-Sourceforge-Bug: #2328708 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-25tune2fs: Fix "tune2fs -j <dev>" for extent-enabled filesystemsTheodore Ts'o1-4/+16
For filesystms that have the extent feature enabled, we need to grab the use EXT2_IOC_GETFLAGS so that we don't accidentally end up trying to request clearing the EXT2_EXTENT_FL, which is not supported and causes the tune2fs -j error out. Also fix the error returning in ext2fs_add_journal_inode() so it returns a proper error code if the fstat() or ioctl() calls fail. Addresses-Launchpad-bug: #416648 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-23libext2fs: create generic numeric progress meters and use themValerie Aurora Henson6-1/+122
With 64-bit file systems, mke2fs can take a long time to do things other than write inode tables. I exported the mke2fs numeric progress meter and used it for allocating group tables and the final file system flush. Signed-off-by: Valerie Aurora (Henson) <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Use accessor functions fields for bg_flags in the block group descriptorsTheodore Ts'o8-28/+30
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Convert to use io_channel_read_blk64() and io_channel_write_blk64()Valerie Aurora Henson12-30/+32
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07libext2fs: Fix counting routines in blknum.c to take/return __u32 countsNick Dokos2-32/+32
Several routines in lib/ext2fs/blknum.c: ext2fs_bg_free_blocks_count() ext2fs_bg_free_inodes_count() ext2fs_bg_used_dirs_count() ext2fs_bg_itable_unused() and their _set() counterparts, operate as if they are dealing with blk64_t quantities, but they should be dealing with __u32 counts instead. Signed-off-by: Nick Dokos <nicholas.dokos@hp.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-09-07Merge branch 'maint' into nextTheodore Ts'o2-4/+18
2009-08-09libext2fs: Treat uninitialized parts of bitmaps as unallocatedTheodore Ts'o1-2/+2
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>