Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-block.git] / drivers / staging / lustre / lustre / llite / llite_lib.c
index f9132eddf51f18af018fad14148c0ea641fbbf2f..a27af7882170f42924aed9d0685dde3cf24f8211 100644 (file)
@@ -87,11 +87,10 @@ static struct ll_sb_info *ll_init_sbi(void)
 
        si_meminfo(&si);
        pages = si.totalram - si.totalhigh;
-       if (pages >> (20 - PAGE_CACHE_SHIFT) < 512) {
+       if (pages >> (20 - PAGE_CACHE_SHIFT) < 512)
                lru_page_max = pages / 2;
-       } else {
+       else
                lru_page_max = (pages / 4) * 3;
-       }
 
        /* initialize lru data */
        atomic_set(&sbi->ll_cache.ccc_users, 0);
@@ -621,7 +620,7 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize)
        rc = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_MAX_EASIZE),
                          KEY_MAX_EASIZE, &size, lmmsize, NULL);
        if (rc)
-               CERROR("Get max mdsize error rc %d \n", rc);
+               CERROR("Get max mdsize error rc %d\n", rc);
 
        return rc;
 }
@@ -978,19 +977,17 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt)
        CDEBUG(D_CONFIG, "Found profile %s: mdc=%s osc=%s\n", profilenm,
               lprof->lp_md, lprof->lp_dt);
 
-       dt = kzalloc(strlen(lprof->lp_dt) + instlen + 2, GFP_NOFS);
+       dt = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_dt, cfg->cfg_instance);
        if (!dt) {
                err = -ENOMEM;
                goto out_free;
        }
-       sprintf(dt, "%s-%p", lprof->lp_dt, cfg->cfg_instance);
 
-       md = kzalloc(strlen(lprof->lp_md) + instlen + 2, GFP_NOFS);
+       md = kasprintf(GFP_NOFS, "%s-%p", lprof->lp_md, cfg->cfg_instance);
        if (!md) {
                err = -ENOMEM;
                goto out_free;
        }
-       sprintf(md, "%s-%p", lprof->lp_md, cfg->cfg_instance);
 
        /* connections, registrations, sb setup */
        err = client_common_fill_super(sb, md, dt, mnt);
@@ -1432,7 +1429,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
 
        if (attr->ia_valid & (ATTR_SIZE |
                              ATTR_ATIME | ATTR_ATIME_SET |
-                             ATTR_MTIME | ATTR_MTIME_SET))
+                             ATTR_MTIME | ATTR_MTIME_SET)) {
                /* For truncate and utimes sending attributes to OSTs, setting
                 * mtime/atime to the past will be performed under PW [0:EOF]
                 * extent lock (new_size:EOF for truncate).  It may seem
@@ -1444,6 +1441,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
                rc = ll_setattr_ost(inode, attr);
                if (attr->ia_valid & ATTR_SIZE)
                        up_write(&lli->lli_trunc_sem);
+       }
 out:
        if (op_data) {
                if (op_data->op_ioepoch) {
@@ -1608,7 +1606,7 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
        struct lov_stripe_md *lsm = md->lsm;
        struct ll_sb_info *sbi = ll_i2sbi(inode);
 
-       LASSERT ((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0));
+       LASSERT((lsm != NULL) == ((body->valid & OBD_MD_FLEASIZE) != 0));
        if (lsm != NULL) {
                if (!lli->lli_has_smd &&
                    !(sbi->ll_flags & LL_SBI_LAYOUT_LOCK))
@@ -2152,7 +2150,8 @@ int ll_process_config(struct lustre_cfg *lcfg)
        ptr = strrchr(lustre_cfg_string(lcfg, 0), '-');
        if (!ptr || !*(++ptr))
                return -EINVAL;
-       if (sscanf(ptr, "%lx", &x) != 1)
+       rc = kstrtoul(ptr, 16, &x);
+       if (rc != 0)
                return -EINVAL;
        sb = (void *)x;
        /* This better be a real Lustre superblock! */