Skip to content

Commit c0b3443

Browse files
mslusarzLinus Torvalds
authored andcommitted
udf: remove UDF_I_* macros and open code them
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Acked-by: Jan Kara <jack@suse.cz> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5e0f001 commit c0b3443

14 files changed

Lines changed: 315 additions & 314 deletions

File tree

‎fs/udf/balloc.c‎

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ static void udf_table_free_blocks(struct super_block *sb,
460460

461461
epos.offset = oepos.offset = sizeof(struct unallocSpaceEntry);
462462
elen = 0;
463-
epos.block = oepos.block = UDF_I_LOCATION(table);
463+
epos.block = oepos.block = UDF_I(table)->i_location;
464464
epos.bh = oepos.bh = NULL;
465465

466466
while (count &&
@@ -539,9 +539,9 @@ static void udf_table_free_blocks(struct super_block *sb,
539539
elen = EXT_RECORDED_ALLOCATED |
540540
(count << sb->s_blocksize_bits);
541541

542-
if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT) {
542+
if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_SHORT) {
543543
adsize = sizeof(short_ad);
544-
} else if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_LONG) {
544+
} else if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_LONG) {
545545
adsize = sizeof(long_ad);
546546
} else {
547547
brelse(oepos.bh);
@@ -573,7 +573,8 @@ static void udf_table_free_blocks(struct super_block *sb,
573573
if (epos.offset + adsize > sb->s_blocksize) {
574574
loffset = epos.offset;
575575
aed->lengthAllocDescs = cpu_to_le32(adsize);
576-
sptr = UDF_I_DATA(table) + epos.offset - adsize;
576+
sptr = UDF_I(table)->i_ext.i_data + epos.offset
577+
- adsize;
577578
dptr = epos.bh->b_data +
578579
sizeof(struct allocExtDesc);
579580
memcpy(dptr, sptr, adsize);
@@ -591,8 +592,9 @@ static void udf_table_free_blocks(struct super_block *sb,
591592
aed->lengthAllocDescs) +
592593
adsize);
593594
} else {
594-
sptr = UDF_I_DATA(table) + epos.offset;
595-
UDF_I_LENALLOC(table) += adsize;
595+
sptr = UDF_I(table)->i_ext.i_data +
596+
epos.offset;
597+
UDF_I(table)->i_lenAlloc += adsize;
596598
mark_inode_dirty(table);
597599
}
598600
epos.offset = sizeof(struct allocExtDesc);
@@ -606,7 +608,7 @@ static void udf_table_free_blocks(struct super_block *sb,
606608
2, 1, epos.block.logicalBlockNum,
607609
sizeof(tag));
608610

609-
switch (UDF_I_ALLOCTYPE(table)) {
611+
switch (UDF_I(table)->i_alloc_type) {
610612
case ICBTAG_FLAG_AD_SHORT:
611613
sad = (short_ad *)sptr;
612614
sad->extLength = cpu_to_le32(
@@ -637,7 +639,7 @@ static void udf_table_free_blocks(struct super_block *sb,
637639
udf_write_aext(table, &epos, eloc, elen, 1);
638640

639641
if (!epos.bh) {
640-
UDF_I_LENALLOC(table) += adsize;
642+
UDF_I(table)->i_lenAlloc += adsize;
641643
mark_inode_dirty(table);
642644
} else {
643645
aed = (struct allocExtDesc *)epos.bh->b_data;
@@ -675,16 +677,16 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
675677
first_block >= sbi->s_partmaps[partition].s_partition_len)
676678
return 0;
677679

678-
if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT)
680+
if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
679681
adsize = sizeof(short_ad);
680-
else if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_LONG)
682+
else if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_LONG)
681683
adsize = sizeof(long_ad);
682684
else
683685
return 0;
684686

685687
mutex_lock(&sbi->s_alloc_mutex);
686688
epos.offset = sizeof(struct unallocSpaceEntry);
687-
epos.block = UDF_I_LOCATION(table);
689+
epos.block = UDF_I(table)->i_location;
688690
epos.bh = NULL;
689691
eloc.logicalBlockNum = 0xFFFFFFFF;
690692

@@ -740,9 +742,9 @@ static int udf_table_new_block(struct super_block *sb,
740742

741743
*err = -ENOSPC;
742744

743-
if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_SHORT)
745+
if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
744746
adsize = sizeof(short_ad);
745-
else if (UDF_I_ALLOCTYPE(table) == ICBTAG_FLAG_AD_LONG)
747+
else if (UDF_I(table)->i_alloc_type == ICBTAG_FLAG_AD_LONG)
746748
adsize = sizeof(long_ad);
747749
else
748750
return newblock;
@@ -757,7 +759,7 @@ static int udf_table_new_block(struct super_block *sb,
757759
of the current closest match and use that when we are done.
758760
*/
759761
epos.offset = sizeof(struct unallocSpaceEntry);
760-
epos.block = UDF_I_LOCATION(table);
762+
epos.block = UDF_I(table)->i_location;
761763
epos.bh = goal_epos.bh = NULL;
762764

763765
while (spread &&

‎fs/udf/dir.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,16 @@ do_udf_readdir(struct inode *dir, struct file *filp, filldir_t filldir,
125125
nf_pos = (udf_ext0_offset(dir) >> 2);
126126

127127
fibh.soffset = fibh.eoffset = (nf_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
128-
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) {
128+
if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
129129
fibh.sbh = fibh.ebh = NULL;
130130
} else if (inode_bmap(dir, nf_pos >> (dir->i_sb->s_blocksize_bits - 2),
131131
&epos, &eloc, &elen, &offset) == (EXT_RECORDED_ALLOCATED >> 30)) {
132132
block = udf_get_lb_pblock(dir->i_sb, eloc, offset);
133133
if ((++offset << dir->i_sb->s_blocksize_bits) < elen) {
134-
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_SHORT)
134+
if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_SHORT)
135135
epos.offset -= sizeof(short_ad);
136-
else if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_LONG)
136+
else if (UDF_I(dir)->i_alloc_type ==
137+
ICBTAG_FLAG_AD_LONG)
137138
epos.offset -= sizeof(long_ad);
138139
} else {
139140
offset = 0;

‎fs/udf/directory.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
8484

8585
fibh->soffset = fibh->eoffset;
8686

87-
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB) {
88-
fi = udf_get_fileident(UDF_I_DATA(dir) -
89-
(UDF_I_EFE(dir) ?
87+
if (UDF_I(dir)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
88+
fi = udf_get_fileident(UDF_I(dir)->i_ext.i_data -
89+
(UDF_I(dir)->i_efe ?
9090
sizeof(struct extendedFileEntry) :
9191
sizeof(struct fileEntry)),
9292
dir->i_sb->s_blocksize,

‎fs/udf/file.c‎

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ static int udf_adinicb_readpage(struct file *file, struct page *page)
5050

5151
kaddr = kmap(page);
5252
memset(kaddr, 0, PAGE_CACHE_SIZE);
53-
memcpy(kaddr, UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), inode->i_size);
53+
memcpy(kaddr, UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr,
54+
inode->i_size);
5455
flush_dcache_page(page);
5556
SetPageUptodate(page);
5657
kunmap(page);
@@ -68,7 +69,8 @@ static int udf_adinicb_writepage(struct page *page,
6869
BUG_ON(!PageLocked(page));
6970

7071
kaddr = kmap(page);
71-
memcpy(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode), kaddr, inode->i_size);
72+
memcpy(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr, kaddr,
73+
inode->i_size);
7274
mark_inode_dirty(inode);
7375
SetPageUptodate(page);
7476
kunmap(page);
@@ -87,7 +89,7 @@ static int udf_adinicb_write_end(struct file *file,
8789
char *kaddr;
8890

8991
kaddr = kmap_atomic(page, KM_USER0);
90-
memcpy(UDF_I_DATA(inode) + UDF_I_LENEATTR(inode) + offset,
92+
memcpy(UDF_I(inode)->i_ext.i_data + UDF_I(inode)->i_lenEAttr + offset,
9193
kaddr + offset, copied);
9294
kunmap_atomic(kaddr, KM_USER0);
9395

@@ -111,7 +113,7 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
111113
int err, pos;
112114
size_t count = iocb->ki_left;
113115

114-
if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) {
116+
if (UDF_I(inode)->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
115117
if (file->f_flags & O_APPEND)
116118
pos = inode->i_size;
117119
else
@@ -121,15 +123,16 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
121123
(udf_file_entry_alloc_offset(inode) +
122124
pos + count)) {
123125
udf_expand_file_adinicb(inode, pos + count, &err);
124-
if (UDF_I_ALLOCTYPE(inode) == ICBTAG_FLAG_AD_IN_ICB) {
126+
if (UDF_I(inode)->i_alloc_type ==
127+
ICBTAG_FLAG_AD_IN_ICB) {
125128
udf_debug("udf_expand_adinicb: err=%d\n", err);
126129
return err;
127130
}
128131
} else {
129132
if (pos + count > inode->i_size)
130-
UDF_I_LENALLOC(inode) = pos + count;
133+
UDF_I(inode)->i_lenAlloc = pos + count;
131134
else
132-
UDF_I_LENALLOC(inode) = inode->i_size;
135+
UDF_I(inode)->i_lenAlloc = inode->i_size;
133136
}
134137
}
135138

@@ -209,11 +212,12 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
209212
result = put_user(new_block, (long __user *)arg);
210213
return result;
211214
case UDF_GETEASIZE:
212-
result = put_user(UDF_I_LENEATTR(inode), (int __user *)arg);
215+
result = put_user(UDF_I(inode)->i_lenEAttr, (int __user *)arg);
213216
break;
214217
case UDF_GETEABLOCK:
215-
result = copy_to_user((char __user *)arg, UDF_I_DATA(inode),
216-
UDF_I_LENEATTR(inode)) ? -EFAULT : 0;
218+
result = copy_to_user((char __user *)arg,
219+
UDF_I(inode)->i_ext.i_data,
220+
UDF_I(inode)->i_lenEAttr) ? -EFAULT : 0;
217221
break;
218222
}
219223

‎fs/udf/ialloc.c‎

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void udf_free_inode(struct inode *inode)
5757
}
5858
mutex_unlock(&sbi->s_alloc_mutex);
5959

60-
udf_free_blocks(sb, NULL, UDF_I_LOCATION(inode), 0, 1);
60+
udf_free_blocks(sb, NULL, UDF_I(inode)->i_location, 0, 1);
6161
}
6262

6363
struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
@@ -66,7 +66,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
6666
struct udf_sb_info *sbi = UDF_SB(sb);
6767
struct inode *inode;
6868
int block;
69-
uint32_t start = UDF_I_LOCATION(dir).logicalBlockNum;
69+
uint32_t start = UDF_I(dir)->i_location.logicalBlockNum;
7070

7171
inode = new_inode(sb);
7272

@@ -76,14 +76,14 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
7676
}
7777
*err = -ENOSPC;
7878

79-
UDF_I_UNIQUE(inode) = 0;
80-
UDF_I_LENEXTENTS(inode) = 0;
81-
UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;
82-
UDF_I_NEXT_ALLOC_GOAL(inode) = 0;
83-
UDF_I_STRAT4096(inode) = 0;
79+
UDF_I(inode)->i_unique = 0;
80+
UDF_I(inode)->i_lenExtents = 0;
81+
UDF_I(inode)->i_next_alloc_block = 0;
82+
UDF_I(inode)->i_next_alloc_goal = 0;
83+
UDF_I(inode)->i_strat4096 = 0;
8484

8585
block = udf_new_block(dir->i_sb, NULL,
86-
UDF_I_LOCATION(dir).partitionReferenceNum,
86+
UDF_I(dir)->i_location.partitionReferenceNum,
8787
start, err);
8888
if (*err) {
8989
iput(inode);
@@ -107,7 +107,7 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
107107
else
108108
lvidiu->numFiles =
109109
cpu_to_le32(le32_to_cpu(lvidiu->numFiles) + 1);
110-
UDF_I_UNIQUE(inode) = uniqueID = le64_to_cpu(lvhd->uniqueID);
110+
UDF_I(inode)->i_unique = uniqueID = le64_to_cpu(lvhd->uniqueID);
111111
if (!(++uniqueID & 0x00000000FFFFFFFFUL))
112112
uniqueID += 16;
113113
lvhd->uniqueID = cpu_to_le64(uniqueID);
@@ -123,41 +123,41 @@ struct inode *udf_new_inode(struct inode *dir, int mode, int *err)
123123
inode->i_gid = current->fsgid;
124124
}
125125

126-
UDF_I_LOCATION(inode).logicalBlockNum = block;
127-
UDF_I_LOCATION(inode).partitionReferenceNum =
128-
UDF_I_LOCATION(dir).partitionReferenceNum;
129-
inode->i_ino = udf_get_lb_pblock(sb, UDF_I_LOCATION(inode), 0);
126+
UDF_I(inode)->i_location.logicalBlockNum = block;
127+
UDF_I(inode)->i_location.partitionReferenceNum =
128+
UDF_I(dir)->i_location.partitionReferenceNum;
129+
inode->i_ino = udf_get_lb_pblock(sb, UDF_I(inode)->i_location, 0);
130130
inode->i_blocks = 0;
131-
UDF_I_LENEATTR(inode) = 0;
132-
UDF_I_LENALLOC(inode) = 0;
133-
UDF_I_USE(inode) = 0;
131+
UDF_I(inode)->i_lenEAttr = 0;
132+
UDF_I(inode)->i_lenAlloc = 0;
133+
UDF_I(inode)->i_use = 0;
134134
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) {
135-
UDF_I_EFE(inode) = 1;
135+
UDF_I(inode)->i_efe = 1;
136136
if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev)
137137
sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE;
138-
UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize -
138+
UDF_I(inode)->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
139139
sizeof(struct extendedFileEntry),
140140
GFP_KERNEL);
141141
} else {
142-
UDF_I_EFE(inode) = 0;
143-
UDF_I_DATA(inode) = kzalloc(inode->i_sb->s_blocksize -
142+
UDF_I(inode)->i_efe = 0;
143+
UDF_I(inode)->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
144144
sizeof(struct fileEntry),
145145
GFP_KERNEL);
146146
}
147-
if (!UDF_I_DATA(inode)) {
147+
if (!UDF_I(inode)->i_ext.i_data) {
148148
iput(inode);
149149
*err = -ENOMEM;
150150
mutex_unlock(&sbi->s_alloc_mutex);
151151
return NULL;
152152
}
153153
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
154-
UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_IN_ICB;
154+
UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
155155
else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
156-
UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_SHORT;
156+
UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_SHORT;
157157
else
158-
UDF_I_ALLOCTYPE(inode) = ICBTAG_FLAG_AD_LONG;
158+
UDF_I(inode)->i_alloc_type = ICBTAG_FLAG_AD_LONG;
159159
inode->i_mtime = inode->i_atime = inode->i_ctime =
160-
UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb);
160+
UDF_I(inode)->i_crtime = current_fs_time(inode->i_sb);
161161
insert_inode_hash(inode);
162162
mark_inode_dirty(inode);
163163
mutex_unlock(&sbi->s_alloc_mutex);

0 commit comments

Comments
 (0)