From patchwork Mon Sep 30 18:55:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11167089 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 388BF16B1 for ; Mon, 30 Sep 2019 18:58:27 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 20932224D5 for ; Mon, 30 Sep 2019 18:58:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20932224D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lustre-devel-bounces@lists.lustre.org Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 1CBF95C3CFD; Mon, 30 Sep 2019 11:57:47 -0700 (PDT) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp4.ccs.ornl.gov (smtp4.ccs.ornl.gov [160.91.203.40]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 46C0F5C3B00 for ; Mon, 30 Sep 2019 11:57:19 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp4.ccs.ornl.gov (Postfix) with ESMTP id 00C5C10058DB; Mon, 30 Sep 2019 14:56:57 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id F26D4BD; Mon, 30 Sep 2019 14:56:56 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Mon, 30 Sep 2019 14:55:25 -0400 Message-Id: <1569869810-23848-67-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> References: <1569869810-23848-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 066/151] lustre: clio: no glimpse for data immutable file X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Jinshan Xiong When merging a layout to an existing file as a mirror, client will report the size and blocks to the MDT, which will be set to the MDT object. In that case, if the MDT discovers a mirrored file in READ_ONLY state, it will report the size and blocks. Clients should take this advantage and skip glimpse. WC-bug-id: https://jira.whamcloud.com/browse/LU-9771 Lustre-commit: ce61bcac8661 ("LU-9771 clio: no glimpse for data immutable file") Signed-off-by: Jinshan Xiong Reviewed-on: https://review.whamcloud.com/29084 Reviewed-by: Fan Yong Reviewed-by: Bobi Jam Signed-off-by: James Simmons --- fs/lustre/llite/file.c | 5 +++++ fs/lustre/lov/lov_io.c | 22 ++++++++++++++++------ include/uapi/linux/lustre/lustre_idl.h | 1 + include/uapi/linux/lustre/lustre_user.h | 11 +++++++++++ 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c index e1f264d..6f991ed 100644 --- a/fs/lustre/llite/file.c +++ b/fs/lustre/llite/file.c @@ -148,6 +148,11 @@ static int ll_close_inode_openhandle(struct inode *inode, ll_prepare_close(inode, op_data, och); switch (bias) { case MDS_CLOSE_LAYOUT_MERGE: + /* merge blocks from the victim inode */ + op_data->op_attr_blocks += ((struct inode *)data)->i_blocks; + op_data->op_attr.ia_valid |= ATTR_SIZE; + op_data->op_xvalid |= OP_XVALID_BLOCKS; + /* fallthrough */ case MDS_CLOSE_LAYOUT_SWAP: LASSERT(data); op_data->op_bias |= bias; diff --git a/fs/lustre/lov/lov_io.c b/fs/lustre/lov/lov_io.c index 1415702..c3fd86a 100644 --- a/fs/lustre/lov/lov_io.c +++ b/fs/lustre/lov/lov_io.c @@ -257,6 +257,13 @@ static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj, } case CIT_GLIMPSE: + lio->lis_pos = 0; + lio->lis_endpos = OBD_OBJECT_EOF; + + if ((obj->lo_lsm->lsm_flags & LCM_FL_FLR_MASK) == LCM_FL_RDONLY) + return 1; /* SoM is accurate, no need glimpse */ + break; + case CIT_MISC: lio->lis_pos = 0; lio->lis_endpos = OBD_OBJECT_EOF; @@ -1068,18 +1075,21 @@ int lov_io_init_composite(const struct lu_env *env, struct cl_object *obj, { struct lov_io *lio = lov_env_io(env); struct lov_object *lov = cl2lov(obj); + int result; INIT_LIST_HEAD(&lio->lis_active); - io->ci_result = lov_io_slice_init(lio, lov, io); - if (io->ci_result) - return io->ci_result; + result = lov_io_slice_init(lio, lov, io); + if (result) + goto out; - io->ci_result = lov_io_subio_init(env, lio, io); - if (io->ci_result == 0) { + result = lov_io_subio_init(env, lio, io); + if (!result) { cl_io_slice_add(io, &lio->lis_cl, obj, &lov_io_ops); atomic_inc(&lov->lo_active_ios); } - return io->ci_result; +out: + io->ci_result = result < 0 ? result : 0; + return result; } int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj, diff --git a/include/uapi/linux/lustre/lustre_idl.h b/include/uapi/linux/lustre/lustre_idl.h index 131f1c9..951d501 100644 --- a/include/uapi/linux/lustre/lustre_idl.h +++ b/include/uapi/linux/lustre/lustre_idl.h @@ -1015,6 +1015,7 @@ struct lov_mds_md_v1 { /* LOV EA mds/wire data (little-endian) */ #define XATTR_SECURITY_PREFIX "security." #define XATTR_LUSTRE_PREFIX "lustre." +#define XATTR_NAME_SOM "trusted.som" #define XATTR_NAME_LOV "trusted.lov" #define XATTR_NAME_LMA "trusted.lma" #define XATTR_NAME_LMV "trusted.lmv" diff --git a/include/uapi/linux/lustre/lustre_user.h b/include/uapi/linux/lustre/lustre_user.h index 34c86df..7d9f0d2 100644 --- a/include/uapi/linux/lustre/lustre_user.h +++ b/include/uapi/linux/lustre/lustre_user.h @@ -201,6 +201,17 @@ struct lustre_mdt_attrs { */ #define LMA_OLD_SIZE (sizeof(struct lustre_mdt_attrs) + 5 * sizeof(__u64)) +enum { + LSOM_FL_VALID = 1 << 0, +}; + +struct lustre_som_attrs { + __u16 lsa_valid; + __u16 lsa_reserved[3]; + __u64 lsa_size; + __u64 lsa_blocks; +}; + /** * OST object IDentifier. */