@@ -2465,11 +2465,6 @@ int cl_io_lru_reserve(const struct lu_env *env, struct cl_io *io,
int cl_io_read_ahead(const struct lu_env *env, struct cl_io *io,
pgoff_t start, struct cl_read_ahead *ra);
-static inline int cl_io_is_fault_writable(const struct cl_io *io)
-{
- return io->ci_type == CIT_FAULT && io->u.ci_fault.ft_writable;
-}
-
/**
* True, if @io is an O_APPEND write(2).
*/
@@ -83,11 +83,13 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,
* @vma virtual memory area addressed to page fault
* @env corespondent lu_env to processing
* @index page index corespondent to fault.
+ * @mkwrite whether it is mmap write.
*
* RETURN error codes from cl_io_init.
*/
static struct cl_io *
-ll_fault_io_init(struct lu_env *env, struct vm_area_struct *vma, pgoff_t index)
+ll_fault_io_init(struct lu_env *env, struct vm_area_struct *vma,
+ pgoff_t index, bool mkwrite)
{
struct file *file = vma->vm_file;
struct inode *inode = file_inode(file);
@@ -107,6 +109,11 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,
fio->ft_index = index;
fio->ft_executable = vma->vm_flags & VM_EXEC;
+ if (mkwrite) {
+ fio->ft_mkwrite = 1;
+ fio->ft_writable = 1;
+ }
+
CDEBUG(D_MMAP,
DFID": vma=%p start=%#lx end=%#lx vm_flags=%#lx idx=%lu\n",
PFID(&ll_i2info(inode)->lli_fid), vma, vma->vm_start,
@@ -117,9 +124,6 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr,
else if (vma->vm_flags & VM_RAND_READ)
io->ci_rand_read = 1;
- if (vma->vm_flags & VM_WRITE)
- fio->ft_writable = 1;
-
rc = cl_io_init(env, io, CIT_FAULT, io->ci_obj);
if (rc == 0) {
struct vvp_io *vio = vvp_env_io(env);
@@ -157,7 +161,7 @@ static int __ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage,
if (IS_ERR(env))
return PTR_ERR(env);
- io = ll_fault_io_init(env, vma, vmpage->index);
+ io = ll_fault_io_init(env, vma, vmpage->index, true);
if (IS_ERR(io)) {
result = PTR_ERR(io);
goto out;
@@ -167,9 +171,6 @@ static int __ll_page_mkwrite(struct vm_area_struct *vma, struct page *vmpage,
if (result < 0)
goto out_io;
- io->u.ci_fault.ft_mkwrite = 1;
- io->u.ci_fault.ft_writable = 1;
-
vio = vvp_env_io(env);
vio->u.fault.ft_vma = vma;
vio->u.fault.ft_vmpage = vmpage;
@@ -309,7 +310,7 @@ static vm_fault_t __ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
fault_ret = 0;
}
- io = ll_fault_io_init(env, vma, vmf->pgoff);
+ io = ll_fault_io_init(env, vma, vmf->pgoff, false);
if (IS_ERR(io)) {
fault_ret = to_fault_error(PTR_ERR(io));
goto out;
@@ -363,8 +363,7 @@ static void vvp_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
io->ci_need_write_intent = 0;
LASSERT(io->ci_type == CIT_WRITE || cl_io_is_fallocate(io) ||
- cl_io_is_trunc(io) || cl_io_is_mkwrite(io) ||
- cl_io_is_fault_writable(io));
+ cl_io_is_trunc(io) || cl_io_is_mkwrite(io));
CDEBUG(D_VFSTRACE, DFID" write layout, type %u " DEXT "\n",
PFID(lu_object_fid(&obj->co_lu)), io->ci_type,
@@ -222,8 +222,7 @@ static int lov_io_mirror_write_intent(struct lov_io *lio,
io->ci_need_write_intent = 0;
if (!(io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io) ||
- cl_io_is_fallocate(io) || cl_io_is_trunc(io) ||
- cl_io_is_fault_writable(io)))
+ cl_io_is_fallocate(io) || cl_io_is_trunc(io)))
return 0;
/* FLR: check if it needs to send a write intent RPC to server.
@@ -575,8 +574,7 @@ static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj,
/* check if it needs to instantiate layout */
if (!(io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io) ||
cl_io_is_fallocate(io) ||
- (cl_io_is_trunc(io) && io->u.ci_setattr.sa_attr.lvb_size > 0)) ||
- cl_io_is_fault_writable(io)) {
+ (cl_io_is_trunc(io) && io->u.ci_setattr.sa_attr.lvb_size > 0))) {
result = 0;
goto out;
}