From patchwork Thu Feb 27 21:15:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 11410449 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 B267692A for ; Thu, 27 Feb 2020 21:38:45 +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 98C0F24690 for ; Thu, 27 Feb 2020 21:38:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98C0F24690 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 45C1D34A43D; Thu, 27 Feb 2020 13:31:40 -0800 (PST) X-Original-To: lustre-devel@lists.lustre.org Delivered-To: lustre-devel-lustre.org@pdx1-mailman02.dreamhost.com Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 188AB21CBAC for ; Thu, 27 Feb 2020 13:20:40 -0800 (PST) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 9E79A9160; Thu, 27 Feb 2020 16:18:18 -0500 (EST) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 9D2A147C; Thu, 27 Feb 2020 16:18:18 -0500 (EST) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Thu, 27 Feb 2020 16:15:23 -0500 Message-Id: <1582838290-17243-456-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> References: <1582838290-17243-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 455/622] lustre: dom: manual OST-to-DOM migration via mirroring 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: Mikhail Pershin , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Mikhail Pershin Allow DOM mirroring, update LOV/LOD code to check not just first component for DOM pattern but cycle through all mirrors if any. Sanity checks allows one DOM component in a mirror and it should be the first one. Multiple DOM components are allowed only with the same for now. Do OST file migration to MDT by using FLR. That can't be done by layout swapping, because MDT data will be tied to temporary volatile file but we want to keep data with the original file. The mirroring allows that with the following steps: - extent layout with new mirror on MDT, no data is copied but new mirror stays in 'stale' state. The reason is the same problem with volatile file. - resync mirrors, now new DOM layout is filled with data. - remove first mirror WC-bug-id: https://jira.whamcloud.com/browse/LU-11421 Lustre-commit: 44a721b8c106 ("LU-11421 dom: manual OST-to-DOM migration via mirroring") Signed-off-by: Mikhail Pershin Reviewed-on: https://review.whamcloud.com/35359 Reviewed-by: Andreas Dilger Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- fs/lustre/lov/lov_object.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/fs/lustre/lov/lov_object.c b/fs/lustre/lov/lov_object.c index 52d8c30..5c4d8f9 100644 --- a/fs/lustre/lov/lov_object.c +++ b/fs/lustre/lov/lov_object.c @@ -543,7 +543,13 @@ static int lov_init_dom(const struct lu_env *env, struct lov_device *dev, u32 idx = 0; int rc; - LASSERT(index == 0); + /* DOM entry may be not zero index due to FLR but must start from 0 */ + if (unlikely(lle->lle_extent->e_start != 0)) { + CERROR("%s: DOM entry must be the first stripe in a mirror\n", + lov2obd(dev->ld_lov)->obd_name); + dump_lsm(D_ERROR, lov->lo_lsm); + return -EINVAL; + } /* find proper MDS device */ rc = lov_fld_lookup(dev, fid, &idx); @@ -636,6 +642,7 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, int result = 0; unsigned int seq; int i, j; + bool dom_size = 0; LASSERT(lsm->lsm_entry_count > 0); LASSERT(!lov->lo_lsm); @@ -679,6 +686,18 @@ static int lov_init_composite(const struct lu_env *env, struct lov_device *dev, lle->lle_comp_ops = &raid0_ops; break; case LOV_PATTERN_MDT: + /* Allowed to have several DOM stripes in different + * mirrors with the same DoM size. + */ + if (!dom_size) { + dom_size = lle->lle_lsme->lsme_extent.e_end; + } else if (dom_size != + lle->lle_lsme->lsme_extent.e_end) { + CERROR("%s: DOM entries with different sizes\n", + lov2obd(dev->ld_lov)->obd_name); + dump_lsm(D_ERROR, lsm); + return -EINVAL; + } lle->lle_comp_ops = &dom_ops; break; default: @@ -869,7 +888,8 @@ static void lov_fini_composite(const struct lu_env *env, struct lov_layout_entry *entry; lov_foreach_layout_entry(lov, entry) - entry->lle_comp_ops->lco_fini(env, entry); + if (entry->lle_comp_ops) + entry->lle_comp_ops->lco_fini(env, entry); kvfree(comp->lo_entries); comp->lo_entries = NULL;