diff options
author | Kari Argillander <kari.argillander@gmail.com> | 2021-08-24 20:37:07 +0200 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2021-08-27 16:05:12 +0200 |
commit | 195c52bdd5d5ecfdabf5a7c6159efe299e534f84 (patch) | |
tree | 19b4150df32241152b7b8233aa7099e1e7a794c5 /fs/ntfs3/record.c | |
parent | fs/ntfs3: Use kernel ALIGN macros over driver specific (diff) | |
download | linux-195c52bdd5d5ecfdabf5a7c6159efe299e534f84.tar.xz linux-195c52bdd5d5ecfdabf5a7c6159efe299e534f84.zip |
fs/ntfs3: Do not use driver own alloc wrappers
Problem with these wrapper is that we cannot take off example GFP_NOFS
flag. It is not recomended use those in all places. Also if we change
one driver specific wrapper to kernel wrapper then it would look really
weird. People should be most familiar with kernel wrappers so let's just
use those ones.
Driver specific alloc wrapper also confuse some static analyzing tools,
good example is example kernels checkpatch tool. After we converter
these to kernel specific then warnings is showed.
Following Coccinelle script was used to automate changing.
virtual patch
@alloc depends on patch@
expression x;
expression y;
@@
(
- ntfs_malloc(x)
+ kmalloc(x, GFP_NOFS)
|
- ntfs_zalloc(x)
+ kzalloc(x, GFP_NOFS)
|
- ntfs_vmalloc(x)
+ kvmalloc(x, GFP_NOFS)
|
- ntfs_free(x)
+ kfree(x)
|
- ntfs_vfree(x)
+ kvfree(x)
|
- ntfs_memdup(x, y)
+ kmemdup(x, y, GFP_NOFS)
)
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Diffstat (limited to 'fs/ntfs3/record.c')
-rw-r--r-- | fs/ntfs3/record.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c index 721c14f83e2b..dec83ac815c7 100644 --- a/fs/ntfs3/record.c +++ b/fs/ntfs3/record.c @@ -76,14 +76,14 @@ static __le16 mi_new_attt_id(struct mft_inode *mi) int mi_get(struct ntfs_sb_info *sbi, CLST rno, struct mft_inode **mi) { int err; - struct mft_inode *m = ntfs_zalloc(sizeof(struct mft_inode)); + struct mft_inode *m = kzalloc(sizeof(struct mft_inode), GFP_NOFS); if (!m) return -ENOMEM; err = mi_init(m, sbi, rno); if (err) { - ntfs_free(m); + kfree(m); return err; } @@ -100,14 +100,14 @@ int mi_get(struct ntfs_sb_info *sbi, CLST rno, struct mft_inode **mi) void mi_put(struct mft_inode *mi) { mi_clear(mi); - ntfs_free(mi); + kfree(mi); } int mi_init(struct mft_inode *mi, struct ntfs_sb_info *sbi, CLST rno) { mi->sbi = sbi; mi->rno = rno; - mi->mrec = ntfs_malloc(sbi->record_size); + mi->mrec = kmalloc(sbi->record_size, GFP_NOFS); if (!mi->mrec) return -ENOMEM; |