Skip to content

Commit 2aec7c5

Browse files
Andreas GruenbacherAl Viro
authored andcommitted
mbcache: Remove unused features
The mbcache code was written to support a variable number of indexes, but all the existing users use exactly one index. Simplify to code to support only that case. There are also no users of the cache entry free operation, and none of the users keep extra data in cache entries. Remove those features as well. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 365b181 commit 2aec7c5

5 files changed

Lines changed: 60 additions & 137 deletions

File tree

‎fs/ext2/xattr.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ ext2_xattr_cache_insert(struct buffer_head *bh)
843843
ce = mb_cache_entry_alloc(ext2_xattr_cache, GFP_NOFS);
844844
if (!ce)
845845
return -ENOMEM;
846-
error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, &hash);
846+
error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, hash);
847847
if (error) {
848848
mb_cache_entry_free(ce);
849849
if (error == -EBUSY) {
@@ -917,8 +917,8 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
917917
return NULL; /* never share */
918918
ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
919919
again:
920-
ce = mb_cache_entry_find_first(ext2_xattr_cache, 0,
921-
inode->i_sb->s_bdev, hash);
920+
ce = mb_cache_entry_find_first(ext2_xattr_cache, inode->i_sb->s_bdev,
921+
hash);
922922
while (ce) {
923923
struct buffer_head *bh;
924924

@@ -950,7 +950,7 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header)
950950
unlock_buffer(bh);
951951
brelse(bh);
952952
}
953-
ce = mb_cache_entry_find_next(ce, 0, inode->i_sb->s_bdev, hash);
953+
ce = mb_cache_entry_find_next(ce, inode->i_sb->s_bdev, hash);
954954
}
955955
return NULL;
956956
}
@@ -1026,9 +1026,7 @@ static void ext2_xattr_rehash(struct ext2_xattr_header *header,
10261026
int __init
10271027
init_ext2_xattr(void)
10281028
{
1029-
ext2_xattr_cache = mb_cache_create("ext2_xattr", NULL,
1030-
sizeof(struct mb_cache_entry) +
1031-
sizeof(((struct mb_cache_entry *) 0)->e_indexes[0]), 1, 6);
1029+
ext2_xattr_cache = mb_cache_create("ext2_xattr", 6);
10321030
if (!ext2_xattr_cache)
10331031
return -ENOMEM;
10341032
return 0;

‎fs/ext3/xattr.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ ext3_xattr_cache_insert(struct buffer_head *bh)
11391139
ea_bdebug(bh, "out of memory");
11401140
return;
11411141
}
1142-
error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, &hash);
1142+
error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, hash);
11431143
if (error) {
11441144
mb_cache_entry_free(ce);
11451145
if (error == -EBUSY) {
@@ -1211,8 +1211,8 @@ ext3_xattr_cache_find(struct inode *inode, struct ext3_xattr_header *header,
12111211
return NULL; /* never share */
12121212
ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
12131213
again:
1214-
ce = mb_cache_entry_find_first(ext3_xattr_cache, 0,
1215-
inode->i_sb->s_bdev, hash);
1214+
ce = mb_cache_entry_find_first(ext3_xattr_cache, inode->i_sb->s_bdev,
1215+
hash);
12161216
while (ce) {
12171217
struct buffer_head *bh;
12181218

@@ -1237,7 +1237,7 @@ ext3_xattr_cache_find(struct inode *inode, struct ext3_xattr_header *header,
12371237
return bh;
12381238
}
12391239
brelse(bh);
1240-
ce = mb_cache_entry_find_next(ce, 0, inode->i_sb->s_bdev, hash);
1240+
ce = mb_cache_entry_find_next(ce, inode->i_sb->s_bdev, hash);
12411241
}
12421242
return NULL;
12431243
}
@@ -1313,9 +1313,7 @@ static void ext3_xattr_rehash(struct ext3_xattr_header *header,
13131313
int __init
13141314
init_ext3_xattr(void)
13151315
{
1316-
ext3_xattr_cache = mb_cache_create("ext3_xattr", NULL,
1317-
sizeof(struct mb_cache_entry) +
1318-
sizeof(((struct mb_cache_entry *) 0)->e_indexes[0]), 1, 6);
1316+
ext3_xattr_cache = mb_cache_create("ext3_xattr", 6);
13191317
if (!ext3_xattr_cache)
13201318
return -ENOMEM;
13211319
return 0;

‎fs/ext4/xattr.c‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ ext4_xattr_cache_insert(struct buffer_head *bh)
14181418
ea_bdebug(bh, "out of memory");
14191419
return;
14201420
}
1421-
error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, &hash);
1421+
error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, hash);
14221422
if (error) {
14231423
mb_cache_entry_free(ce);
14241424
if (error == -EBUSY) {
@@ -1490,8 +1490,8 @@ ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
14901490
return NULL; /* never share */
14911491
ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
14921492
again:
1493-
ce = mb_cache_entry_find_first(ext4_xattr_cache, 0,
1494-
inode->i_sb->s_bdev, hash);
1493+
ce = mb_cache_entry_find_first(ext4_xattr_cache, inode->i_sb->s_bdev,
1494+
hash);
14951495
while (ce) {
14961496
struct buffer_head *bh;
14971497

@@ -1515,7 +1515,7 @@ ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
15151515
return bh;
15161516
}
15171517
brelse(bh);
1518-
ce = mb_cache_entry_find_next(ce, 0, inode->i_sb->s_bdev, hash);
1518+
ce = mb_cache_entry_find_next(ce, inode->i_sb->s_bdev, hash);
15191519
}
15201520
return NULL;
15211521
}
@@ -1591,9 +1591,7 @@ static void ext4_xattr_rehash(struct ext4_xattr_header *header,
15911591
int __init
15921592
init_ext4_xattr(void)
15931593
{
1594-
ext4_xattr_cache = mb_cache_create("ext4_xattr", NULL,
1595-
sizeof(struct mb_cache_entry) +
1596-
sizeof(((struct mb_cache_entry *) 0)->e_indexes[0]), 1, 6);
1594+
ext4_xattr_cache = mb_cache_create("ext4_xattr", 6);
15971595
if (!ext4_xattr_cache)
15981596
return -ENOMEM;
15991597
return 0;

0 commit comments

Comments
 (0)