summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-01-28 14:39:05 +0000
committerpfg <pfg@FreeBSD.org>2014-01-28 14:39:05 +0000
commit034bc4e9782684de48dc768d30bd7923dee7c98b (patch)
treedc7641e092394dd37ea82bf305957bf7758234a9 /sys/fs
parentec795122057b71761df5f7e3457db20311c6731e (diff)
downloadFreeBSD-src-034bc4e9782684de48dc768d30bd7923dee7c98b.zip
FreeBSD-src-034bc4e9782684de48dc768d30bd7923dee7c98b.tar.gz
ext2fs: Use i_flag instead of i_flags for Ext4 inode flags.
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
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/ext2fs/ext2_bmap.c2
-rw-r--r--sys/fs/ext2fs/ext2_htree.c4
-rw-r--r--sys/fs/ext2fs/ext2_inode_cnv.c6
-rw-r--r--sys/fs/ext2fs/ext2_lookup.c2
-rw-r--r--sys/fs/ext2fs/ext2_subr.c6
-rw-r--r--sys/fs/ext2fs/ext2_vfsops.c4
-rw-r--r--sys/fs/ext2fs/ext2_vnops.c5
-rw-r--r--sys/fs/ext2fs/inode.h4
8 files changed, 17 insertions, 16 deletions
diff --git a/sys/fs/ext2fs/ext2_bmap.c b/sys/fs/ext2fs/ext2_bmap.c
index ca679c5..1ae3c2d 100644
--- a/sys/fs/ext2fs/ext2_bmap.c
+++ b/sys/fs/ext2fs/ext2_bmap.c
@@ -74,7 +74,7 @@ ext2_bmap(struct vop_bmap_args *ap)
if (ap->a_bnp == NULL)
return (0);
- if (VTOI(ap->a_vp)->i_flags & E4_EXTENTS)
+ if (VTOI(ap->a_vp)->i_flag & IN_E4EXTENTS)
error = ext4_bmapext(ap->a_vp, ap->a_bn, &blkno,
ap->a_runp, ap->a_runb);
else
diff --git a/sys/fs/ext2fs/ext2_htree.c b/sys/fs/ext2fs/ext2_htree.c
index 5cfec52..34af8ae 100644
--- a/sys/fs/ext2fs/ext2_htree.c
+++ b/sys/fs/ext2fs/ext2_htree.c
@@ -90,7 +90,7 @@ int
ext2_htree_has_idx(struct inode *ip)
{
if (EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) &&
- ip->i_flags & E4_INDEX)
+ ip->i_flag & IN_E4INDEX)
return (1);
else
return (0);
@@ -654,7 +654,7 @@ ext2_htree_create_index(struct vnode *vp, struct componentname *cnp,
((char *)ep + ep->e2d_reclen);
ep->e2d_reclen = buf1 + blksize - (char *)ep;
- dp->i_flags |= E4_INDEX;
+ dp->i_flag |= IN_E4INDEX;
/*
* Initialize index root.
diff --git a/sys/fs/ext2fs/ext2_inode_cnv.c b/sys/fs/ext2fs/ext2_inode_cnv.c
index 2205e3b..31c9557 100644
--- a/sys/fs/ext2fs/ext2_inode_cnv.c
+++ b/sys/fs/ext2fs/ext2_inode_cnv.c
@@ -108,8 +108,8 @@ ext2_ei2i(struct ext2fs_dinode *ei, struct inode *ip)
ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0;
ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0;
ip->i_flags |= (ei->e2di_flags & EXT2_NODUMP) ? UF_NODUMP : 0;
- ip->i_flags |= (ei->e2di_flags & EXT4_INDEX) ? E4_INDEX : 0;
- ip->i_flags |= (ei->e2di_flags & EXT4_EXTENTS) ? E4_EXTENTS : 0;
+ ip->i_flag |= (ei->e2di_flags & EXT4_INDEX) ? IN_E4INDEX : 0;
+ ip->i_flag |= (ei->e2di_flags & EXT4_EXTENTS) ? IN_E4EXTENTS : 0;
ip->i_blocks = ei->e2di_nblock;
if (E2DI_HAS_HUGE_FILE(ip)) {
ip->i_blocks |= (uint64_t)ei->e2di_nblock_high << 32;
@@ -158,6 +158,8 @@ ext2_i2ei(struct inode *ip, struct ext2fs_dinode *ei)
ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0;
ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0;
ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP: 0;
+ ei->e2di_flags |= (ip->i_flag & IN_E4INDEX) ? EXT4_INDEX: 0;
+ ei->e2di_flags |= (ip->i_flag & IN_E4EXTENTS) ? EXT4_EXTENTS: 0;
ei->e2di_nblock = ip->i_blocks & 0xffffffff;
ei->e2di_nblock_high = ip->i_blocks >> 32 & 0xffff;
ei->e2di_gen = ip->i_gen;
diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c
index 1fd7da0..c674197 100644
--- a/sys/fs/ext2fs/ext2_lookup.c
+++ b/sys/fs/ext2fs/ext2_lookup.c
@@ -887,7 +887,7 @@ ext2_direnter(struct inode *ip, struct vnode *dvp, struct componentname *cnp)
if (ext2_htree_has_idx(dp)) {
error = ext2_htree_add_entry(dvp, &newdir, cnp);
if (error) {
- dp->i_flags &= ~E4_INDEX;
+ dp->i_flag &= ~IN_E4INDEX;
dp->i_flag |= IN_CHANGE | IN_UPDATE;
}
return (error);
diff --git a/sys/fs/ext2fs/ext2_subr.c b/sys/fs/ext2fs/ext2_subr.c
index 585a975..6b9041d 100644
--- a/sys/fs/ext2fs/ext2_subr.c
+++ b/sys/fs/ext2fs/ext2_subr.c
@@ -82,10 +82,10 @@ ext2_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp)
*bpp = NULL;
/*
- * E4_EXTENTS requires special treatment as we can otherwise fall
+ * IN_E4EXTENTS requires special treatment as we can otherwise fall
* back to the normal path.
*/
- if (!(ip->i_flags & E4_EXTENTS))
+ if (!(ip->i_flag & IN_E4EXTENTS))
goto normal;
memset(&path, 0, sizeof(path));
@@ -110,7 +110,7 @@ ext2_blkatoff(struct vnode *vp, off_t offset, char **res, struct buf **bpp)
if (res)
*res = (char *)bp->b_data + blkoff(fs, offset);
/*
- * If E4_EXTENTS is enabled we would get a wrong offset so
+ * If IN_E4EXTENTS is enabled we would get a wrong offset so
* reset b_offset here.
*/
bp->b_offset = lbn * bsize;
diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c
index 3ad5786..a18d5cc1 100644
--- a/sys/fs/ext2fs/ext2_vfsops.c
+++ b/sys/fs/ext2fs/ext2_vfsops.c
@@ -964,10 +964,10 @@ ext2_vget(struct mount *mp, ino_t ino, int flags, struct vnode **vpp)
* blocks are zeroed out - ext2_balloc depends on this
* although for regular files and directories only
*
- * If E4_EXTENTS is enabled, unused blocks are not zeroed
+ * If IN_E4EXTENTS is enabled, unused blocks are not zeroed
* out because we could corrupt the extent tree.
*/
- if (!(ip->i_flags & E4_EXTENTS) &&
+ if (!(ip->i_flag & IN_E4EXTENTS) &&
(S_ISDIR(ip->i_mode) || S_ISREG(ip->i_mode))) {
used_blocks = (ip->i_size+fs->e2fs_bsize-1) / fs->e2fs_bsize;
for (i = used_blocks; i < EXT2_NDIR_BLOCKS; i++)
diff --git a/sys/fs/ext2fs/ext2_vnops.c b/sys/fs/ext2fs/ext2_vnops.c
index 1ab1fdd..4bcedc2 100644
--- a/sys/fs/ext2fs/ext2_vnops.c
+++ b/sys/fs/ext2fs/ext2_vnops.c
@@ -343,8 +343,7 @@ ext2_getattr(struct vop_getattr_args *ap)
vap->va_birthtime.tv_sec = ip->i_birthtime;
vap->va_birthtime.tv_nsec = ip->i_birthnsec;
}
- /* E4_* flags are private to the filesystem. */
- vap->va_flags = ip->i_flags & ~(E4_INDEX | E4_EXTENTS);
+ vap->va_flags = ip->i_flags;
vap->va_gen = ip->i_gen;
vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize;
vap->va_bytes = dbtob((u_quad_t)ip->i_blocks);
@@ -1616,7 +1615,7 @@ ext2_read(struct vop_read_args *ap)
ip = VTOI(vp);
/*EXT4_EXT_LOCK(ip);*/
- if (ip->i_flags & E4_EXTENTS)
+ if (ip->i_flag & IN_E4EXTENTS)
error = ext4_ext_read(ap);
else
error = ext2_ind_read(ap);
diff --git a/sys/fs/ext2fs/inode.h b/sys/fs/ext2fs/inode.h
index af244ad..21c7944 100644
--- a/sys/fs/ext2fs/inode.h
+++ b/sys/fs/ext2fs/inode.h
@@ -157,8 +157,8 @@ struct inode {
* These are translation flags for some attributes that Ext4
* passes as inode flags but that we cannot pass directly.
*/
-#define E4_INDEX 0x01000000
-#define E4_EXTENTS 0x02000000
+#define IN_E4INDEX 0x010000
+#define IN_E4EXTENTS 0x020000
#define i_devvp i_ump->um_devvp
OpenPOWER on IntegriCloud