Skip to content

Commit 383f01f

Browse files
committed
GFS2: Banish struct gfs2_dinode_host
The final field in gfs2_dinode_host was the i_flags field. Thats renamed to i_diskflags in order to avoid confusion with the existing inode flags, and moved into the inode proper at a suitable location to avoid creating a "hole". At that point struct gfs2_dinode_host is no longer needed and as promised (quite some time ago!) it can now be removed completely. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
1 parent c9e9888 commit 383f01f

12 files changed

Lines changed: 38 additions & 48 deletions

File tree

‎fs/gfs2/bmap.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ static int trunc_start(struct gfs2_inode *ip, u64 size)
10471047
if (!error) {
10481048
ip->i_disksize = size;
10491049
ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
1050-
ip->i_di.di_flags |= GFS2_DIF_TRUNC_IN_PROG;
1050+
ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG;
10511051
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
10521052
gfs2_dinode_out(ip, dibh->b_data);
10531053
}
@@ -1120,7 +1120,7 @@ static int trunc_end(struct gfs2_inode *ip)
11201120
gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
11211121
}
11221122
ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
1123-
ip->i_di.di_flags &= ~GFS2_DIF_TRUNC_IN_PROG;
1123+
ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG;
11241124

11251125
gfs2_trans_add_bh(ip->i_gl, dibh, 1);
11261126
gfs2_dinode_out(ip, dibh->b_data);

‎fs/gfs2/dir.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* the block. In leaves, they begin at offset sizeof(struct gfs2_leaf) from the
3737
* beginning of the leaf block. The dirents reside in leaves when
3838
*
39-
* dip->i_di.di_flags & GFS2_DIF_EXHASH is true
39+
* dip->i_diskflags & GFS2_DIF_EXHASH is true
4040
*
4141
* Otherwise, the dirents are "linear", within a single stuffed dinode block.
4242
*
@@ -755,7 +755,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
755755
struct gfs2_inode *ip = GFS2_I(inode);
756756
int error;
757757

758-
if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
758+
if (ip->i_diskflags & GFS2_DIF_EXHASH) {
759759
struct gfs2_leaf *leaf;
760760
unsigned hsize = 1 << ip->i_depth;
761761
unsigned index;
@@ -907,7 +907,7 @@ static int dir_make_exhash(struct inode *inode)
907907

908908
dip->i_disksize = sdp->sd_sb.sb_bsize / 2;
909909
gfs2_add_inode_blocks(&dip->i_inode, 1);
910-
dip->i_di.di_flags |= GFS2_DIF_EXHASH;
910+
dip->i_diskflags |= GFS2_DIF_EXHASH;
911911

912912
for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ;
913913
dip->i_depth = y;
@@ -1429,7 +1429,7 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
14291429
if (!dip->i_entries)
14301430
return 0;
14311431

1432-
if (dip->i_di.di_flags & GFS2_DIF_EXHASH)
1432+
if (dip->i_diskflags & GFS2_DIF_EXHASH)
14331433
return dir_e_read(inode, offset, opaque, filldir);
14341434

14351435
if (!gfs2_is_stuffed(dip)) {
@@ -1612,7 +1612,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
16121612
dent = gfs2_init_dirent(inode, dent, name, bh);
16131613
gfs2_inum_out(nip, dent);
16141614
dent->de_type = cpu_to_be16(type);
1615-
if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
1615+
if (ip->i_diskflags & GFS2_DIF_EXHASH) {
16161616
leaf = (struct gfs2_leaf *)bh->b_data;
16171617
be16_add_cpu(&leaf->lf_entries, 1);
16181618
}
@@ -1628,7 +1628,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
16281628
error = 0;
16291629
break;
16301630
}
1631-
if (!(ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
1631+
if (!(ip->i_diskflags & GFS2_DIF_EXHASH)) {
16321632
error = dir_make_exhash(inode);
16331633
if (error)
16341634
break;
@@ -1691,7 +1691,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
16911691
}
16921692

16931693
dirent_del(dip, bh, prev, dent);
1694-
if (dip->i_di.di_flags & GFS2_DIF_EXHASH) {
1694+
if (dip->i_diskflags & GFS2_DIF_EXHASH) {
16951695
struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
16961696
u16 entries = be16_to_cpu(leaf->lf_entries);
16971697
if (!entries)
@@ -1748,7 +1748,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
17481748
gfs2_inum_out(nip, dent);
17491749
dent->de_type = cpu_to_be16(new_type);
17501750

1751-
if (dip->i_di.di_flags & GFS2_DIF_EXHASH) {
1751+
if (dip->i_diskflags & GFS2_DIF_EXHASH) {
17521752
brelse(bh);
17531753
error = gfs2_meta_inode_buffer(dip, &bh);
17541754
if (error)

‎fs/gfs2/eattr.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data)
118118
if (error)
119119
return error;
120120

121-
if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT)) {
121+
if (!(ip->i_diskflags & GFS2_DIF_EA_INDIRECT)) {
122122
error = ea_foreach_i(ip, bh, ea_call, data);
123123
goto out;
124124
}
@@ -935,7 +935,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
935935
int error;
936936
int mh_size = sizeof(struct gfs2_meta_header);
937937

938-
if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) {
938+
if (ip->i_diskflags & GFS2_DIF_EA_INDIRECT) {
939939
__be64 *end;
940940

941941
error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT,
@@ -974,7 +974,7 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
974974
eablk = (__be64 *)(indbh->b_data + mh_size);
975975
*eablk = cpu_to_be64(ip->i_eattr);
976976
ip->i_eattr = blk;
977-
ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT;
977+
ip->i_diskflags |= GFS2_DIF_EA_INDIRECT;
978978
gfs2_add_inode_blocks(&ip->i_inode, 1);
979979

980980
eablk++;
@@ -1015,7 +1015,7 @@ static int ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
10151015
if (error)
10161016
return error;
10171017

1018-
if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT))
1018+
if (!(ip->i_diskflags & GFS2_DIF_EA_INDIRECT))
10191019
blks++;
10201020
if (GFS2_EAREQ_SIZE_STUFFED(er) > GFS2_SB(&ip->i_inode)->sd_jbsize)
10211021
blks += DIV_ROUND_UP(er->er_data_len, GFS2_SB(&ip->i_inode)->sd_jbsize);
@@ -1051,7 +1051,7 @@ int gfs2_ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er)
10511051
return error;
10521052

10531053
if (el.el_ea) {
1054-
if (ip->i_di.di_flags & GFS2_DIF_APPENDONLY) {
1054+
if (ip->i_diskflags & GFS2_DIF_APPENDONLY) {
10551055
brelse(el.el_bh);
10561056
return -EPERM;
10571057
}
@@ -1388,7 +1388,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
13881388
if (bstart)
13891389
gfs2_free_meta(ip, bstart, blen);
13901390

1391-
ip->i_di.di_flags &= ~GFS2_DIF_EA_INDIRECT;
1391+
ip->i_diskflags &= ~GFS2_DIF_EA_INDIRECT;
13921392

13931393
error = gfs2_meta_inode_buffer(ip, &dibh);
13941394
if (!error) {
@@ -1479,7 +1479,7 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip)
14791479
if (error)
14801480
goto out_rindex;
14811481

1482-
if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) {
1482+
if (ip->i_diskflags & GFS2_DIF_EA_INDIRECT) {
14831483
error = ea_dealloc_indirect(ip);
14841484
if (error)
14851485
goto out_rindex;

‎fs/gfs2/glops.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ static int inode_go_lock(struct gfs2_holder *gh)
239239
return error;
240240
}
241241

242-
if ((ip->i_di.di_flags & GFS2_DIF_TRUNC_IN_PROG) &&
242+
if ((ip->i_diskflags & GFS2_DIF_TRUNC_IN_PROG) &&
243243
(gl->gl_state == LM_ST_EXCLUSIVE) &&
244244
(gh->gh_state == LM_ST_EXCLUSIVE))
245245
error = gfs2_truncatei_resume(ip);

‎fs/gfs2/incore.h‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,6 @@ enum {
233233
GIF_USER = 4, /* user inode, not metadata addr space */
234234
};
235235

236-
struct gfs2_dinode_host {
237-
u32 di_flags; /* GFS2_DIF_... */
238-
};
239236

240237
struct gfs2_inode {
241238
struct inode i_inode;
@@ -245,16 +242,14 @@ struct gfs2_inode {
245242
u64 i_eattr;
246243
loff_t i_disksize;
247244
unsigned long i_flags; /* GIF_... */
248-
249-
struct gfs2_dinode_host i_di; /* To be replaced by ref to block */
250-
251245
struct gfs2_glock *i_gl; /* Move into i_gh? */
252246
struct gfs2_holder i_iopen_gh;
253247
struct gfs2_holder i_gh; /* for prepare/commit_write only */
254248
struct gfs2_alloc *i_alloc;
255249
u64 i_goal; /* goal block for allocations */
256250
struct rw_semaphore i_rw_mutex;
257251
u32 i_entries;
252+
u32 i_diskflags;
258253
u8 i_height;
259254
u8 i_depth;
260255
};

‎fs/gfs2/inode.c‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ struct inode *gfs2_inode_lookup(struct super_block *sb,
247247

248248
static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
249249
{
250-
struct gfs2_dinode_host *di = &ip->i_di;
251250
const struct gfs2_dinode *str = buf;
252251
struct timespec atime;
253252
u16 height, depth;
@@ -288,7 +287,7 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
288287
ip->i_goal = be64_to_cpu(str->di_goal_meta);
289288
ip->i_generation = be64_to_cpu(str->di_generation);
290289

291-
di->di_flags = be32_to_cpu(str->di_flags);
290+
ip->i_diskflags = be32_to_cpu(str->di_flags);
292291
gfs2_set_inode_flags(&ip->i_inode);
293292
height = be16_to_cpu(str->di_height);
294293
if (unlikely(height > GFS2_MAX_META_HEIGHT))
@@ -789,11 +788,11 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
789788
di->di_flags = 0;
790789

791790
if (S_ISREG(mode)) {
792-
if ((dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA) ||
791+
if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) ||
793792
gfs2_tune_get(sdp, gt_new_files_jdata))
794793
di->di_flags |= cpu_to_be32(GFS2_DIF_JDATA);
795794
} else if (S_ISDIR(mode)) {
796-
di->di_flags |= cpu_to_be32(dip->i_di.di_flags &
795+
di->di_flags |= cpu_to_be32(dip->i_diskflags &
797796
GFS2_DIF_INHERIT_JDATA);
798797
}
799798

@@ -1241,7 +1240,6 @@ int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
12411240

12421241
void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
12431242
{
1244-
const struct gfs2_dinode_host *di = &ip->i_di;
12451243
struct gfs2_dinode *str = buf;
12461244

12471245
str->di_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
@@ -1265,10 +1263,10 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
12651263
str->di_goal_data = cpu_to_be64(ip->i_goal);
12661264
str->di_generation = cpu_to_be64(ip->i_generation);
12671265

1268-
str->di_flags = cpu_to_be32(di->di_flags);
1266+
str->di_flags = cpu_to_be32(ip->i_diskflags);
12691267
str->di_height = cpu_to_be16(ip->i_height);
12701268
str->di_payload_format = cpu_to_be32(S_ISDIR(ip->i_inode.i_mode) &&
1271-
!(ip->i_di.di_flags & GFS2_DIF_EXHASH) ?
1269+
!(ip->i_diskflags & GFS2_DIF_EXHASH) ?
12721270
GFS2_FORMAT_DE : 0);
12731271
str->di_depth = cpu_to_be16(ip->i_depth);
12741272
str->di_entries = cpu_to_be32(ip->i_entries);
@@ -1281,8 +1279,6 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
12811279

12821280
void gfs2_dinode_print(const struct gfs2_inode *ip)
12831281
{
1284-
const struct gfs2_dinode_host *di = &ip->i_di;
1285-
12861282
printk(KERN_INFO " no_formal_ino = %llu\n",
12871283
(unsigned long long)ip->i_no_formal_ino);
12881284
printk(KERN_INFO " no_addr = %llu\n",
@@ -1293,7 +1289,7 @@ void gfs2_dinode_print(const struct gfs2_inode *ip)
12931289
(unsigned long long)gfs2_get_inode_blocks(&ip->i_inode));
12941290
printk(KERN_INFO " i_goal = %llu\n",
12951291
(unsigned long long)ip->i_goal);
1296-
printk(KERN_INFO " di_flags = 0x%.8X\n", di->di_flags);
1292+
printk(KERN_INFO " i_diskflags = 0x%.8X\n", ip->i_diskflags);
12971293
printk(KERN_INFO " i_height = %u\n", ip->i_height);
12981294
printk(KERN_INFO " i_depth = %u\n", ip->i_depth);
12991295
printk(KERN_INFO " i_entries = %u\n", ip->i_entries);

‎fs/gfs2/inode.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
2020

2121
static inline int gfs2_is_jdata(const struct gfs2_inode *ip)
2222
{
23-
return ip->i_di.di_flags & GFS2_DIF_JDATA;
23+
return ip->i_diskflags & GFS2_DIF_JDATA;
2424
}
2525

2626
static inline int gfs2_is_writeback(const struct gfs2_inode *ip)

‎fs/gfs2/ops_export.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb,
213213
}
214214

215215
error = -EIO;
216-
if (GFS2_I(inode)->i_di.di_flags & GFS2_DIF_SYSTEM) {
216+
if (GFS2_I(inode)->i_diskflags & GFS2_DIF_SYSTEM) {
217217
iput(inode);
218218
goto fail;
219219
}

‎fs/gfs2/ops_file.c‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
157157
if (error)
158158
return error;
159159

160-
fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags);
161-
if (!S_ISDIR(inode->i_mode) && ip->i_di.di_flags & GFS2_DIF_JDATA)
160+
fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_diskflags);
161+
if (!S_ISDIR(inode->i_mode) && ip->i_diskflags & GFS2_DIF_JDATA)
162162
fsflags |= FS_JOURNAL_DATA_FL;
163163
if (put_user(fsflags, ptr))
164164
error = -EFAULT;
@@ -171,17 +171,16 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
171171
void gfs2_set_inode_flags(struct inode *inode)
172172
{
173173
struct gfs2_inode *ip = GFS2_I(inode);
174-
struct gfs2_dinode_host *di = &ip->i_di;
175174
unsigned int flags = inode->i_flags;
176175

177176
flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
178-
if (di->di_flags & GFS2_DIF_IMMUTABLE)
177+
if (ip->i_diskflags & GFS2_DIF_IMMUTABLE)
179178
flags |= S_IMMUTABLE;
180-
if (di->di_flags & GFS2_DIF_APPENDONLY)
179+
if (ip->i_diskflags & GFS2_DIF_APPENDONLY)
181180
flags |= S_APPEND;
182-
if (di->di_flags & GFS2_DIF_NOATIME)
181+
if (ip->i_diskflags & GFS2_DIF_NOATIME)
183182
flags |= S_NOATIME;
184-
if (di->di_flags & GFS2_DIF_SYNC)
183+
if (ip->i_diskflags & GFS2_DIF_SYNC)
185184
flags |= S_SYNC;
186185
inode->i_flags = flags;
187186
}
@@ -220,7 +219,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
220219
if (error)
221220
goto out_drop_write;
222221

223-
flags = ip->i_di.di_flags;
222+
flags = ip->i_diskflags;
224223
new_flags = (flags & ~mask) | (reqflags & mask);
225224
if ((new_flags ^ flags) == 0)
226225
goto out;
@@ -259,7 +258,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
259258
if (error)
260259
goto out_trans_end;
261260
gfs2_trans_add_bh(ip->i_gl, bh, 1);
262-
ip->i_di.di_flags = new_flags;
261+
ip->i_diskflags = new_flags;
263262
gfs2_dinode_out(ip, bh->b_data);
264263
brelse(bh);
265264
gfs2_set_inode_flags(inode);

‎fs/gfs2/ops_inode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
426426

427427
ip->i_inode.i_nlink = 2;
428428
ip->i_disksize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode);
429-
ip->i_di.di_flags |= GFS2_DIF_JDATA;
429+
ip->i_diskflags |= GFS2_DIF_JDATA;
430430
ip->i_entries = 2;
431431

432432
error = gfs2_meta_inode_buffer(ip, &dibh);

0 commit comments

Comments
 (0)