diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2014-11-20 00:18:38 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2014-11-20 05:29:14 -0500 |
commit | 3cdcf63ed2d169c82d70a506f3569e484cd9e7a0 (patch) | |
tree | b7a327562e9fe05ffccf6e616d6ef646a2dbb767 /fs/gfs2 | |
parent | 44bb31bac555b0faf2e7068f3a953d5b23883dc9 (diff) |
GFS2: use kvfree() instead of open-coding it
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2')
-rw-r--r-- | fs/gfs2/dir.c | 40 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 9 |
2 files changed, 10 insertions, 39 deletions
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 5d4261ff5d23..c247fed4a9a6 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -365,22 +365,15 @@ static __be64 *gfs2_dir_get_hash_table(struct gfs2_inode *ip) | |||
365 | 365 | ||
366 | ret = gfs2_dir_read_data(ip, hc, hsize); | 366 | ret = gfs2_dir_read_data(ip, hc, hsize); |
367 | if (ret < 0) { | 367 | if (ret < 0) { |
368 | if (is_vmalloc_addr(hc)) | 368 | kvfree(hc); |
369 | vfree(hc); | ||
370 | else | ||
371 | kfree(hc); | ||
372 | return ERR_PTR(ret); | 369 | return ERR_PTR(ret); |
373 | } | 370 | } |
374 | 371 | ||
375 | spin_lock(&inode->i_lock); | 372 | spin_lock(&inode->i_lock); |
376 | if (ip->i_hash_cache) { | 373 | if (ip->i_hash_cache) |
377 | if (is_vmalloc_addr(hc)) | 374 | kvfree(hc); |
378 | vfree(hc); | 375 | else |
379 | else | ||
380 | kfree(hc); | ||
381 | } else { | ||
382 | ip->i_hash_cache = hc; | 376 | ip->i_hash_cache = hc; |
383 | } | ||
384 | spin_unlock(&inode->i_lock); | 377 | spin_unlock(&inode->i_lock); |
385 | 378 | ||
386 | return ip->i_hash_cache; | 379 | return ip->i_hash_cache; |
@@ -396,10 +389,7 @@ void gfs2_dir_hash_inval(struct gfs2_inode *ip) | |||
396 | { | 389 | { |
397 | __be64 *hc = ip->i_hash_cache; | 390 | __be64 *hc = ip->i_hash_cache; |
398 | ip->i_hash_cache = NULL; | 391 | ip->i_hash_cache = NULL; |
399 | if (is_vmalloc_addr(hc)) | 392 | kvfree(hc); |
400 | vfree(hc); | ||
401 | else | ||
402 | kfree(hc); | ||
403 | } | 393 | } |
404 | 394 | ||
405 | static inline int gfs2_dirent_sentinel(const struct gfs2_dirent *dent) | 395 | static inline int gfs2_dirent_sentinel(const struct gfs2_dirent *dent) |
@@ -1168,10 +1158,7 @@ fail: | |||
1168 | gfs2_dinode_out(dip, dibh->b_data); | 1158 | gfs2_dinode_out(dip, dibh->b_data); |
1169 | brelse(dibh); | 1159 | brelse(dibh); |
1170 | out_kfree: | 1160 | out_kfree: |
1171 | if (is_vmalloc_addr(hc2)) | 1161 | kvfree(hc2); |
1172 | vfree(hc2); | ||
1173 | else | ||
1174 | kfree(hc2); | ||
1175 | return error; | 1162 | return error; |
1176 | } | 1163 | } |
1177 | 1164 | ||
@@ -1302,14 +1289,6 @@ static void *gfs2_alloc_sort_buffer(unsigned size) | |||
1302 | return ptr; | 1289 | return ptr; |
1303 | } | 1290 | } |
1304 | 1291 | ||
1305 | static void gfs2_free_sort_buffer(void *ptr) | ||
1306 | { | ||
1307 | if (is_vmalloc_addr(ptr)) | ||
1308 | vfree(ptr); | ||
1309 | else | ||
1310 | kfree(ptr); | ||
1311 | } | ||
1312 | |||
1313 | static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx, | 1292 | static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx, |
1314 | int *copied, unsigned *depth, | 1293 | int *copied, unsigned *depth, |
1315 | u64 leaf_no) | 1294 | u64 leaf_no) |
@@ -1393,7 +1372,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx, | |||
1393 | out_free: | 1372 | out_free: |
1394 | for(i = 0; i < leaf; i++) | 1373 | for(i = 0; i < leaf; i++) |
1395 | brelse(larr[i]); | 1374 | brelse(larr[i]); |
1396 | gfs2_free_sort_buffer(larr); | 1375 | kvfree(larr); |
1397 | out: | 1376 | out: |
1398 | return error; | 1377 | return error; |
1399 | } | 1378 | } |
@@ -2004,10 +1983,7 @@ out_rlist: | |||
2004 | gfs2_rlist_free(&rlist); | 1983 | gfs2_rlist_free(&rlist); |
2005 | gfs2_quota_unhold(dip); | 1984 | gfs2_quota_unhold(dip); |
2006 | out: | 1985 | out: |
2007 | if (is_vmalloc_addr(ht)) | 1986 | kvfree(ht); |
2008 | vfree(ht); | ||
2009 | else | ||
2010 | kfree(ht); | ||
2011 | return error; | 1987 | return error; |
2012 | } | 1988 | } |
2013 | 1989 | ||
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 64b29f7f6b4c..c8b148bbdc8b 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -1360,13 +1360,8 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp) | |||
1360 | 1360 | ||
1361 | gfs2_assert_warn(sdp, !atomic_read(&sdp->sd_quota_count)); | 1361 | gfs2_assert_warn(sdp, !atomic_read(&sdp->sd_quota_count)); |
1362 | 1362 | ||
1363 | if (sdp->sd_quota_bitmap) { | 1363 | kvfree(sdp->sd_quota_bitmap); |
1364 | if (is_vmalloc_addr(sdp->sd_quota_bitmap)) | 1364 | sdp->sd_quota_bitmap = NULL; |
1365 | vfree(sdp->sd_quota_bitmap); | ||
1366 | else | ||
1367 | kfree(sdp->sd_quota_bitmap); | ||
1368 | sdp->sd_quota_bitmap = NULL; | ||
1369 | } | ||
1370 | } | 1365 | } |
1371 | 1366 | ||
1372 | static void quotad_error(struct gfs2_sbd *sdp, const char *msg, int error) | 1367 | static void quotad_error(struct gfs2_sbd *sdp, const char *msg, int error) |