Whamcloud - gitweb
LU-13669 llite: make readahead aware of hints
[fs/lustre-release.git] / lustre / llite / file.c
index 675a5a1..2e0ca9e 100644 (file)
@@ -730,6 +730,8 @@ static int ll_local_open(struct file *file, struct lookup_intent *it,
        file->private_data = fd;
        ll_readahead_init(inode, &fd->fd_ras);
        fd->fd_omode = it->it_flags & (FMODE_READ | FMODE_WRITE | FMODE_EXEC);
+       /* turn off the kernel's read-ahead */
+       file->f_ra.ra_pages = 0;
 
        /* ll_cl_context initialize */
        rwlock_init(&fd->fd_lock);
@@ -930,9 +932,6 @@ restart:
 
        mutex_unlock(&lli->lli_och_mutex);
 
-       /* lockless for direct IO so that it can do IO in parallel */
-       if (file->f_flags & O_DIRECT)
-               fd->fd_flags |= LL_FILE_LOCKLESS_IO;
        fd = NULL;
 
        /* Must do this outside lli_och_mutex lock to prevent deadlock where
@@ -1548,7 +1547,7 @@ ll_file_io_generic(const struct lu_env *env, struct vvp_io_args *args,
        struct cl_io *io;
        ssize_t result = 0;
        int rc = 0;
-       unsigned int retried = 0, ignore_lockless = 0;
+       unsigned int retried = 0, dio_lock = 0;
        bool is_aio = false;
        struct cl_dio_aio *ci_aio = NULL;
 
@@ -1571,7 +1570,7 @@ restart:
        io = vvp_env_thread_io(env);
        ll_io_init(io, file, iot, args);
        io->ci_aio = ci_aio;
-       io->ci_ignore_lockless = ignore_lockless;
+       io->ci_dio_lock = dio_lock;
        io->ci_ndelay_tried = retried;
 
        if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) {
@@ -1650,7 +1649,7 @@ out:
                       *ppos, count, result, rc);
                /* preserve the tried count for FLR */
                retried = io->ci_ndelay_tried;
-               ignore_lockless = io->ci_ignore_lockless;
+               dio_lock = io->ci_dio_lock;
                goto restart;
        }
 
@@ -4824,7 +4823,7 @@ static int ll_merge_md_attr(struct inode *inode)
                RETURN(0);
 
        down_read(&lli->lli_lsm_sem);
-       rc = md_merge_attr(ll_i2mdexp(inode), &lli->lli_fid, lli->lli_lsm_md,
+       rc = md_merge_attr(ll_i2mdexp(inode), ll_i2info(inode)->lli_lsm_md,
                           &attr, ll_md_blocking_ast);
        up_read(&lli->lli_lsm_sem);
        if (rc != 0)
@@ -5086,6 +5085,14 @@ long ll_fallocate(struct file *filp, int mode, loff_t offset, loff_t len)
        ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_FALLOCATE, 1);
 
        rc = cl_falloc(inode, mode, offset, len);
+       /*
+        * ENOTSUPP (524) is an NFSv3 specific error code erroneously
+        * used by Lustre in several places. Retuning it here would
+        * confuse applications that explicity test for EOPNOTSUPP
+        * (95) and fall back to ftruncate().
+        */
+       if (rc == -ENOTSUPP)
+               rc = -EOPNOTSUPP;
 
        RETURN(rc);
 }
@@ -5116,6 +5123,15 @@ static int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
 
        rc = ll_do_fiemap(inode, fiemap, num_bytes);
 
+       if (IS_ENCRYPTED(inode)) {
+               int i;
+
+               for (i = 0; i < fiemap->fm_mapped_extents; i++)
+                       fiemap->fm_extents[i].fe_flags |=
+                               FIEMAP_EXTENT_DATA_ENCRYPTED |
+                               FIEMAP_EXTENT_ENCODED;
+       }
+
        fieinfo->fi_flags = fiemap->fm_flags;
        fieinfo->fi_extents_mapped = fiemap->fm_mapped_extents;
        if (extent_count > 0 &&