diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2019-12-09 11:09:20 +0000 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-01-20 20:12:41 -0500 |
commit | 1dd9f5babfd95fea5a77b27bab48c04c29db1f5f (patch) | |
tree | 5d02daf81f1a83150c0a6934522b4a69d0999ca5 /fs/adfs/dir.c | |
parent | 95fbadbb5566e383f0cfe40d895e698ab38bdbc7 (diff) |
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 <rmk+kernel@armlinux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/adfs/dir.c')
-rw-r--r-- | fs/adfs/dir.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index c1b8b5bccbec..f50302775504 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c @@ -6,6 +6,7 @@ * * Common directory handling for ADFS */ +#include <linux/slab.h> #include "adfs.h" /* @@ -13,6 +14,20 @@ */ static DEFINE_RWLOCK(adfs_dir_lock); +void adfs_dir_relse(struct adfs_dir *dir) +{ + unsigned int i; + + for (i = 0; i < dir->nr_buffers; i++) + brelse(dir->bhs[i]); + dir->nr_buffers = 0; + + if (dir->bhs != dir->bh) + kfree(dir->bhs); + dir->bhs = NULL; + dir->sb = NULL; +} + static int adfs_dir_read(struct super_block *sb, u32 indaddr, unsigned int size, struct adfs_dir *dir) { @@ -105,7 +120,7 @@ unlock_out: read_unlock(&adfs_dir_lock); free_out: - ops->free(&dir); + adfs_dir_relse(&dir); return ret; } @@ -139,7 +154,7 @@ adfs_dir_update(struct super_block *sb, struct object_info *obj, int wait) ret = err; } - ops->free(&dir); + adfs_dir_relse(&dir); out: #endif return ret; @@ -211,7 +226,7 @@ unlock_out: read_unlock(&adfs_dir_lock); free_out: - ops->free(&dir); + adfs_dir_relse(&dir); out: return ret; } |