From: Julia Lawall Date: Thu, 11 Jun 2015 12:02:52 +0000 (+0200) Subject: lustre: llite: Replace uses of OBD_{ALLOC,FREE}_LARGE X-Git-Tag: firefly_0821_release~176^2~1545^2~253 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e958f49bc72c47fe9a1635bccf149964f006cbbe;p=firefly-linux-kernel-4.4.55.git lustre: llite: Replace uses of OBD_{ALLOC,FREE}_LARGE Replace uses of OBD_ALLOC_LARGE by libcfs_kvzalloc and OBD_FREE_LARGE by kvfree. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // @@ expression ptr,size; @@ - OBD_ALLOC_LARGE(ptr,size) + ptr = libcfs_kvzalloc(size, GFP_NOFS) @@ expression ptr,size; @@ - OBD_FREE_LARGE(ptr, size); + kvfree(ptr); // Signed-off-by: Julia Lawall Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 50d685b0dda0..c2eb4f2ea5b5 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1548,7 +1548,7 @@ out_req: if (rc) return rc; - OBD_ALLOC_LARGE(lmm, lmmsize); + lmm = libcfs_kvzalloc(lmmsize, GFP_NOFS); if (lmm == NULL) return -ENOMEM; if (copy_from_user(lmm, lum, lmmsize)) { @@ -1601,7 +1601,7 @@ out_req: free_lsm: obd_free_memmd(sbi->ll_dt_exp, &lsm); free_lmm: - OBD_FREE_LARGE(lmm, lmmsize); + kvfree(lmm); return rc; } case OBD_IOC_LLOG_CATINFO: { @@ -1767,13 +1767,13 @@ out_quotactl: if (totalsize >= MDS_MAXREQSIZE / 3) return -E2BIG; - OBD_ALLOC_LARGE(hur, totalsize); + hur = libcfs_kvzalloc(totalsize, GFP_NOFS); if (hur == NULL) return -ENOMEM; /* Copy the whole struct */ if (copy_from_user(hur, (void *)arg, totalsize)) { - OBD_FREE_LARGE(hur, totalsize); + kvfree(hur); return -EFAULT; } @@ -1800,7 +1800,7 @@ out_quotactl: hur, NULL); } - OBD_FREE_LARGE(hur, totalsize); + kvfree(hur); return rc; } diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 5c05f41d3575..4f9b1c796285 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1282,7 +1282,7 @@ static int ll_lov_recreate(struct inode *inode, struct ost_id *oi, u32 ost_idx) lsm_size = sizeof(*lsm) + (sizeof(struct lov_oinfo) * (lsm->lsm_stripe_count)); - OBD_ALLOC_LARGE(lsm2, lsm_size); + lsm2 = libcfs_kvzalloc(lsm_size, GFP_NOFS); if (lsm2 == NULL) { rc = -ENOMEM; goto out; @@ -1300,7 +1300,7 @@ static int ll_lov_recreate(struct inode *inode, struct ost_id *oi, u32 ost_idx) rc = obd_create(NULL, exp, oa, &lsm2, &oti); ll_inode_size_unlock(inode); - OBD_FREE_LARGE(lsm2, lsm_size); + kvfree(lsm2); goto out; out: ccc_inode_lsm_put(inode, lsm); @@ -1477,12 +1477,12 @@ static int ll_lov_setea(struct inode *inode, struct file *file, if (!capable(CFS_CAP_SYS_ADMIN)) return -EPERM; - OBD_ALLOC_LARGE(lump, lum_size); + lump = libcfs_kvzalloc(lum_size, GFP_NOFS); if (lump == NULL) return -ENOMEM; if (copy_from_user(lump, (struct lov_user_md *)arg, lum_size)) { - OBD_FREE_LARGE(lump, lum_size); + kvfree(lump); return -EFAULT; } @@ -1490,7 +1490,7 @@ static int ll_lov_setea(struct inode *inode, struct file *file, lum_size); cl_lov_delay_create_clear(&file->f_flags); - OBD_FREE_LARGE(lump, lum_size); + kvfree(lump); return rc; } @@ -1802,7 +1802,7 @@ static int ll_ioctl_fiemap(struct inode *inode, unsigned long arg) num_bytes = sizeof(*fiemap_s) + (extent_count * sizeof(struct ll_fiemap_extent)); - OBD_ALLOC_LARGE(fiemap_s, num_bytes); + fiemap_s = libcfs_kvzalloc(num_bytes, GFP_NOFS); if (fiemap_s == NULL) return -ENOMEM; @@ -1839,7 +1839,7 @@ static int ll_ioctl_fiemap(struct inode *inode, unsigned long arg) rc = -EFAULT; error: - OBD_FREE_LARGE(fiemap_s, num_bytes); + kvfree(fiemap_s); return rc; } @@ -3055,7 +3055,7 @@ static int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, num_bytes = sizeof(*fiemap) + (extent_count * sizeof(struct ll_fiemap_extent)); - OBD_ALLOC_LARGE(fiemap, num_bytes); + fiemap = libcfs_kvzalloc(num_bytes, GFP_NOFS); if (fiemap == NULL) return -ENOMEM; @@ -3077,7 +3077,7 @@ static int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, fiemap->fm_mapped_extents * sizeof(struct ll_fiemap_extent)); - OBD_FREE_LARGE(fiemap, num_bytes); + kvfree(fiemap); return rc; } @@ -3366,7 +3366,7 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock) goto out; } - OBD_ALLOC_LARGE(lvbdata, lmmsize); + lvbdata = libcfs_kvzalloc(lmmsize, GFP_NOFS); if (lvbdata == NULL) { rc = -ENOMEM; goto out; @@ -3375,7 +3375,7 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock) memcpy(lvbdata, lmm, lmmsize); lock_res_and_lock(lock); if (lock->l_lvb_data != NULL) - OBD_FREE_LARGE(lock->l_lvb_data, lock->l_lvb_len); + kvfree(lock->l_lvb_data); lock->l_lvb_data = lvbdata; lock->l_lvb_len = lmmsize; diff --git a/drivers/staging/lustre/lustre/llite/rw26.c b/drivers/staging/lustre/lustre/llite/rw26.c index 7c643130499f..b17b7cea582c 100644 --- a/drivers/staging/lustre/lustre/llite/rw26.c +++ b/drivers/staging/lustre/lustre/llite/rw26.c @@ -200,12 +200,12 @@ static inline int ll_get_user_pages(int rw, unsigned long user_addr, *max_pages = (user_addr + size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; *max_pages -= user_addr >> PAGE_CACHE_SHIFT; - OBD_ALLOC_LARGE(*pages, *max_pages * sizeof(**pages)); + *pages = libcfs_kvzalloc(*max_pages * sizeof(**pages), GFP_NOFS); if (*pages) { result = get_user_pages_fast(user_addr, *max_pages, (rw == READ), *pages); if (unlikely(result <= 0)) - OBD_FREE_LARGE(*pages, *max_pages * sizeof(**pages)); + kvfree(*pages); } return result;