Whamcloud - gitweb
LU-9679 llite: Discard LUSTRE_FPRIVATE() 52/36652/11
authorMr NeilBrown <neilb@suse.de>
Sun, 3 Nov 2019 23:09:25 +0000 (10:09 +1100)
committerOleg Drokin <green@whamcloud.com>
Thu, 20 Feb 2020 07:13:14 +0000 (07:13 +0000)
The LUSTRE_FPRIVATE() macro adds no value.
Instead of
  LUSTRE_FPRIVATE(file)
use
  file->private_data

which is shorter and more familiar, and widely used
elsewhere in lustre.

Also re-indent several functions where this was changed, to
use TABs.
Also join together some strings that were split across 2
lines.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I811aea8069b22beed15fd96d8c6bef8eca42defd
Reviewed-on: https://review.whamcloud.com/36652
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Arshad Hussain <arshad.super@gmail.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/lcommon_cl.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/llite_mmap.c
lustre/llite/pcc.c
lustre/llite/rw.c

index 79b329b..fdfab6a 100644 (file)
@@ -313,7 +313,7 @@ static int ll_readdir(struct file *filp, void *cookie, filldir_t filldir)
 #endif
 {
        struct inode *inode = file_inode(filp);
-       struct ll_file_data *lfd = LUSTRE_FPRIVATE(filp);
+       struct ll_file_data *lfd = filp->private_data;
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        int hash64 = sbi->ll_flags & LL_SBI_64BIT_HASH;
        int api32 = ll_need_32bit_api(sbi);
@@ -2196,53 +2196,53 @@ out_detach:
 
 static loff_t ll_dir_seek(struct file *file, loff_t offset, int origin)
 {
-        struct inode *inode = file->f_mapping->host;
-        struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
-        struct ll_sb_info *sbi = ll_i2sbi(inode);
-        int api32 = ll_need_32bit_api(sbi);
-        loff_t ret = -EINVAL;
-        ENTRY;
+       struct inode *inode = file->f_mapping->host;
+       struct ll_file_data *fd = file->private_data;
+       struct ll_sb_info *sbi = ll_i2sbi(inode);
+       int api32 = ll_need_32bit_api(sbi);
+       loff_t ret = -EINVAL;
+       ENTRY;
 
        inode_lock(inode);
-        switch (origin) {
-                case SEEK_SET:
-                        break;
-                case SEEK_CUR:
-                        offset += file->f_pos;
-                        break;
-                case SEEK_END:
-                        if (offset > 0)
-                                GOTO(out, ret);
-                        if (api32)
-                                offset += LL_DIR_END_OFF_32BIT;
-                        else
-                                offset += LL_DIR_END_OFF;
-                        break;
-                default:
-                        GOTO(out, ret);
-        }
+       switch (origin) {
+       case SEEK_SET:
+               break;
+       case SEEK_CUR:
+               offset += file->f_pos;
+               break;
+       case SEEK_END:
+               if (offset > 0)
+                       GOTO(out, ret);
+               if (api32)
+                       offset += LL_DIR_END_OFF_32BIT;
+               else
+                       offset += LL_DIR_END_OFF;
+               break;
+       default:
+               GOTO(out, ret);
+       }
 
-        if (offset >= 0 &&
-            ((api32 && offset <= LL_DIR_END_OFF_32BIT) ||
-             (!api32 && offset <= LL_DIR_END_OFF))) {
-                if (offset != file->f_pos) {
-                        if ((api32 && offset == LL_DIR_END_OFF_32BIT) ||
-                            (!api32 && offset == LL_DIR_END_OFF))
+       if (offset >= 0 &&
+           ((api32 && offset <= LL_DIR_END_OFF_32BIT) ||
+            (!api32 && offset <= LL_DIR_END_OFF))) {
+               if (offset != file->f_pos) {
+                       if ((api32 && offset == LL_DIR_END_OFF_32BIT) ||
+                           (!api32 && offset == LL_DIR_END_OFF))
                                fd->lfd_pos = MDS_DIR_END_OFF;
-                        else if (api32 && sbi->ll_flags & LL_SBI_64BIT_HASH)
+                       else if (api32 && sbi->ll_flags & LL_SBI_64BIT_HASH)
                                fd->lfd_pos = offset << 32;
-                        else
+                       else
                                fd->lfd_pos = offset;
-                        file->f_pos = offset;
-                        file->f_version = 0;
-                }
-                ret = offset;
-        }
-        GOTO(out, ret);
+                       file->f_pos = offset;
+                       file->f_version = 0;
+               }
+               ret = offset;
+       }
+       GOTO(out, ret);
 
 out:
        inode_unlock(inode);
-        return ret;
+       return ret;
 }
 
 static int ll_dir_open(struct inode *inode, struct file *file)
index d3cdc6f..7c683b7 100644 (file)
@@ -305,7 +305,7 @@ static int ll_md_close(struct inode *inode, struct file *file)
                .l_inodebits    = { MDS_INODELOCK_OPEN },
        };
        __u64 flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_TEST_LOCK;
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct ll_inode_info *lli = ll_i2info(inode);
        struct lustre_handle lockh;
        enum ldlm_mode lockmode;
@@ -359,7 +359,7 @@ static int ll_md_close(struct inode *inode, struct file *file)
                rc = ll_md_real_close(inode, fd->fd_omode);
 
 out:
-       LUSTRE_FPRIVATE(file) = NULL;
+       file->private_data = NULL;
        ll_file_data_put(fd);
 
        RETURN(rc);
@@ -383,7 +383,7 @@ int ll_file_release(struct inode *inode, struct file *file)
        CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p)\n",
               PFID(ll_inode2fid(inode)), inode);
 
-       fd = LUSTRE_FPRIVATE(file);
+       fd = file->private_data;
        LASSERT(fd != NULL);
 
        /* The last ref on @file, maybe not the the owner pid of statahead,
@@ -392,7 +392,7 @@ int ll_file_release(struct inode *inode, struct file *file)
                ll_deauthorize_statahead(inode, fd);
 
        if (inode->i_sb->s_root == file_dentry(file)) {
-               LUSTRE_FPRIVATE(file) = NULL;
+               file->private_data = NULL;
                ll_file_data_put(fd);
                GOTO(out, rc = 0);
        }
@@ -651,7 +651,7 @@ static int ll_local_open(struct file *file, struct lookup_intent *it,
        struct inode *inode = file_inode(file);
        ENTRY;
 
-       LASSERT(!LUSTRE_FPRIVATE(file));
+       LASSERT(!file->private_data);
 
        LASSERT(fd != NULL);
 
@@ -663,7 +663,7 @@ static int ll_local_open(struct file *file, struct lookup_intent *it,
                        RETURN(rc);
        }
 
-       LUSTRE_FPRIVATE(file) = fd;
+       file->private_data = fd;
        ll_readahead_init(inode, &fd->fd_ras);
        fd->fd_omode = it->it_flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC);
 
@@ -714,18 +714,18 @@ int ll_file_open(struct inode *inode, struct file *file)
                ll_authorize_statahead(inode, fd);
 
        if (inode->i_sb->s_root == file_dentry(file)) {
-                LUSTRE_FPRIVATE(file) = fd;
-                RETURN(0);
-        }
+               file->private_data = fd;
+               RETURN(0);
+       }
 
        if (!it || !it->it_disposition) {
-                /* Convert f_flags into access mode. We cannot use file->f_mode,
-                 * because everything but O_ACCMODE mask was stripped from
-                 * there */
-                if ((oit.it_flags + 1) & O_ACCMODE)
-                        oit.it_flags++;
-                if (file->f_flags & O_TRUNC)
-                        oit.it_flags |= FMODE_WRITE;
+               /* Convert f_flags into access mode. We cannot use file->f_mode,
+                * because everything but O_ACCMODE mask was stripped from
+                * there */
+               if ((oit.it_flags + 1) & O_ACCMODE)
+                       oit.it_flags++;
+               if (file->f_flags & O_TRUNC)
+                       oit.it_flags |= FMODE_WRITE;
 
                /* kernel only call f_op->open in dentry_open.  filp_open calls
                 * dentry_open after call to open_namei that checks permissions.
@@ -735,64 +735,65 @@ int ll_file_open(struct inode *inode, struct file *file)
                if (oit.it_flags & (FMODE_WRITE | FMODE_READ))
                        oit.it_flags |= MDS_OPEN_OWNEROVERRIDE;
 
-                /* We do not want O_EXCL here, presumably we opened the file
-                 * already? XXX - NFS implications? */
-                oit.it_flags &= ~O_EXCL;
+               /* We do not want O_EXCL here, presumably we opened the file
+                * already? XXX - NFS implications? */
+               oit.it_flags &= ~O_EXCL;
 
-                /* bug20584, if "it_flags" contains O_CREAT, the file will be
-                 * created if necessary, then "IT_CREAT" should be set to keep
-                 * consistent with it */
-                if (oit.it_flags & O_CREAT)
-                        oit.it_op |= IT_CREAT;
+               /* bug20584, if "it_flags" contains O_CREAT, the file will be
+                * created if necessary, then "IT_CREAT" should be set to keep
+                * consistent with it */
+               if (oit.it_flags & O_CREAT)
+                       oit.it_op |= IT_CREAT;
 
-                it = &oit;
-        }
+               it = &oit;
+       }
 
 restart:
-        /* Let's see if we have file open on MDS already. */
-        if (it->it_flags & FMODE_WRITE) {
-                och_p = &lli->lli_mds_write_och;
-                och_usecount = &lli->lli_open_fd_write_count;
-        } else if (it->it_flags & FMODE_EXEC) {
-                och_p = &lli->lli_mds_exec_och;
-                och_usecount = &lli->lli_open_fd_exec_count;
-         } else {
-                och_p = &lli->lli_mds_read_och;
-                och_usecount = &lli->lli_open_fd_read_count;
-        }
+       /* Let's see if we have file open on MDS already. */
+       if (it->it_flags & FMODE_WRITE) {
+               och_p = &lli->lli_mds_write_och;
+               och_usecount = &lli->lli_open_fd_write_count;
+       } else if (it->it_flags & FMODE_EXEC) {
+               och_p = &lli->lli_mds_exec_och;
+               och_usecount = &lli->lli_open_fd_exec_count;
+       } else {
+               och_p = &lli->lli_mds_read_och;
+               och_usecount = &lli->lli_open_fd_read_count;
+       }
 
        mutex_lock(&lli->lli_och_mutex);
-        if (*och_p) { /* Open handle is present */
-                if (it_disposition(it, DISP_OPEN_OPEN)) {
-                        /* Well, there's extra open request that we do not need,
-                           let's close it somehow. This will decref request. */
-                        rc = it_open_error(DISP_OPEN_OPEN, it);
-                        if (rc) {
+       if (*och_p) { /* Open handle is present */
+               if (it_disposition(it, DISP_OPEN_OPEN)) {
+                       /* Well, there's extra open request that we do not need,
+                        * let's close it somehow. This will decref request. */
+                       rc = it_open_error(DISP_OPEN_OPEN, it);
+                       if (rc) {
                                mutex_unlock(&lli->lli_och_mutex);
-                                GOTO(out_openerr, rc);
-                        }
+                               GOTO(out_openerr, rc);
+                       }
 
                        ll_release_openhandle(file_dentry(file), it);
-                }
-                (*och_usecount)++;
+               }
+               (*och_usecount)++;
 
-                rc = ll_local_open(file, it, fd, NULL);
-                if (rc) {
-                        (*och_usecount)--;
+               rc = ll_local_open(file, it, fd, NULL);
+               if (rc) {
+                       (*och_usecount)--;
                        mutex_unlock(&lli->lli_och_mutex);
-                        GOTO(out_openerr, rc);
-                }
-        } else {
-                LASSERT(*och_usecount == 0);
+                       GOTO(out_openerr, rc);
+               }
+       } else {
+               LASSERT(*och_usecount == 0);
                if (!it->it_disposition) {
                        struct dentry *dentry = file_dentry(file);
                        struct ll_dentry_data *ldd;
 
-                        /* We cannot just request lock handle now, new ELC code
-                           means that one of other OPEN locks for this file
-                           could be cancelled, and since blocking ast handler
-                           would attempt to grab och_mutex as well, that would
-                           result in a deadlock */
+                       /* We cannot just request lock handle now, new ELC code
+                        * means that one of other OPEN locks for this file
+                        * could be cancelled, and since blocking ast handler
+                        * would attempt to grab och_mutex as well, that would
+                        * result in a deadlock
+                        */
                        mutex_unlock(&lli->lli_och_mutex);
                        /*
                         * Normally called under two situations:
@@ -824,22 +825,22 @@ restart:
                         */
                        it->it_flags |= MDS_OPEN_BY_FID;
                        rc = ll_intent_file_open(dentry, NULL, 0, it);
-                        if (rc)
-                                GOTO(out_openerr, rc);
+                       if (rc)
+                               GOTO(out_openerr, rc);
 
-                        goto restart;
-                }
-                OBD_ALLOC(*och_p, sizeof (struct obd_client_handle));
-                if (!*och_p)
-                        GOTO(out_och_free, rc = -ENOMEM);
+                       goto restart;
+               }
+               OBD_ALLOC(*och_p, sizeof(struct obd_client_handle));
+               if (!*och_p)
+                       GOTO(out_och_free, rc = -ENOMEM);
 
-                (*och_usecount)++;
+               (*och_usecount)++;
 
-                /* md_intent_lock() didn't get a request ref if there was an
-                 * open error, so don't do cleanup on the request here
-                 * (bug 3430) */
-                /* XXX (green): Should not we bail out on any error here, not
-                 * just open error? */
+               /* md_intent_lock() didn't get a request ref if there was an
+                * open error, so don't do cleanup on the request here
+                * (bug 3430) */
+               /* XXX (green): Should not we bail out on any error here, not
+                * just open error? */
                rc = it_open_error(DISP_OPEN_OPEN, it);
                if (rc != 0)
                        GOTO(out_och_free, rc);
@@ -873,12 +874,12 @@ restart:
        GOTO(out_och_free, rc);
 
 out_och_free:
-        if (rc) {
-                if (och_p && *och_p) {
-                        OBD_FREE(*och_p, sizeof (struct obd_client_handle));
-                        *och_p = NULL; /* OBD_FREE writes some magic there */
-                        (*och_usecount)--;
-                }
+       if (rc) {
+               if (och_p && *och_p) {
+                       OBD_FREE(*och_p, sizeof(struct obd_client_handle));
+                       *och_p = NULL; /* OBD_FREE writes some magic there */
+                       (*och_usecount)--;
+               }
                mutex_unlock(&lli->lli_och_mutex);
 
 out_openerr:
@@ -933,7 +934,7 @@ static int ll_lease_och_acquire(struct inode *inode, struct file *file,
                                struct lustre_handle *old_open_handle)
 {
        struct ll_inode_info *lli = ll_i2info(inode);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct obd_client_handle **och_p;
        __u64 *och_usecount;
        int rc = 0;
@@ -977,7 +978,7 @@ out_unlock:
 static int ll_lease_och_release(struct inode *inode, struct file *file)
 {
        struct ll_inode_info *lli = ll_i2info(inode);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct obd_client_handle **och_p;
        struct obd_client_handle *old_och = NULL;
        __u64 *och_usecount;
@@ -1349,7 +1350,7 @@ out_size_unlock:
  */
 void ll_io_set_mirror(struct cl_io *io, const struct file *file)
 {
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
 
        /* clear layout version for generic(non-resync) I/O in case it carries
         * stale layout version due to I/O restart */
@@ -1398,7 +1399,7 @@ void ll_io_init(struct cl_io *io, struct file *file, enum cl_io_type iot,
                struct vvp_io_args *args)
 {
        struct inode *inode = file_inode(file);
-       struct ll_file_data *fd  = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd  = file->private_data;
 
        io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK;
        io->ci_lock_no_expand = fd->ll_lock_no_expand;
@@ -1472,7 +1473,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
        struct vvp_io           *vio = vvp_env_io(env);
        struct inode            *inode = file_inode(file);
        struct ll_inode_info    *lli = ll_i2info(inode);
-       struct ll_file_data     *fd  = LUSTRE_FPRIVATE(file);
+       struct ll_file_data     *fd  = file->private_data;
        struct range_lock       range;
        struct cl_io            *io;
        ssize_t                 result = 0;
@@ -1500,7 +1501,7 @@ restart:
                else
                        range_lock_init(&range, *ppos, *ppos + count - 1);
 
-               vio->vui_fd  = LUSTRE_FPRIVATE(file);
+               vio->vui_fd  = file->private_data;
                vio->vui_io_subtype = args->via_io_subtype;
 
                switch (vio->vui_io_subtype) {
@@ -1724,7 +1725,7 @@ static ssize_t ll_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
 out:
        if (result > 0) {
                ll_rw_stats_tally(ll_i2sbi(file_inode(file)), current->pid,
-                                 LUSTRE_FPRIVATE(file), iocb->ki_pos, result,
+                                 file->private_data, iocb->ki_pos, result,
                                  READ);
                ll_stats_ops_tally(ll_i2sbi(file_inode(file)), LPROC_LL_READ,
                                   ktime_us_delta(ktime_get(), kstart));
@@ -1864,7 +1865,7 @@ static ssize_t ll_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
 out:
        if (rc_normal > 0) {
                ll_rw_stats_tally(ll_i2sbi(file_inode(file)), current->pid,
-                                 LUSTRE_FPRIVATE(file), iocb->ki_pos,
+                                 file->private_data, iocb->ki_pos,
                                  rc_normal, WRITE);
                ll_stats_ops_tally(ll_i2sbi(file_inode(file)), LPROC_LL_WRITE,
                                   ktime_us_delta(ktime_get(), kstart));
@@ -2028,7 +2029,7 @@ static ssize_t ll_file_splice_read(struct file *in_file, loff_t *ppos,
        __u16 refcheck;
        bool cached;
 
-        ENTRY;
+       ENTRY;
 
        result = pcc_file_splice_read(in_file, ppos, pipe,
                                      count, flags, &cached);
@@ -2038,21 +2039,21 @@ static ssize_t ll_file_splice_read(struct file *in_file, loff_t *ppos,
        ll_ras_enter(in_file, *ppos, count);
 
        env = cl_env_get(&refcheck);
-        if (IS_ERR(env))
-                RETURN(PTR_ERR(env));
+       if (IS_ERR(env))
+               RETURN(PTR_ERR(env));
 
        args = ll_env_args(env, IO_SPLICE);
-        args->u.splice.via_pipe = pipe;
-        args->u.splice.via_flags = flags;
+       args->u.splice.via_pipe = pipe;
+       args->u.splice.via_flags = flags;
 
-        result = ll_file_io_generic(env, args, in_file, CIT_READ, ppos, count);
-        cl_env_put(env, &refcheck);
+       result = ll_file_io_generic(env, args, in_file, CIT_READ, ppos, count);
+       cl_env_put(env, &refcheck);
 
        if (result > 0)
                ll_rw_stats_tally(ll_i2sbi(file_inode(in_file)), current->pid,
-                                 LUSTRE_FPRIVATE(in_file), *ppos, result,
+                                 in_file->private_data, *ppos, result,
                                  READ);
-        RETURN(result);
+       RETURN(result);
 }
 
 int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry,
@@ -2260,7 +2261,7 @@ ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg)
 {
        struct ll_inode_info *lli = ll_i2info(inode);
        struct cl_object *obj = lli->lli_clob;
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct ll_grouplock grouplock;
        int rc;
        ENTRY;
@@ -2346,7 +2347,7 @@ static int ll_put_grouplock(struct inode *inode, struct file *file,
                            unsigned long arg)
 {
        struct ll_inode_info   *lli = ll_i2info(inode);
-       struct ll_file_data    *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data    *fd = file->private_data;
        struct ll_grouplock     grouplock;
        int                     rc;
        ENTRY;
@@ -3144,7 +3145,7 @@ static int ll_ladvise(struct inode *inode, struct file *file, __u64 flags,
 
 static int ll_lock_noexpand(struct file *file, int flags)
 {
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
 
        fd->ll_lock_no_expand = !(flags & LF_UNSET);
 
@@ -3254,7 +3255,7 @@ static long ll_file_unlock_lease(struct file *file, struct ll_ioc_lease *ioc,
                                 unsigned long arg)
 {
        struct inode            *inode = file_inode(file);
-       struct ll_file_data     *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data     *fd = file->private_data;
        struct ll_inode_info    *lli = ll_i2info(inode);
        struct obd_client_handle *och = NULL;
        struct split_param sp;
@@ -3417,7 +3418,7 @@ static long ll_file_set_lease(struct file *file, struct ll_ioc_lease *ioc,
 {
        struct inode *inode = file_inode(file);
        struct ll_inode_info *lli = ll_i2info(inode);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct obd_client_handle *och = NULL;
        __u64 open_flags = 0;
        bool lease_broken;
@@ -3518,7 +3519,7 @@ static long
 ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        struct inode            *inode = file_inode(file);
-       struct ll_file_data     *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data     *fd = file->private_data;
        int                      flags, rc;
        ENTRY;
 
@@ -4079,7 +4080,7 @@ static int ll_flush(struct file *file, fl_owner_t id)
 {
        struct inode *inode = file_inode(file);
        struct ll_inode_info *lli = ll_i2info(inode);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        int rc, err;
 
        LASSERT(!S_ISDIR(inode->i_mode));
@@ -4196,7 +4197,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
                ptlrpc_req_finished(req);
 
        if (S_ISREG(inode->i_mode)) {
-               struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+               struct ll_file_data *fd = file->private_data;
                bool cached;
 
                /* Sync metadata on MDT first, and then sync the cached data
@@ -4556,7 +4557,7 @@ out_iput:
 static int
 ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)
 {
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        ENTRY;
 
        /*
index c8e4402..618de96 100644 (file)
@@ -70,16 +70,16 @@ static DEFINE_MUTEX(cl_inode_fini_guard);
 int cl_setattr_ost(struct cl_object *obj, const struct iattr *attr,
                   enum op_xvalid xvalid, unsigned int attr_flags)
 {
-        struct lu_env *env;
-        struct cl_io  *io;
-        int            result;
+       struct lu_env *env;
+       struct cl_io  *io;
+       int            result;
        __u16          refcheck;
 
-        ENTRY;
+       ENTRY;
 
-        env = cl_env_get(&refcheck);
-        if (IS_ERR(env))
-                RETURN(PTR_ERR(env));
+       env = cl_env_get(&refcheck);
+       if (IS_ERR(env))
+               RETURN(PTR_ERR(env));
 
        io = vvp_env_thread_io(env);
        io->ci_obj = obj;
@@ -98,19 +98,19 @@ again:
        if (attr->ia_valid & ATTR_FILE)
                ll_io_set_mirror(io, attr->ia_file);
 
-        if (cl_io_init(env, io, CIT_SETATTR, io->ci_obj) == 0) {
+       if (cl_io_init(env, io, CIT_SETATTR, io->ci_obj) == 0) {
                struct vvp_io *vio = vvp_env_io(env);
 
                if (attr->ia_valid & ATTR_FILE)
                        /* populate the file descriptor for ftruncate to honor
                         * group lock - see LU-787 */
-                       vio->vui_fd = LUSTRE_FPRIVATE(attr->ia_file);
+                       vio->vui_fd = attr->ia_file->private_data;
 
-                result = cl_io_loop(env, io);
-        } else {
-                result = io->ci_result;
-        }
-        cl_io_fini(env, io);
+               result = cl_io_loop(env, io);
+       } else {
+               result = io->ci_result;
+       }
+       cl_io_fini(env, io);
        if (unlikely(io->ci_need_restart))
                goto again;
 
index 76d72c5..0782a84 100644 (file)
@@ -72,7 +72,6 @@
 #define LL_MAX_BLKSIZE_BITS 22
 
 #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0")
-#define LUSTRE_FPRIVATE(file) ((file)->private_data)
 
 struct ll_dentry_data {
        struct lookup_intent            *lld_it;
@@ -1472,12 +1471,12 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
 
 static inline int ll_file_nolock(const struct file *file)
 {
-        struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct inode *inode = file_inode((struct file *)file);
 
-        LASSERT(fd != NULL);
-        return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
-                (ll_i2sbi(inode)->ll_flags & LL_SBI_NOLCK));
+       LASSERT(fd != NULL);
+       return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) ||
+               (ll_i2sbi(inode)->ll_flags & LL_SBI_NOLCK));
 }
 
 static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode,
index 240fad2..5527d84 100644 (file)
@@ -1798,7 +1798,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr,
        }
 
        if (attr->ia_valid & ATTR_FILE) {
-               struct ll_file_data *fd = LUSTRE_FPRIVATE(attr->ia_file);
+               struct ll_file_data *fd = attr->ia_file->private_data;
 
                if (fd->fd_lease_och)
                        op_data->op_bias |= MDS_TRUNC_KEEP_LEASE;
index ead6b39..673ff2c 100644 (file)
@@ -119,7 +119,7 @@ restart:
        rc = cl_io_init(env, io, CIT_FAULT, io->ci_obj);
        if (rc == 0) {
                struct vvp_io *vio = vvp_env_io(env);
-               struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+               struct ll_file_data *fd = file->private_data;
 
                LASSERT(vio->vui_cl.cis_io == io);
 
@@ -370,33 +370,32 @@ restart:
        result = ll_fault0(vma, vmf);
        if (vmf->page &&
            !(result & (VM_FAULT_RETRY | VM_FAULT_ERROR | VM_FAULT_LOCKED))) {
-                struct page *vmpage = vmf->page;
+               struct page *vmpage = vmf->page;
 
-                /* check if this page has been truncated */
-                lock_page(vmpage);
-                if (unlikely(vmpage->mapping == NULL)) { /* unlucky */
-                        unlock_page(vmpage);
+               /* check if this page has been truncated */
+               lock_page(vmpage);
+               if (unlikely(vmpage->mapping == NULL)) { /* unlucky */
+                       unlock_page(vmpage);
                        put_page(vmpage);
-                        vmf->page = NULL;
+                       vmf->page = NULL;
 
-                        if (!printed && ++count > 16) {
-                                CWARN("the page is under heavy contention,"
-                                      "maybe your app(%s) needs revising :-)\n",
-                                      current->comm);
-                                printed = true;
-                        }
+                       if (!printed && ++count > 16) {
+                               CWARN("the page is under heavy contention, maybe your app(%s) needs revising :-)\n",
+                                     current->comm);
+                               printed = true;
+                       }
 
-                        goto restart;
-                }
+                       goto restart;
+               }
 
-                result |= VM_FAULT_LOCKED;
-        }
+               result |= VM_FAULT_LOCKED;
+       }
        cfs_restore_sigs(set);
 
 out:
        if (vmf->page && result == VM_FAULT_LOCKED) {
                ll_rw_stats_tally(ll_i2sbi(file_inode(vma->vm_file)),
-                                 current->pid, LUSTRE_FPRIVATE(vma->vm_file),
+                                 current->pid, vma->vm_file->private_data,
                                  cl_offset(NULL, vmf->page->index), PAGE_SIZE,
                                  READ);
                ll_stats_ops_tally(ll_i2sbi(file_inode(vma->vm_file)),
@@ -435,38 +434,37 @@ static vm_fault_t ll_page_mkwrite(struct vm_area_struct *vma,
                if (!printed && ++count > 16) {
                        const struct dentry *de = file_dentry(vma->vm_file);
 
-                       CWARN("app(%s): the page %lu of file "DFID" is under"
-                             " heavy contention\n",
+                       CWARN("app(%s): the page %lu of file "DFID" is under heavy contention\n",
                              current->comm, vmf->pgoff,
                              PFID(ll_inode2fid(de->d_inode)));
-                        printed = true;
-                }
-        } while (retry);
-
-        switch(result) {
-        case 0:
-                LASSERT(PageLocked(vmf->page));
-                result = VM_FAULT_LOCKED;
-                break;
-        case -ENODATA:
-        case -EFAULT:
-                result = VM_FAULT_NOPAGE;
-                break;
-        case -ENOMEM:
-                result = VM_FAULT_OOM;
-                break;
-        case -EAGAIN:
-                result = VM_FAULT_RETRY;
-                break;
-        default:
-                result = VM_FAULT_SIGBUS;
-                break;
-        }
+                       printed = true;
+               }
+       } while (retry);
+
+       switch (result) {
+       case 0:
+               LASSERT(PageLocked(vmf->page));
+               result = VM_FAULT_LOCKED;
+               break;
+       case -ENODATA:
+       case -EFAULT:
+               result = VM_FAULT_NOPAGE;
+               break;
+       case -ENOMEM:
+               result = VM_FAULT_OOM;
+               break;
+       case -EAGAIN:
+               result = VM_FAULT_RETRY;
+               break;
+       default:
+               result = VM_FAULT_SIGBUS;
+               break;
+       }
 
 out:
        if (result == VM_FAULT_LOCKED) {
                ll_rw_stats_tally(ll_i2sbi(file_inode(vma->vm_file)),
-                                 current->pid, LUSTRE_FPRIVATE(vma->vm_file),
+                                 current->pid, vma->vm_file->private_data,
                                  cl_offset(NULL, vmf->page->index), PAGE_SIZE,
                                  WRITE);
                ll_stats_ops_tally(ll_i2sbi(file_inode(vma->vm_file)),
index d824c1b..8ab41b4 100644 (file)
@@ -1456,7 +1456,7 @@ int pcc_file_open(struct inode *inode, struct file *file)
 {
        struct pcc_inode *pcci;
        struct ll_inode_info *lli = ll_i2info(inode);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct pcc_file *pccf = &fd->fd_pcc_file;
        struct file *pcc_file;
        struct path *path;
@@ -1517,7 +1517,7 @@ out_unlock:
 void pcc_file_release(struct inode *inode, struct file *file)
 {
        struct pcc_inode *pcci;
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct pcc_file *pccf;
        struct path *path;
        struct qstr *dname;
@@ -1619,7 +1619,7 @@ ssize_t pcc_file_read_iter(struct kiocb *iocb,
                           struct iov_iter *iter, bool *cached)
 {
        struct file *file = iocb->ki_filp;
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct pcc_file *pccf = &fd->fd_pcc_file;
        struct inode *inode = file_inode(file);
        ssize_t result;
@@ -1686,7 +1686,7 @@ ssize_t pcc_file_write_iter(struct kiocb *iocb,
                            struct iov_iter *iter, bool *cached)
 {
        struct file *file = iocb->ki_filp;
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct pcc_file *pccf = &fd->fd_pcc_file;
        struct inode *inode = file_inode(file);
        ssize_t result;
@@ -1825,7 +1825,7 @@ ssize_t pcc_file_splice_read(struct file *in_file, loff_t *ppos,
                             bool *cached)
 {
        struct inode *inode = file_inode(in_file);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(in_file);
+       struct ll_file_data *fd = in_file->private_data;
        struct file *pcc_file = fd->fd_pcc_file.pccf_file;
        ssize_t result;
 
@@ -1854,7 +1854,7 @@ int pcc_fsync(struct file *file, loff_t start, loff_t end,
              int datasync, bool *cached)
 {
        struct inode *inode = file_inode(file);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct file *pcc_file = fd->fd_pcc_file.pccf_file;
        int rc;
 
@@ -1880,7 +1880,7 @@ int pcc_file_mmap(struct file *file, struct vm_area_struct *vma,
                  bool *cached)
 {
        struct inode *inode = file_inode(file);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct file *pcc_file = fd->fd_pcc_file.pccf_file;
        struct pcc_inode *pcci;
        int rc = 0;
@@ -1915,7 +1915,7 @@ void pcc_vm_open(struct vm_area_struct *vma)
        struct pcc_inode *pcci;
        struct file *file = vma->vm_file;
        struct inode *inode = file_inode(file);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct file *pcc_file = fd->fd_pcc_file.pccf_file;
        struct vm_operations_struct *pcc_vm_ops = vma->vm_private_data;
 
@@ -1939,7 +1939,7 @@ void pcc_vm_close(struct vm_area_struct *vma)
 {
        struct file *file = vma->vm_file;
        struct inode *inode = file_inode(file);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct file *pcc_file = fd->fd_pcc_file.pccf_file;
        struct vm_operations_struct *pcc_vm_ops = vma->vm_private_data;
 
@@ -1964,7 +1964,7 @@ int pcc_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
        struct mm_struct *mm = vma->vm_mm;
        struct file *file = vma->vm_file;
        struct inode *inode = file_inode(file);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct file *pcc_file = fd->fd_pcc_file.pccf_file;
        struct vm_operations_struct *pcc_vm_ops = vma->vm_private_data;
        int rc;
@@ -2044,7 +2044,7 @@ int pcc_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
 {
        struct file *file = vma->vm_file;
        struct inode *inode = file_inode(file);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct file *pcc_file = fd->fd_pcc_file.pccf_file;
        struct vm_operations_struct *pcc_vm_ops = vma->vm_private_data;
        int rc;
@@ -2680,7 +2680,7 @@ int pcc_ioctl_state(struct file *file, struct inode *inode,
        char *buf;
        char *path;
        int buf_len = sizeof(state->pccs_path);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct pcc_file *pccf = &fd->fd_pcc_file;
        struct pcc_inode *pcci;
 
index 7d5453f..a11a038 100644 (file)
@@ -520,7 +520,7 @@ static void ll_readahead_handle_work(struct work_struct *wq)
 
        work = container_of(wq, struct ll_readahead_work,
                            lrw_readahead_work);
-       fd = LUSTRE_FPRIVATE(work->lrw_file);
+       fd = work->lrw_file->private_data;
        ras = &fd->fd_ras;
        file = work->lrw_file;
        inode = file_inode(file);
@@ -996,7 +996,7 @@ static void ras_detect_read_pattern(struct ll_readahead_state *ras,
 
 void ll_ras_enter(struct file *f, loff_t pos, size_t count)
 {
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(f);
+       struct ll_file_data *fd = f->private_data;
        struct ll_readahead_state *ras = &fd->fd_ras;
        struct inode *inode = file_inode(f);
        unsigned long index = pos >> PAGE_SHIFT;
@@ -1308,7 +1308,7 @@ int ll_writepages(struct address_space *mapping, struct writeback_control *wbc)
 
 struct ll_cl_context *ll_cl_find(struct file *file)
 {
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct ll_cl_context *lcc;
        struct ll_cl_context *found = NULL;
 
@@ -1327,7 +1327,7 @@ struct ll_cl_context *ll_cl_find(struct file *file)
 void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io,
               enum lcc_type type)
 {
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
 
        memset(lcc, 0, sizeof(*lcc));
@@ -1344,7 +1344,7 @@ void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io,
 
 void ll_cl_remove(struct file *file, const struct lu_env *env)
 {
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct ll_cl_context *lcc = &ll_env_info(env)->lti_io_ctx;
 
        write_lock(&fd->fd_lock);
@@ -1357,7 +1357,7 @@ int ll_io_read_page(const struct lu_env *env, struct cl_io *io,
 {
        struct inode              *inode  = vvp_object_inode(page->cp_obj);
        struct ll_sb_info         *sbi    = ll_i2sbi(inode);
-       struct ll_file_data       *fd     = LUSTRE_FPRIVATE(file);
+       struct ll_file_data       *fd     = file->private_data;
        struct ll_readahead_state *ras    = &fd->fd_ras;
        struct cl_2queue          *queue  = &io->ci_queue;
        struct cl_sync_io         *anchor = NULL;
@@ -1453,7 +1453,7 @@ static int kickoff_async_readahead(struct file *file, unsigned long pages)
        struct ll_readahead_work *lrw;
        struct inode *inode = file_inode(file);
        struct ll_sb_info *sbi = ll_i2sbi(inode);
-       struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+       struct ll_file_data *fd = file->private_data;
        struct ll_readahead_state *ras = &fd->fd_ras;
        struct ll_ra_info *ra = &sbi->ll_ra_info;
        unsigned long throttle;
@@ -1543,7 +1543,7 @@ int ll_readpage(struct file *file, struct page *vmpage)
 
        if (io == NULL) { /* fast read */
                struct inode *inode = file_inode(file);
-               struct ll_file_data *fd = LUSTRE_FPRIVATE(file);
+               struct ll_file_data *fd = file->private_data;
                struct ll_readahead_state *ras = &fd->fd_ras;
                struct lu_env  *local_env = NULL;
                struct vvp_page *vpg;