From 1dd9f5babfd95fea5a77b27bab48c04c29db1f5f Mon Sep 17 00:00:00 2001 From: Russell King Date: Mon, 9 Dec 2019 11:09:20 +0000 Subject: fs/adfs: dir: add common directory buffer release method With the bhs pointer in place, we have no need for separate per-format free() methods, since a generic version will do. Provide a generic implementation, remove the format specific implementations and the method function pointer. Signed-off-by: Russell King Signed-off-by: Al Viro --- fs/adfs/dir_fplus.c | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) (limited to 'fs/adfs/dir_fplus.c') diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c index 52c42a9986d9..25308b334dd3 100644 --- a/fs/adfs/dir_fplus.c +++ b/fs/adfs/dir_fplus.c @@ -15,7 +15,7 @@ adfs_fplus_read(struct super_block *sb, unsigned int id, unsigned int sz, struct struct adfs_bigdirtail *t; unsigned long block; unsigned int blk, size; - int i, ret = -EIO; + int ret = -EIO; block = __adfs_block_map(sb, id, 0); if (!block) { @@ -92,18 +92,8 @@ adfs_fplus_read(struct super_block *sb, unsigned int id, unsigned int sz, struct return 0; out: - if (dir->bhs) { - for (i = 0; i < dir->nr_buffers; i++) - brelse(dir->bhs[i]); + adfs_dir_relse(dir); - if (&dir->bh[0] != dir->bhs) - kfree(dir->bhs); - - dir->bhs = NULL; - } - - dir->nr_buffers = 0; - dir->sb = NULL; return ret; } @@ -205,29 +195,9 @@ adfs_fplus_sync(struct adfs_dir *dir) return err; } -static void -adfs_fplus_free(struct adfs_dir *dir) -{ - int i; - - if (dir->bhs) { - for (i = 0; i < dir->nr_buffers; i++) - brelse(dir->bhs[i]); - - if (&dir->bh[0] != dir->bhs) - kfree(dir->bhs); - - dir->bhs = NULL; - } - - dir->nr_buffers = 0; - dir->sb = NULL; -} - const struct adfs_dir_ops adfs_fplus_dir_ops = { .read = adfs_fplus_read, .setpos = adfs_fplus_setpos, .getnext = adfs_fplus_getnext, .sync = adfs_fplus_sync, - .free = adfs_fplus_free }; -- cgit v1.2.3