Whamcloud - gitweb
LU-12885 mds: add enums for MDS_OPEN flags (2/4) 66/55066/7
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Fri, 10 May 2024 08:08:34 +0000 (13:38 +0530)
committerOleg Drokin <green@whamcloud.com>
Fri, 23 Aug 2024 21:57:57 +0000 (21:57 +0000)
This patch is second of the series of patch that separates
kernel open flags from MDS open flags

This second step changes och_flags to use MDS_* flags. This
also renames 'struct ll_file_data' variable from 'fd' to 'lfd'.
As 'fd' is generally used to denote kernel fd.

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I3b105da5930fde51a57b2cda7aef38cd1e1d774d
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55066
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/llite_lib.c
lustre/llite/llite_mmap.c
lustre/llite/lproc_llite.c
lustre/llite/pcc.c
lustre/llite/rw.c
lustre/llite/statahead.c

index 342132d..a851d11 100644 (file)
@@ -2893,7 +2893,7 @@ 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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        int api32 = ll_need_32bit_api(sbi);
        loff_t ret = -EINVAL;
@@ -2927,11 +2927,11 @@ static loff_t ll_dir_seek(struct file *file, loff_t offset, int origin)
                        hash64 = test_bit(LL_SBI_64BIT_HASH, sbi->ll_flags);
                        if ((api32 && offset == LL_DIR_END_OFF_32BIT) ||
                            (!api32 && offset == LL_DIR_END_OFF))
-                               fd->lfd_pos = MDS_DIR_END_OFF;
+                               lfd->lfd_pos = MDS_DIR_END_OFF;
                        else if (api32 && hash64)
-                               fd->lfd_pos = offset << 32;
+                               lfd->lfd_pos = offset << 32;
                        else
-                               fd->lfd_pos = offset;
+                               lfd->lfd_pos = offset;
                        file->f_pos = offset;
                        file->f_version = 0;
                }
index 8abd025..45e0564 100644 (file)
@@ -81,22 +81,22 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
 
 static struct ll_file_data *ll_file_data_get(void)
 {
-       struct ll_file_data *fd;
+       struct ll_file_data *lfd;
 
-       OBD_SLAB_ALLOC_PTR_GFP(fd, ll_file_data_slab, GFP_NOFS);
-       if (fd == NULL)
+       OBD_SLAB_ALLOC_PTR_GFP(lfd, ll_file_data_slab, GFP_NOFS);
+       if (lfd == NULL)
                return NULL;
 
-       fd->fd_write_failed = false;
-       pcc_file_init(&fd->fd_pcc_file);
+       lfd->fd_write_failed = false;
+       pcc_file_init(&lfd->fd_pcc_file);
 
-       return fd;
+       return lfd;
 }
 
-static void ll_file_data_put(struct ll_file_data *fd)
+static void ll_file_data_put(struct ll_file_data *lfd)
 {
-       if (fd != NULL)
-               OBD_SLAB_FREE_PTR(fd, ll_file_data_slab);
+       if (lfd != NULL)
+               OBD_SLAB_FREE_PTR(lfd, ll_file_data_slab);
 }
 
 /* Packs all the attributes into @op_data for the CLOSE rpc.  */
@@ -129,7 +129,7 @@ static void ll_prepare_close(struct inode *inode, struct md_op_data *op_data,
        op_data->op_attr_flags = ll_inode2ext_flags(inode);
        op_data->op_open_handle = och->och_open_handle;
 
-       if (och->och_flags & FMODE_WRITE &&
+       if (och->och_flags & MDS_FMODE_WRITE &&
            test_and_clear_bit(LLIF_DATA_MODIFIED,
                               &ll_i2info(inode)->lli_flags))
                /* For HSM: if inode data has been modified, pack it so that
@@ -333,7 +333,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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct ll_inode_info *lli = ll_i2info(inode);
        struct lustre_handle lockh;
        enum ldlm_mode lockmode;
@@ -341,16 +341,16 @@ static int ll_md_close(struct inode *inode, struct file *file)
 
        ENTRY;
        /* clear group lock, if present */
-       if (unlikely(fd->fd_flags & LL_FILE_GROUP_LOCKED))
-               ll_put_grouplock(inode, file, fd->fd_grouplock.lg_gid);
+       if (unlikely(lfd->fd_flags & LL_FILE_GROUP_LOCKED))
+               ll_put_grouplock(inode, file, lfd->fd_grouplock.lg_gid);
 
        mutex_lock(&lli->lli_och_mutex);
-       if (fd->fd_lease_och != NULL) {
+       if (lfd->fd_lease_och != NULL) {
                bool lease_broken;
                struct obd_client_handle *lease_och;
 
-               lease_och = fd->fd_lease_och;
-               fd->fd_lease_och = NULL;
+               lease_och = lfd->fd_lease_och;
+               lfd->fd_lease_och = NULL;
                mutex_unlock(&lli->lli_och_mutex);
 
                /* Usually the lease is not released when the
@@ -365,11 +365,11 @@ static int ll_md_close(struct inode *inode, struct file *file)
                             PFID(&lli->lli_fid), rc, lease_broken);
        }
 
-       if (fd->fd_och != NULL) {
+       if (lfd->fd_och != NULL) {
                struct obd_client_handle *och;
 
-               och = fd->fd_och;
-               fd->fd_och = NULL;
+               och = lfd->fd_och;
+               lfd->fd_och = NULL;
                mutex_unlock(&lli->lli_och_mutex);
 
                rc = ll_close_inode_openhandle(inode, och, 0, NULL);
@@ -379,11 +379,11 @@ static int ll_md_close(struct inode *inode, struct file *file)
        /* Let's see if we have good enough OPEN lock on the file and if we can
         * skip talking to MDS
         */
-       if (fd->fd_omode & FMODE_WRITE) {
+       if (lfd->fd_omode & FMODE_WRITE) {
                lockmode = LCK_CW;
                LASSERT(lli->lli_open_fd_write_count);
                lli->lli_open_fd_write_count--;
-       } else if (fd->fd_omode & FMODE_EXEC) {
+       } else if (lfd->fd_omode & FMODE_EXEC) {
                lockmode = LCK_PR;
                LASSERT(lli->lli_open_fd_exec_count);
                lli->lli_open_fd_exec_count--;
@@ -398,11 +398,11 @@ static int ll_md_close(struct inode *inode, struct file *file)
        if ((lockmode == LCK_CW && inode->i_mode & 0111) ||
            !md_lock_match(ll_i2mdexp(inode), flags, ll_inode2fid(inode),
                           LDLM_IBITS, &policy, lockmode, &lockh))
-               rc = ll_md_real_close(inode, fd->fd_omode);
+               rc = ll_md_real_close(inode, lfd->fd_omode);
 
 out:
        file->private_data = NULL;
-       ll_file_data_put(fd);
+       ll_file_data_put(lfd);
 
        RETURN(rc);
 }
@@ -414,7 +414,7 @@ out:
  */
 int ll_file_release(struct inode *inode, struct file *file)
 {
-       struct ll_file_data *fd;
+       struct ll_file_data *lfd;
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        struct ll_inode_info *lli = ll_i2info(inode);
        ktime_t kstart = ktime_get();
@@ -426,19 +426,19 @@ int ll_file_release(struct inode *inode, struct file *file)
               file_dentry(file)->d_name.name,
               PFID(ll_inode2fid(file_inode(file))), inode, file->f_flags);
 
-       fd = file->private_data;
-       LASSERT(fd != NULL);
+       lfd = file->private_data;
+       LASSERT(lfd != NULL);
 
        /* The last ref on @file, maybe not the the owner pid of statahead,
         * because parent and child process can share the same file handle.
         */
        if (S_ISDIR(inode->i_mode) &&
-           (lli->lli_opendir_key == fd || fd->fd_sai))
-               ll_deauthorize_statahead(inode, fd);
+           (lli->lli_opendir_key == lfd || lfd->fd_sai))
+               ll_deauthorize_statahead(inode, lfd);
 
        if (is_root_inode(inode)) {
                file->private_data = NULL;
-               ll_file_data_put(fd);
+               ll_file_data_put(lfd);
                GOTO(out, rc = 0);
        }
 
@@ -782,14 +782,15 @@ static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it,
 }
 
 static int ll_local_open(struct file *file, struct lookup_intent *it,
-                        struct ll_file_data *fd, struct obd_client_handle *och)
+                        struct ll_file_data *lfd,
+                        struct obd_client_handle *och)
 {
        struct inode *inode = file_inode(file);
 
        ENTRY;
        LASSERT(!file->private_data);
 
-       LASSERT(fd != NULL);
+       LASSERT(lfd != NULL);
 
        if (och) {
                int rc;
@@ -799,10 +800,10 @@ static int ll_local_open(struct file *file, struct lookup_intent *it,
                        RETURN(rc);
        }
 
-       file->private_data = fd;
-       ll_readahead_init(inode, &fd->fd_ras);
-       fd->fd_omode = it->it_open_flags & (FMODE_READ | FMODE_WRITE |
-                                           FMODE_EXEC);
+       file->private_data = lfd;
+       ll_readahead_init(inode, &lfd->fd_ras);
+       lfd->fd_omode = it->it_open_flags & (FMODE_READ | FMODE_WRITE |
+                                            FMODE_EXEC);
 
        RETURN(0);
 }
@@ -850,7 +851,7 @@ int ll_file_open(struct inode *inode, struct file *file)
                                          .it_open_flags = file->f_flags };
        struct obd_client_handle **och_p = NULL;
        __u64 *och_usecount = NULL;
-       struct ll_file_data *fd;
+       struct ll_file_data *lfd;
        ktime_t kstart = ktime_get();
        int rc = 0;
 
@@ -872,17 +873,17 @@ int ll_file_open(struct inode *inode, struct file *file)
                }
        }
 
-       fd = ll_file_data_get();
-       if (fd == NULL)
+       lfd = ll_file_data_get();
+       if (lfd == NULL)
                GOTO(out_nofiledata, rc = -ENOMEM);
 
-       fd->fd_file = file;
+       lfd->fd_file = file;
        if (S_ISDIR(inode->i_mode))
-               ll_authorize_statahead(inode, fd);
+               ll_authorize_statahead(inode, lfd);
 
        ll_track_file_opens(inode);
        if (is_root_inode(inode)) {
-               file->private_data = fd;
+               file->private_data = lfd;
                RETURN(0);
        }
 
@@ -947,7 +948,7 @@ restart:
                }
                (*och_usecount)++;
 
-               rc = ll_local_open(file, it, fd, NULL);
+               rc = ll_local_open(file, it, lfd, NULL);
                if (rc) {
                        (*och_usecount)--;
                        mutex_unlock(&lli->lli_och_mutex);
@@ -1038,7 +1039,7 @@ restart:
                         "inode %px: disposition %x, status %d\n", inode,
                         it_disposition(it, ~0), it->it_status);
 
-               rc = ll_local_open(file, it, fd, *och_p);
+               rc = ll_local_open(file, it, lfd, *och_p);
                if (rc)
                        GOTO(out_och_free, rc);
        }
@@ -1052,7 +1053,7 @@ restart:
                        GOTO(out_och_free, rc);
        }
 
-       fd = NULL;
+       lfd = NULL;
 
        /* Must do this outside lli_och_mutex lock to prevent deadlock where
         * different kind of OPEN lock for this same inode gets cancelled by
@@ -1073,11 +1074,11 @@ out_och_free:
                mutex_unlock(&lli->lli_och_mutex);
 
 out_openerr:
-               if (lli->lli_opendir_key == fd)
-                       ll_deauthorize_statahead(inode, fd);
+               if (lli->lli_opendir_key == lfd)
+                       ll_deauthorize_statahead(inode, lfd);
 
-               if (fd != NULL)
-                       ll_file_data_put(fd);
+               if (lfd != NULL)
+                       ll_file_data_put(lfd);
        } else {
                ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_OPEN,
                                   ktime_us_delta(ktime_get(), kstart));
@@ -1130,7 +1131,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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct obd_client_handle **och_p;
        __u64 *och_usecount;
        int rc = 0;
@@ -1138,10 +1139,10 @@ static int ll_lease_och_acquire(struct inode *inode, struct file *file,
        ENTRY;
        /* Get the openhandle of the file */
        mutex_lock(&lli->lli_och_mutex);
-       if (fd->fd_lease_och != NULL)
+       if (lfd->fd_lease_och != NULL)
                GOTO(out_unlock, rc = -EBUSY);
 
-       if (fd->fd_och == NULL) {
+       if (lfd->fd_och == NULL) {
                if (file->f_mode & FMODE_WRITE) {
                        LASSERT(lli->lli_mds_write_och != NULL);
                        och_p = &lli->lli_mds_write_och;
@@ -1155,12 +1156,12 @@ static int ll_lease_och_acquire(struct inode *inode, struct file *file,
                if (*och_usecount > 1)
                        GOTO(out_unlock, rc = -EBUSY);
 
-               fd->fd_och = *och_p;
+               lfd->fd_och = *och_p;
                *och_usecount = 0;
                *och_p = NULL;
        }
 
-       *old_open_handle = fd->fd_och->och_open_handle;
+       *old_open_handle = lfd->fd_och->och_open_handle;
 
        EXIT;
 out_unlock:
@@ -1172,7 +1173,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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct obd_client_handle **och_p;
        struct obd_client_handle *old_och = NULL;
        __u64 *och_usecount;
@@ -1193,13 +1194,13 @@ static int ll_lease_och_release(struct inode *inode, struct file *file)
         * and close fd_och.
         */
        if (*och_p != NULL) {
-               old_och = fd->fd_och;
+               old_och = lfd->fd_och;
                (*och_usecount)++;
        } else {
-               *och_p = fd->fd_och;
+               *och_p = lfd->fd_och;
                *och_usecount = 1;
        }
-       fd->fd_och = NULL;
+       lfd->fd_och = NULL;
        mutex_unlock(&lli->lli_och_mutex);
 
        if (old_och != NULL)
@@ -1584,7 +1585,7 @@ int ll_merge_attr_try(const struct lu_env *env, struct inode *inode)
  */
 void ll_io_set_mirror(struct cl_io *io, const struct file *file)
 {
-       struct ll_file_data *fd = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
 
        /* clear layout version for generic(non-resync) I/O in case it carries
         * stale layout version due to I/O restart
@@ -1594,10 +1595,10 @@ void ll_io_set_mirror(struct cl_io *io, const struct file *file)
        /* FLR: disable non-delay for designated mirror I/O because obviously
         * only one mirror is available
         */
-       if (fd->fd_designated_mirror > 0) {
+       if (lfd->fd_designated_mirror > 0) {
                io->ci_ndelay = 0;
-               io->ci_designated_mirror = fd->fd_designated_mirror;
-               io->ci_layout_version = fd->fd_layout_version;
+               io->ci_designated_mirror = lfd->fd_designated_mirror;
+               io->ci_layout_version = lfd->fd_layout_version;
        }
 
        CDEBUG(D_VFSTRACE, "%s: desiginated mirror: %d\n",
@@ -1667,11 +1668,11 @@ 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  = file->private_data;
+       struct ll_file_data *lfd  = file->private_data;
        int flags = vvp_io_args_flags(file, args);
 
        io->u.ci_rw.crw_nonblock = file->f_flags & O_NONBLOCK;
-       io->ci_lock_no_expand = fd->ll_lock_no_expand;
+       io->ci_lock_no_expand = lfd->ll_lock_no_expand;
 
        if (iot == CIT_WRITE) {
                io->u.ci_wr.wr_append = iocb_ki_flags_check(flags, APPEND);
@@ -1800,7 +1801,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
                   loff_t *ppos, size_t bytes)
 {
        struct inode *inode = file_inode(file);
-       struct ll_file_data *fd  = file->private_data;
+       struct ll_file_data *lfd  = file->private_data;
        struct ll_inode_info *lli = ll_i2info(inode);
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        struct vvp_io *vio = vvp_env_io(env);
@@ -2030,15 +2031,15 @@ out:
                if (result > 0) {
                        ll_stats_ops_tally(ll_i2sbi(inode),
                                           LPROC_LL_WRITE_BYTES, result);
-                       fd->fd_write_failed = false;
+                       lfd->fd_write_failed = false;
                } else if (result == 0 && rc == 0) {
                        rc = io->ci_result;
                        if (rc < 0)
-                               fd->fd_write_failed = true;
+                               lfd->fd_write_failed = true;
                        else
-                               fd->fd_write_failed = false;
+                               lfd->fd_write_failed = false;
                } else if (rc != -ERESTARTSYS) {
-                       fd->fd_write_failed = true;
+                       lfd->fd_write_failed = true;
                }
        }
 
@@ -2959,7 +2960,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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct ll_grouplock grouplock;
        int rc;
 
@@ -2982,10 +2983,10 @@ retry:
                mutex_lock(&lli->lli_group_mutex);
        }
 
-       if (fd->fd_flags & LL_FILE_GROUP_LOCKED) {
+       if (lfd->fd_flags & LL_FILE_GROUP_LOCKED) {
                rc = -EINVAL;
                CWARN("%s: group lock already existed with gid %lu: rc = %d\n",
-                     ll_i2sbi(inode)->ll_fsname, fd->fd_grouplock.lg_gid, rc);
+                     ll_i2sbi(inode)->ll_fsname, lfd->fd_grouplock.lg_gid, rc);
                GOTO(out, rc);
        }
        if (arg != lli->lli_group_gid && lli->lli_group_users != 0) {
@@ -2995,7 +2996,7 @@ retry:
                wait_var_event(&lli->lli_group_users, !lli->lli_group_users);
                GOTO(retry, rc = 0);
        }
-       LASSERT(fd->fd_grouplock.lg_lock == NULL);
+       LASSERT(lfd->fd_grouplock.lg_lock == NULL);
 
        /*
         * XXX: group lock needs to protect all OST objects while PFL
@@ -3033,8 +3034,8 @@ retry:
        if (rc)
                GOTO(out, rc);
 
-       fd->fd_flags |= LL_FILE_GROUP_LOCKED;
-       fd->fd_grouplock = grouplock;
+       lfd->fd_flags |= LL_FILE_GROUP_LOCKED;
+       lfd->fd_grouplock = grouplock;
        if (lli->lli_group_users == 0)
                lli->lli_group_gid = grouplock.lg_gid;
        lli->lli_group_users++;
@@ -3050,32 +3051,32 @@ 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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct ll_grouplock grouplock;
        int rc;
 
        ENTRY;
        mutex_lock(&lli->lli_group_mutex);
-       if (!(fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
+       if (!(lfd->fd_flags & LL_FILE_GROUP_LOCKED)) {
                rc = -EINVAL;
                CWARN("%s: no group lock held: rc = %d\n",
                      ll_i2sbi(inode)->ll_fsname, rc);
                GOTO(out, rc);
        }
 
-       LASSERT(fd->fd_grouplock.lg_lock != NULL);
+       LASSERT(lfd->fd_grouplock.lg_lock != NULL);
 
-       if (fd->fd_grouplock.lg_gid != arg) {
+       if (lfd->fd_grouplock.lg_gid != arg) {
                rc = -EINVAL;
                CWARN("%s: group lock %lu not match current id %lu: rc = %d\n",
-                     ll_i2sbi(inode)->ll_fsname, arg, fd->fd_grouplock.lg_gid,
+                     ll_i2sbi(inode)->ll_fsname, arg, lfd->fd_grouplock.lg_gid,
                      rc);
                GOTO(out, rc);
        }
 
-       grouplock = fd->fd_grouplock;
-       memset(&fd->fd_grouplock, 0, sizeof(fd->fd_grouplock));
-       fd->fd_flags &= ~LL_FILE_GROUP_LOCKED;
+       grouplock = lfd->fd_grouplock;
+       memset(&lfd->fd_grouplock, 0, sizeof(lfd->fd_grouplock));
+       lfd->fd_flags &= ~LL_FILE_GROUP_LOCKED;
 
        cl_put_grouplock(&grouplock);
 
@@ -4021,9 +4022,9 @@ 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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
 
-       fd->ll_lock_no_expand = !(flags & LF_UNSET);
+       lfd->ll_lock_no_expand = !(flags & LF_UNSET);
 
        return 0;
 }
@@ -4206,7 +4207,7 @@ static long ll_file_unlock_lease(struct file *file, struct ll_ioc_lease *ioc,
                                 void __user *uarg)
 {
        struct inode *inode = file_inode(file);
-       struct ll_file_data *fd = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct ll_inode_info *lli = ll_i2info(inode);
        struct obd_client_handle *och = NULL;
        struct split_param sp;
@@ -4223,9 +4224,9 @@ static long ll_file_unlock_lease(struct file *file, struct ll_ioc_lease *ioc,
 
        ENTRY;
        mutex_lock(&lli->lli_och_mutex);
-       if (fd->fd_lease_och != NULL) {
-               och = fd->fd_lease_och;
-               fd->fd_lease_och = NULL;
+       if (lfd->fd_lease_och != NULL) {
+               och = lfd->fd_lease_och;
+               lfd->fd_lease_och = NULL;
        }
        mutex_unlock(&lli->lli_och_mutex);
 
@@ -4354,7 +4355,7 @@ out:
                                               attached);
        }
 
-       ll_layout_refresh(inode, &fd->fd_layout_version);
+       ll_layout_refresh(inode, &lfd->fd_layout_version);
 
        if (!rc)
                rc = ll_lease_type_from_fmode(fmode);
@@ -4366,7 +4367,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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct obd_client_handle *och = NULL;
        __u64 open_flags = 0;
        bool lease_broken;
@@ -4406,7 +4407,7 @@ static long ll_file_set_lease(struct file *file, struct ll_ioc_lease *ioc,
                        ll_lease_close(och, inode, NULL);
                        RETURN(rc);
                }
-               rc = ll_layout_refresh(inode, &fd->fd_layout_version);
+               rc = ll_layout_refresh(inode, &lfd->fd_layout_version);
                if (rc) {
                        ll_lease_close(och, inode, NULL);
                        RETURN(rc);
@@ -4415,8 +4416,8 @@ static long ll_file_set_lease(struct file *file, struct ll_ioc_lease *ioc,
 
        rc = 0;
        mutex_lock(&lli->lli_och_mutex);
-       if (fd->fd_lease_och == NULL) {
-               fd->fd_lease_och = och;
+       if (lfd->fd_lease_och == NULL) {
+               lfd->fd_lease_och = och;
                och = NULL;
        }
        mutex_unlock(&lli->lli_och_mutex);
@@ -4467,7 +4468,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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        void __user *uarg = (void __user *)arg;
        int flags, rc;
@@ -4487,7 +4488,7 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        switch (cmd) {
        case LL_IOC_GETFLAGS:
                /* Get the current value of the file flags */
-               return put_user(fd->fd_flags, (int __user *)arg);
+               return put_user(lfd->fd_flags, (int __user *)arg);
        case LL_IOC_SETFLAGS:
        case LL_IOC_CLRFLAGS:
                /* Set or clear specific file flags */
@@ -4511,9 +4512,9 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                                RETURN(rc);
                        }
 
-                       fd->fd_flags |= flags;
+                       lfd->fd_flags |= flags;
                } else {
-                       fd->fd_flags &= ~flags;
+                       lfd->fd_flags &= ~flags;
                }
                RETURN(0);
        case LL_IOC_LOV_SETSTRIPE:
@@ -4564,9 +4565,9 @@ ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
                        lli = ll_i2info(inode);
                        mutex_lock(&lli->lli_och_mutex);
-                       if (fd->fd_lease_och != NULL) {
-                               och = fd->fd_lease_och;
-                               fd->fd_lease_och = NULL;
+                       if (lfd->fd_lease_och != NULL) {
+                               och = lfd->fd_lease_och;
+                               lfd->fd_lease_och = NULL;
                        }
                        mutex_unlock(&lli->lli_och_mutex);
                        if (och == NULL)
@@ -4712,8 +4713,8 @@ skip_copy:
                fmode_t fmode = 0;
 
                mutex_lock(&lli->lli_och_mutex);
-               if (fd->fd_lease_och != NULL) {
-                       struct obd_client_handle *och = fd->fd_lease_och;
+               if (lfd->fd_lease_och != NULL) {
+                       struct obd_client_handle *och = lfd->fd_lease_och;
 
                        lock = ldlm_handle2lock(&och->och_lease_handle);
                        if (lock != NULL) {
@@ -4837,7 +4838,7 @@ out_ladvise:
                if (!(file->f_flags & O_DIRECT))
                        RETURN(-EINVAL);
 
-               fd->fd_designated_mirror = arg;
+               lfd->fd_designated_mirror = arg;
                RETURN(0);
        }
        case LL_IOC_HEAT_GET: {
@@ -5062,7 +5063,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 = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        int rc, err;
 
        LASSERT(!S_ISDIR(inode->i_mode));
@@ -5081,7 +5082,7 @@ static int ll_flush(struct file *file, fl_owner_t id)
        /* The application has been told write failure already.
         * Do not report failure again.
         */
-       if (fd->fd_write_failed)
+       if (lfd->fd_write_failed)
                return 0;
        return rc ? -EIO : 0;
 }
@@ -5193,7 +5194,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
        }
 
        if (S_ISREG(inode->i_mode)) {
-               struct ll_file_data *fd = file->private_data;
+               struct ll_file_data *lfd = file->private_data;
                bool cached;
 
                /* Sync metadata on MDT first, and then sync the cached data
@@ -5206,9 +5207,9 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
                if (rc == 0 && err < 0)
                        rc = err;
                if (rc < 0)
-                       fd->fd_write_failed = true;
+                       lfd->fd_write_failed = true;
                else
-                       fd->fd_write_failed = false;
+                       lfd->fd_write_failed = false;
        }
 
        if (!rc)
@@ -5595,7 +5596,7 @@ out_iput:
 static int
 ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)
 {
-       struct ll_file_data *fd = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
 
        ENTRY;
        /*
@@ -5603,8 +5604,8 @@ ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)
         * for one file. And the entire message rate on the client is limited
         * by CDEBUG_LIMIT too.
         */
-       if (!(fd->fd_flags & LL_FILE_FLOCK_WARNING)) {
-               fd->fd_flags |= LL_FILE_FLOCK_WARNING;
+       if (!(lfd->fd_flags & LL_FILE_FLOCK_WARNING)) {
+               lfd->fd_flags |= LL_FILE_FLOCK_WARNING;
                CDEBUG_LIMIT(D_CONSOLE,
                             "flock disabled, mount with '-o [local]flock' to enable\r\n");
        }
index 0d97675..061cb76 100644 (file)
@@ -2359,9 +2359,9 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr,
        }
 
        if (attr->ia_valid & ATTR_FILE) {
-               struct ll_file_data *fd = attr->ia_file->private_data;
+               struct ll_file_data *lfd = attr->ia_file->private_data;
 
-               if (fd->fd_lease_och)
+               if (lfd->fd_lease_och)
                        op_data->op_bias |= MDS_TRUNC_KEEP_LEASE;
        }
 
index a40920f..a4e2cf5 100644 (file)
@@ -132,13 +132,13 @@ 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 = file->private_data;
+               struct ll_file_data *lfd = file->private_data;
 
                LASSERT(vio->vui_cl.cis_io == io);
 
                /* mmap lock must be MANDATORY it has to cache pages. */
                io->ci_lockreq = CILR_MANDATORY;
-               vio->vui_fd = fd;
+               vio->vui_fd = lfd;
        } else {
                cl_io_fini(env, io);
                if (io->ci_need_restart)
index 956bad6..7d2b3a4 100644 (file)
@@ -2928,7 +2928,7 @@ static ssize_t ll_rw_extents_stats_seq_write(struct file *file,
 LDEBUGFS_SEQ_FOPS(ll_rw_extents_stats);
 
 void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
-                      struct ll_file_data *file, loff_t pos,
+                      struct ll_file_data *lfd, loff_t pos,
                       size_t count, int rw)
 {
        int i, cur = -1;
@@ -2987,13 +2987,13 @@ void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
        /* Offset statistics */
        for (i = 0; i < LL_PROCESS_HIST_MAX; i++) {
                if (process[i].rw_pid == pid) {
-                       if (process[i].rw_last_file != file) {
+                       if (process[i].rw_last_file != lfd) {
                                process[i].rw_range_start = pos;
                                process[i].rw_last_file_pos = pos + count;
                                process[i].rw_smallest_extent = count;
                                process[i].rw_largest_extent = count;
                                process[i].rw_offset = 0;
-                               process[i].rw_last_file = file;
+                               process[i].rw_last_file = lfd;
                                goto out_unlock;
                        }
                        if (process[i].rw_last_file_pos != pos) {
@@ -3034,7 +3034,7 @@ void ll_rw_stats_tally(struct ll_sb_info *sbi, pid_t pid,
        process[*process_count].rw_smallest_extent = count;
        process[*process_count].rw_largest_extent = count;
        process[*process_count].rw_offset = 0;
-       process[*process_count].rw_last_file = file;
+       process[*process_count].rw_last_file = lfd;
 
 out_unlock:
        spin_unlock(&sbi->ll_process_lock);
index a5a1207..5c118af 100644 (file)
@@ -2171,7 +2171,6 @@ void pcc_layout_invalidate(struct inode *inode)
        struct pcc_inode *pcci;
 
        ENTRY;
-
        pcc_inode_lock(inode);
        pcci = ll_i2pcci(inode);
        if (pcci && pcc_inode_has_layout(pcci)) {
@@ -2455,7 +2454,6 @@ ssize_t pcc_file_read_iter(struct kiocb *iocb,
        ssize_t result;
 
        ENTRY;
-
        file->f_ra.ra_pages = 0;
        if (pccf->pccf_file == NULL) {
                *cached = false;
@@ -2526,7 +2524,6 @@ ssize_t pcc_file_write_iter(struct kiocb *iocb,
        ssize_t result;
 
        ENTRY;
-
        if (pccf->pccf_file == NULL) {
                *cached = false;
                RETURN(0);
@@ -2666,7 +2663,6 @@ ssize_t pcc_file_splice_read(struct file *in_file, loff_t *ppos,
        ssize_t result;
 
        ENTRY;
-
        in_file->f_ra.ra_pages = 0;
        if (!pcc_file)
                RETURN(default_file_splice_read(in_file, ppos, pipe,
@@ -2693,7 +2689,6 @@ int pcc_fsync(struct file *file, loff_t start, loff_t end,
        int rc;
 
        ENTRY;
-
        if (!pcc_file) {
                *cached = false;
                RETURN(0);
@@ -2826,7 +2821,7 @@ static int pcc_mmap_pages_convert(struct inode *inode,
 #ifdef HAVE_ADD_TO_PAGE_CACHE_LOCKED
        struct folio_batch fbatch;
        pgoff_t index = 0;
-       unsigned nr;
+       unsigned int nr;
        int rc = 0;
 
        ll_folio_batch_init(&fbatch, 0);
@@ -2944,7 +2939,6 @@ int pcc_file_mmap(struct file *file, struct vm_area_struct *vma,
        int rc = 0;
 
        ENTRY;
-
        /* With PCC, the files are cached in an unusual way, then we do some
         * special magic with mmap to allow Lustre and PCC to share the page
         * mapping, and the @ra_pages may set with the backing device of PCC
@@ -3034,7 +3028,6 @@ void pcc_vm_open(struct vm_area_struct *vma)
        struct inode *inode;
 
        ENTRY;
-
        if (!pccv)
                RETURN_EXIT;
 
@@ -3061,7 +3054,6 @@ void pcc_vm_close(struct vm_area_struct *vma)
        struct inode *inode;
 
        ENTRY;
-
        if (!pccv)
                RETURN_EXIT;
 
@@ -3098,7 +3090,6 @@ int pcc_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf,
        int rc;
 
        ENTRY;
-
        if (!pccv || !pccv->pccv_vm_ops) {
                *cached = false;
                RETURN(0);
@@ -3187,7 +3178,6 @@ int pcc_fault(struct vm_area_struct *vma, struct vm_fault *vmf,
        int rc;
 
        ENTRY;
-
        if (!pccv) {
                *cached = false;
                RETURN(0);
@@ -4163,7 +4153,6 @@ int pcc_ioctl_state(struct file *file, struct inode *inode,
        struct pcc_inode *pcci;
 
        ENTRY;
-
        if (buf_len <= 0)
                RETURN(-EINVAL);
 
index d315775..57aa58f 100644 (file)
@@ -598,7 +598,7 @@ static void ll_readahead_handle_work(struct work_struct *wq)
        __u16 refcheck;
        struct ra_io_arg *ria;
        struct inode *inode;
-       struct ll_file_data *fd;
+       struct ll_file_data *lfd;
        struct ll_readahead_state *ras;
        struct cl_io *io;
        struct cl_2queue *queue;
@@ -613,8 +613,8 @@ static void ll_readahead_handle_work(struct work_struct *wq)
 
        work = container_of(wq, struct ll_readahead_work,
                            lrw_readahead_work);
-       fd = work->lrw_file->private_data;
-       ras = &fd->fd_ras;
+       lfd = work->lrw_file->private_data;
+       ras = &lfd->fd_ras;
        file = work->lrw_file;
        inode = file_inode(file);
        sbi = ll_i2sbi(inode);
@@ -682,7 +682,7 @@ static void ll_readahead_handle_work(struct work_struct *wq)
        memcpy(&lli->lli_jobinfo, &work->lrw_jobinfo, sizeof(lli->lli_jobinfo));
        write_sequnlock(&lli->lli_jobinfo_seqlock);
 
-       vvp_env_io(env)->vui_fd = fd;
+       vvp_env_io(env)->vui_fd = lfd;
        io->ci_state = CIS_LOCKED;
        io->ci_async_readahead = true;
        rc = cl_io_start(env, io);
@@ -1249,8 +1249,8 @@ static void ras_detect_read_pattern(struct ll_readahead_state *ras,
 
 void ll_ras_enter(struct file *f, loff_t pos, size_t bytes)
 {
-       struct ll_file_data *fd = f->private_data;
-       struct ll_readahead_state *ras = &fd->fd_ras;
+       struct ll_file_data *lfd = f->private_data;
+       struct ll_readahead_state *ras = &lfd->fd_ras;
        struct inode *inode = file_inode(f);
        struct ll_sb_info *sbi = ll_i2sbi(inode);
 
@@ -1683,7 +1683,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     = NULL;
+       struct ll_file_data       *lfd    = NULL;
        struct ll_readahead_state *ras    = NULL;
        struct cl_2queue          *queue  = &io->ci_queue;
        struct cl_sync_io         *anchor = NULL;
@@ -1699,8 +1699,8 @@ int ll_io_read_page(const struct lu_env *env, struct cl_io *io,
        ENTRY;
 
        if (file) {
-               fd = file->private_data;
-               ras = &fd->fd_ras;
+               lfd = file->private_data;
+               ras = &lfd->fd_ras;
        }
 
        /* PagePrivate2 is set in ll_io_zero_page() to tell us the vmpage
@@ -1818,8 +1818,8 @@ 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 = file->private_data;
-       struct ll_readahead_state *ras = &fd->fd_ras;
+       struct ll_file_data *lfd = file->private_data;
+       struct ll_readahead_state *ras = &lfd->fd_ras;
        struct ll_ra_info *ra = &sbi->ll_ra_info;
        unsigned long throttle;
        pgoff_t start_idx = ras_align(ras, ras->ras_next_readahead_idx);
@@ -1984,8 +1984,8 @@ 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 = file->private_data;
-               struct ll_readahead_state *ras = &fd->fd_ras;
+               struct ll_file_data *lfd = file->private_data;
+               struct ll_readahead_state *ras = &lfd->fd_ras;
                struct lu_env  *local_env = NULL;
 
                CDEBUG(D_VFSTRACE, "fast read pgno: %ld\n", vmpage->index);
index 066b021..4f9bbd7 100644 (file)
@@ -1660,8 +1660,8 @@ void ll_authorize_statahead(struct inode *dir, void *key)
 static void ll_deauthorize_statahead_advise(struct inode *dir, void *key)
 {
        struct ll_inode_info *lli = ll_i2info(dir);
-       struct ll_file_data *fd = (struct ll_file_data *)key;
-       struct ll_statahead_info *sai = fd->fd_sai;
+       struct ll_file_data *lfd = (struct ll_file_data *)key;
+       struct ll_statahead_info *sai = lfd->fd_sai;
 
        if (sai == NULL)
                return;
@@ -1674,7 +1674,7 @@ static void ll_deauthorize_statahead_advise(struct inode *dir, void *key)
                smp_store_release(&sai->sai_task, NULL);
                wake_up_process(task);
        }
-       fd->fd_sai = NULL;
+       lfd->fd_sai = NULL;
        spin_unlock(&lli->lli_sa_lock);
        ll_sai_put(sai);
        LASSERT(lli->lli_sax != NULL);
@@ -2543,7 +2543,7 @@ int ll_revalidate_statahead(struct inode *dir, struct dentry **dentryp,
 int ll_ioctl_ahead(struct file *file, struct llapi_lu_ladvise2 *ladvise)
 {
        int node = cfs_cpt_spread_node(cfs_cpt_tab, CFS_CPT_ANY);
-       struct ll_file_data *fd = file->private_data;
+       struct ll_file_data *lfd = file->private_data;
        struct dentry *dentry = file_dentry(file);
        struct inode *dir = dentry->d_inode;
        struct ll_inode_info *lli = ll_i2info(dir);
@@ -2562,7 +2562,7 @@ int ll_ioctl_ahead(struct file *file, struct llapi_lu_ladvise2 *ladvise)
        if (!S_ISDIR(dir->i_mode))
                RETURN(-EINVAL);
 
-       if (fd->fd_sai) {
+       if (lfd->fd_sai) {
                rc = -EALREADY;
                CWARN("%s: already set statahead hint for dir %pd: rc = %d\n",
                      sbi->ll_fsname, dentry, rc);
@@ -2602,7 +2602,7 @@ int ll_ioctl_ahead(struct file *file, struct llapi_lu_ladvise2 *ladvise)
                                lli->lli_sa_pattern = LSA_PATTERN_ADVISE;
                                ctx = lli->lli_sax;
                                __ll_sax_get(ctx);
-                               fd->fd_sai = __ll_sai_get(sai);
+                               lfd->fd_sai = __ll_sai_get(sai);
                                rc = 0;
                        } else {
                                rc = -EINVAL;
@@ -2617,7 +2617,7 @@ int ll_ioctl_ahead(struct file *file, struct llapi_lu_ladvise2 *ladvise)
                } else {
                        lli->lli_sa_pattern = LSA_PATTERN_ADVISE;
                        lli->lli_sax = ctx;
-                       fd->fd_sai = __ll_sai_get(sai);
+                       lfd->fd_sai = __ll_sai_get(sai);
                        spin_unlock(&lli->lli_sa_lock);
                }
        } else {
@@ -2629,7 +2629,7 @@ int ll_ioctl_ahead(struct file *file, struct llapi_lu_ladvise2 *ladvise)
                }
 
                lli->lli_sa_pattern = LSA_PATTERN_ADVISE;
-               fd->fd_sai = __ll_sai_get(sai);
+               lfd->fd_sai = __ll_sai_get(sai);
                spin_unlock(&lli->lli_sa_lock);
        }
 
@@ -2656,10 +2656,10 @@ int ll_ioctl_ahead(struct file *file, struct llapi_lu_ladvise2 *ladvise)
 
        RETURN(0);
 out:
-       if (fd->fd_sai) {
+       if (lfd->fd_sai) {
                ll_sai_put(sai);
                ll_sax_put(dir, ctx);
-               fd->fd_sai = NULL;
+               lfd->fd_sai = NULL;
        }
 
        if (sai)