|
@@ -84,7 +84,7 @@ int lustre_process_log(struct super_block *sb, char *logname,
|
|
|
LASSERT(mgc);
|
|
|
LASSERT(cfg);
|
|
|
|
|
|
- OBD_ALLOC_PTR(bufs);
|
|
|
+ bufs = kzalloc(sizeof(*bufs), GFP_NOFS);
|
|
|
if (bufs == NULL)
|
|
|
return -ENOMEM;
|
|
|
|
|
@@ -97,7 +97,7 @@ int lustre_process_log(struct super_block *sb, char *logname,
|
|
|
rc = obd_process_config(mgc, sizeof(*lcfg), lcfg);
|
|
|
lustre_cfg_free(lcfg);
|
|
|
|
|
|
- OBD_FREE_PTR(bufs);
|
|
|
+ kfree(bufs);
|
|
|
|
|
|
if (rc == -EINVAL)
|
|
|
LCONSOLE_ERROR_MSG(0x15b, "%s: The configuration from log '%s' failed from the MGS (%d). Make sure this client and the MGS are running compatible versions of Lustre.\n",
|
|
@@ -247,8 +247,8 @@ int lustre_start_mgc(struct super_block *sb)
|
|
|
mutex_lock(&mgc_start_lock);
|
|
|
|
|
|
len = strlen(LUSTRE_MGC_OBDNAME) + strlen(libcfs_nid2str(nid)) + 1;
|
|
|
- OBD_ALLOC(mgcname, len);
|
|
|
- OBD_ALLOC(niduuid, len + 2);
|
|
|
+ mgcname = kzalloc(len, GFP_NOFS);
|
|
|
+ niduuid = kzalloc(len + 2, GFP_NOFS);
|
|
|
if (!mgcname || !niduuid) {
|
|
|
rc = -ENOMEM;
|
|
|
goto out_free;
|
|
@@ -257,7 +257,7 @@ int lustre_start_mgc(struct super_block *sb)
|
|
|
|
|
|
mgssec = lsi->lsi_lmd->lmd_mgssec ? lsi->lsi_lmd->lmd_mgssec : "";
|
|
|
|
|
|
- OBD_ALLOC_PTR(data);
|
|
|
+ data = kzalloc(sizeof(*data), GFP_NOFS);
|
|
|
if (data == NULL) {
|
|
|
rc = -ENOMEM;
|
|
|
goto out_free;
|
|
@@ -375,7 +375,7 @@ int lustre_start_mgc(struct super_block *sb)
|
|
|
lsi->lsi_lmd->lmd_mgs_failnodes = 1;
|
|
|
|
|
|
/* Random uuid for MGC allows easier reconnects */
|
|
|
- OBD_ALLOC_PTR(uuid);
|
|
|
+ uuid = kzalloc(sizeof(*uuid), GFP_NOFS);
|
|
|
if (!uuid) {
|
|
|
rc = -ENOMEM;
|
|
|
goto out_free;
|
|
@@ -388,7 +388,7 @@ int lustre_start_mgc(struct super_block *sb)
|
|
|
rc = lustre_start_simple(mgcname, LUSTRE_MGC_NAME,
|
|
|
(char *)uuid->uuid, LUSTRE_MGS_OBDNAME,
|
|
|
niduuid, NULL, NULL);
|
|
|
- OBD_FREE_PTR(uuid);
|
|
|
+ kfree(uuid);
|
|
|
if (rc)
|
|
|
goto out_free;
|
|
|
|
|
@@ -465,11 +465,11 @@ out_free:
|
|
|
mutex_unlock(&mgc_start_lock);
|
|
|
|
|
|
if (data)
|
|
|
- OBD_FREE_PTR(data);
|
|
|
+ kfree(data);
|
|
|
if (mgcname)
|
|
|
- OBD_FREE(mgcname, len);
|
|
|
+ kfree(mgcname);
|
|
|
if (niduuid)
|
|
|
- OBD_FREE(niduuid, len + 2);
|
|
|
+ kfree(niduuid);
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
@@ -513,7 +513,7 @@ static int lustre_stop_mgc(struct super_block *sb)
|
|
|
/* Save the obdname for cleaning the nid uuids, which are
|
|
|
obdname_XX */
|
|
|
len = strlen(obd->obd_name) + 6;
|
|
|
- OBD_ALLOC(niduuid, len);
|
|
|
+ niduuid = kzalloc(len, GFP_NOFS);
|
|
|
if (niduuid) {
|
|
|
strcpy(niduuid, obd->obd_name);
|
|
|
ptr = niduuid + strlen(niduuid);
|
|
@@ -539,7 +539,7 @@ static int lustre_stop_mgc(struct super_block *sb)
|
|
|
}
|
|
|
out:
|
|
|
if (niduuid)
|
|
|
- OBD_FREE(niduuid, len);
|
|
|
+ kfree(niduuid);
|
|
|
|
|
|
/* class_import_put will get rid of the additional connections */
|
|
|
mutex_unlock(&mgc_start_lock);
|
|
@@ -552,12 +552,12 @@ struct lustre_sb_info *lustre_init_lsi(struct super_block *sb)
|
|
|
{
|
|
|
struct lustre_sb_info *lsi;
|
|
|
|
|
|
- OBD_ALLOC_PTR(lsi);
|
|
|
+ lsi = kzalloc(sizeof(*lsi), GFP_NOFS);
|
|
|
if (!lsi)
|
|
|
return NULL;
|
|
|
- OBD_ALLOC_PTR(lsi->lsi_lmd);
|
|
|
+ lsi->lsi_lmd = kzalloc(sizeof(*lsi->lsi_lmd), GFP_NOFS);
|
|
|
if (!lsi->lsi_lmd) {
|
|
|
- OBD_FREE_PTR(lsi);
|
|
|
+ kfree(lsi);
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
@@ -586,35 +586,27 @@ static int lustre_free_lsi(struct super_block *sb)
|
|
|
|
|
|
if (lsi->lsi_lmd != NULL) {
|
|
|
if (lsi->lsi_lmd->lmd_dev != NULL)
|
|
|
- OBD_FREE(lsi->lsi_lmd->lmd_dev,
|
|
|
- strlen(lsi->lsi_lmd->lmd_dev) + 1);
|
|
|
+ kfree(lsi->lsi_lmd->lmd_dev);
|
|
|
if (lsi->lsi_lmd->lmd_profile != NULL)
|
|
|
- OBD_FREE(lsi->lsi_lmd->lmd_profile,
|
|
|
- strlen(lsi->lsi_lmd->lmd_profile) + 1);
|
|
|
+ kfree(lsi->lsi_lmd->lmd_profile);
|
|
|
if (lsi->lsi_lmd->lmd_mgssec != NULL)
|
|
|
- OBD_FREE(lsi->lsi_lmd->lmd_mgssec,
|
|
|
- strlen(lsi->lsi_lmd->lmd_mgssec) + 1);
|
|
|
+ kfree(lsi->lsi_lmd->lmd_mgssec);
|
|
|
if (lsi->lsi_lmd->lmd_opts != NULL)
|
|
|
- OBD_FREE(lsi->lsi_lmd->lmd_opts,
|
|
|
- strlen(lsi->lsi_lmd->lmd_opts) + 1);
|
|
|
+ kfree(lsi->lsi_lmd->lmd_opts);
|
|
|
if (lsi->lsi_lmd->lmd_exclude_count)
|
|
|
- OBD_FREE(lsi->lsi_lmd->lmd_exclude,
|
|
|
- sizeof(lsi->lsi_lmd->lmd_exclude[0]) *
|
|
|
- lsi->lsi_lmd->lmd_exclude_count);
|
|
|
+ kfree(lsi->lsi_lmd->lmd_exclude);
|
|
|
if (lsi->lsi_lmd->lmd_mgs != NULL)
|
|
|
- OBD_FREE(lsi->lsi_lmd->lmd_mgs,
|
|
|
- strlen(lsi->lsi_lmd->lmd_mgs) + 1);
|
|
|
+ kfree(lsi->lsi_lmd->lmd_mgs);
|
|
|
if (lsi->lsi_lmd->lmd_osd_type != NULL)
|
|
|
- OBD_FREE(lsi->lsi_lmd->lmd_osd_type,
|
|
|
- strlen(lsi->lsi_lmd->lmd_osd_type) + 1);
|
|
|
+ kfree(lsi->lsi_lmd->lmd_osd_type);
|
|
|
if (lsi->lsi_lmd->lmd_params != NULL)
|
|
|
- OBD_FREE(lsi->lsi_lmd->lmd_params, 4096);
|
|
|
+ kfree(lsi->lsi_lmd->lmd_params);
|
|
|
|
|
|
- OBD_FREE(lsi->lsi_lmd, sizeof(*lsi->lsi_lmd));
|
|
|
+ kfree(lsi->lsi_lmd);
|
|
|
}
|
|
|
|
|
|
LASSERT(lsi->lsi_llsbi == NULL);
|
|
|
- OBD_FREE(lsi, sizeof(*lsi));
|
|
|
+ kfree(lsi);
|
|
|
s2lsi_nocast(sb) = NULL;
|
|
|
|
|
|
return 0;
|
|
@@ -846,7 +838,7 @@ static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr)
|
|
|
devmax = strlen(ptr) / 8 + 1;
|
|
|
|
|
|
/* temp storage until we figure out how many we have */
|
|
|
- OBD_ALLOC(exclude_list, sizeof(index) * devmax);
|
|
|
+ exclude_list = kcalloc(devmax, sizeof(index), GFP_NOFS);
|
|
|
if (!exclude_list)
|
|
|
return -ENOMEM;
|
|
|
|
|
@@ -875,8 +867,8 @@ static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr)
|
|
|
|
|
|
if (lmd->lmd_exclude_count) {
|
|
|
/* permanent, freed in lustre_free_lsi */
|
|
|
- OBD_ALLOC(lmd->lmd_exclude, sizeof(index) *
|
|
|
- lmd->lmd_exclude_count);
|
|
|
+ lmd->lmd_exclude = kcalloc(lmd->lmd_exclude_count,
|
|
|
+ sizeof(index), GFP_NOFS);
|
|
|
if (lmd->lmd_exclude) {
|
|
|
memcpy(lmd->lmd_exclude, exclude_list,
|
|
|
sizeof(index) * lmd->lmd_exclude_count);
|
|
@@ -885,7 +877,7 @@ static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr)
|
|
|
lmd->lmd_exclude_count = 0;
|
|
|
}
|
|
|
}
|
|
|
- OBD_FREE(exclude_list, sizeof(index) * devmax);
|
|
|
+ kfree(exclude_list);
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
@@ -895,7 +887,7 @@ static int lmd_parse_mgssec(struct lustre_mount_data *lmd, char *ptr)
|
|
|
int length;
|
|
|
|
|
|
if (lmd->lmd_mgssec != NULL) {
|
|
|
- OBD_FREE(lmd->lmd_mgssec, strlen(lmd->lmd_mgssec) + 1);
|
|
|
+ kfree(lmd->lmd_mgssec);
|
|
|
lmd->lmd_mgssec = NULL;
|
|
|
}
|
|
|
|
|
@@ -905,7 +897,7 @@ static int lmd_parse_mgssec(struct lustre_mount_data *lmd, char *ptr)
|
|
|
else
|
|
|
length = tail - ptr;
|
|
|
|
|
|
- OBD_ALLOC(lmd->lmd_mgssec, length + 1);
|
|
|
+ lmd->lmd_mgssec = kzalloc(length + 1, GFP_NOFS);
|
|
|
if (lmd->lmd_mgssec == NULL)
|
|
|
return -ENOMEM;
|
|
|
|
|
@@ -923,7 +915,7 @@ static int lmd_parse_string(char **handle, char *ptr)
|
|
|
return -EINVAL;
|
|
|
|
|
|
if (*handle != NULL) {
|
|
|
- OBD_FREE(*handle, strlen(*handle) + 1);
|
|
|
+ kfree(*handle);
|
|
|
*handle = NULL;
|
|
|
}
|
|
|
|
|
@@ -933,7 +925,7 @@ static int lmd_parse_string(char **handle, char *ptr)
|
|
|
else
|
|
|
length = tail - ptr;
|
|
|
|
|
|
- OBD_ALLOC(*handle, length + 1);
|
|
|
+ *handle = kzalloc(length + 1, GFP_NOFS);
|
|
|
if (*handle == NULL)
|
|
|
return -ENOMEM;
|
|
|
|
|
@@ -963,7 +955,7 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr)
|
|
|
if (lmd->lmd_mgs != NULL)
|
|
|
oldlen = strlen(lmd->lmd_mgs) + 1;
|
|
|
|
|
|
- OBD_ALLOC(mgsnid, oldlen + length + 1);
|
|
|
+ mgsnid = kzalloc(oldlen + length + 1, GFP_NOFS);
|
|
|
if (mgsnid == NULL)
|
|
|
return -ENOMEM;
|
|
|
|
|
@@ -971,7 +963,7 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr)
|
|
|
/* Multiple mgsnid= are taken to mean failover locations */
|
|
|
memcpy(mgsnid, lmd->lmd_mgs, oldlen);
|
|
|
mgsnid[oldlen - 1] = ':';
|
|
|
- OBD_FREE(lmd->lmd_mgs, oldlen);
|
|
|
+ kfree(lmd->lmd_mgs);
|
|
|
}
|
|
|
memcpy(mgsnid + oldlen, *ptr, length);
|
|
|
mgsnid[oldlen + length] = '\0';
|
|
@@ -1005,7 +997,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
|
|
|
}
|
|
|
lmd->lmd_magic = LMD_MAGIC;
|
|
|
|
|
|
- OBD_ALLOC(lmd->lmd_params, 4096);
|
|
|
+ lmd->lmd_params = kzalloc(4096, GFP_NOFS);
|
|
|
if (lmd->lmd_params == NULL)
|
|
|
return -ENOMEM;
|
|
|
lmd->lmd_params[0] = '\0';
|
|
@@ -1143,14 +1135,14 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
|
|
|
/* Remove leading /s from fsname */
|
|
|
while (*++s1 == '/') ;
|
|
|
/* Freed in lustre_free_lsi */
|
|
|
- OBD_ALLOC(lmd->lmd_profile, strlen(s1) + 8);
|
|
|
+ lmd->lmd_profile = kzalloc(strlen(s1) + 8, GFP_NOFS);
|
|
|
if (!lmd->lmd_profile)
|
|
|
return -ENOMEM;
|
|
|
sprintf(lmd->lmd_profile, "%s-client", s1);
|
|
|
}
|
|
|
|
|
|
/* Freed in lustre_free_lsi */
|
|
|
- OBD_ALLOC(lmd->lmd_dev, strlen(devname) + 1);
|
|
|
+ lmd->lmd_dev = kzalloc(strlen(devname) + 1, GFP_NOFS);
|
|
|
if (!lmd->lmd_dev)
|
|
|
return -ENOMEM;
|
|
|
strcpy(lmd->lmd_dev, devname);
|
|
@@ -1161,7 +1153,7 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
|
|
|
*s1-- = 0;
|
|
|
if (*options != 0) {
|
|
|
/* Freed in lustre_free_lsi */
|
|
|
- OBD_ALLOC(lmd->lmd_opts, strlen(options) + 1);
|
|
|
+ lmd->lmd_opts = kzalloc(strlen(options) + 1, GFP_NOFS);
|
|
|
if (!lmd->lmd_opts)
|
|
|
return -ENOMEM;
|
|
|
strcpy(lmd->lmd_opts, options);
|