diff options
author | Kari Argillander <kari.argillander@gmail.com> | 2021-08-24 21:37:07 +0300 |
---|---|---|
committer | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2021-08-27 17:05:12 +0300 |
commit | 195c52bdd5d5ecfdabf5a7c6159efe299e534f84 (patch) | |
tree | 19b4150df32241152b7b8233aa7099e1e7a794c5 /fs/ntfs3/ntfs_fs.h | |
parent | fa3cacf544636b2dc48cfb2f277a2071f14d66a2 (diff) | |
download | lwn-195c52bdd5d5ecfdabf5a7c6159efe299e534f84.tar.gz lwn-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/ntfs_fs.h')
-rw-r--r-- | fs/ntfs3/ntfs_fs.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index d4dd19b822bc..e3a667e9838f 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -603,13 +603,13 @@ int indx_used_bit(struct ntfs_index *indx, struct ntfs_inode *ni, size_t *bit); void fnd_clear(struct ntfs_fnd *fnd); static inline struct ntfs_fnd *fnd_get(void) { - return ntfs_zalloc(sizeof(struct ntfs_fnd)); + return kzalloc(sizeof(struct ntfs_fnd), GFP_NOFS); } static inline void fnd_put(struct ntfs_fnd *fnd) { if (fnd) { fnd_clear(fnd); - ntfs_free(fnd); + kfree(fnd); } } void indx_clear(struct ntfs_index *idx); @@ -875,20 +875,20 @@ static inline void run_init(struct runs_tree *run) static inline struct runs_tree *run_alloc(void) { - return ntfs_zalloc(sizeof(struct runs_tree)); + return kzalloc(sizeof(struct runs_tree), GFP_NOFS); } static inline void run_close(struct runs_tree *run) { - ntfs_vfree(run->runs); + kvfree(run->runs); memset(run, 0, sizeof(*run)); } static inline void run_free(struct runs_tree *run) { if (run) { - ntfs_vfree(run->runs); - ntfs_free(run); + kvfree(run->runs); + kfree(run); } } @@ -1044,15 +1044,15 @@ static inline void put_indx_node(struct indx_node *in) if (!in) return; - ntfs_free(in->index); + kfree(in->index); nb_put(&in->nb); - ntfs_free(in); + kfree(in); } static inline void mi_clear(struct mft_inode *mi) { nb_put(&mi->nb); - ntfs_free(mi->mrec); + kfree(mi->mrec); mi->mrec = NULL; } |