From patchwork Fri Apr 26 11:05:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Klotzbuecher X-Patchwork-Id: 1091472 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::539; helo=mail-ed1-x539.google.com; envelope-from=swupdate+bncbcjzpafat4mbbuwmrptakgqeeibqsoi@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mkio.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="FxlE4GCk"; dkim-atps=neutral Received: from mail-ed1-x539.google.com (mail-ed1-x539.google.com [IPv6:2a00:1450:4864:20::539]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44rB8P2fNgz9s00 for ; Fri, 26 Apr 2019 21:07:01 +1000 (AEST) Received: by mail-ed1-x539.google.com with SMTP id h10sf1328496edn.22 for ; Fri, 26 Apr 2019 04:07:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1556276818; cv=pass; d=google.com; s=arc-20160816; b=X7zZO5yR/p+5cIL9DaXhM9PRdKbKe9MaVB3sErnVV3x9hh5p5Bh0bopn+tpTZltQBo 9RgVMqvFdAlxBzK3NRL9teGr6ZSfSbkXwZMFIJ48MlMqAKa746bE6g8MCqmPZzMU2MIe hxARv9kQ8vQXZEjZ5cvi/t+mNcEReXPDKo770tkbWiNvN0mKjdOQVjHVUsdmkyfujYcT /ebQJ6N3tOdRkSwWHzEjqN0rXdRaMJxGbROCCLTiYqdvsz/D5Ge7GyNg9nFzQMK0RvGG oixWuZAprg9pcA/xnGaPqDlV4yCBBVkWbaFBgv5yjFfWXdUqkLJ7XnUBYzYNCSDkDoDk kSjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=GhhfCSQ06xgIuS6FMZnfEIFHxtVnzzK/Ge9z2XXgZ18=; b=a8zFxhkBw+oyGW6eLd7mMZ8lgzRgDnGgZU+s/hLVBsJmZ3ZUnCpM9MDe6zBGzM4ywI 8+4TBcEf8BgtNKjjFk9H/j+GuIJrIHVzfBJo28mH0nDAzRi5pzAbftCNFoK8h/DHfKvm wgSeRd8Oah8RTTZ4yHcDTsThrRkMy5yq8uZlGDLXIs7Z8BUSLrimyqZ/wboynMZGLdEd R058bR0tr8UlHDum+E1EDD94dqxgQwozznBCjvtnhj7FXhIe05C2vtb9fTgfiRNES3fw aOctC4bqtfsjnZmzI0gJYLDGyGgLVH10PR4P6+pOmoXnIxxn7ocBo1AjOiZ3eBS087tT 0SXQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=temperror (no key for signature) header.i=@mkio.de header.s=default header.b=Wf0XlY0w; spf=permerror (google.com: permanent error in processing during lookup of markus.klotzbuecher@kistler.com: mx2.kistler.com not found) smtp.mailfrom=markus.klotzbuecher@kistler.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=GhhfCSQ06xgIuS6FMZnfEIFHxtVnzzK/Ge9z2XXgZ18=; b=FxlE4GCkXX5PV6Vmlg1pun+6lt7xhlJ4Lcp5KzRQ/IrGYuU77Qhg1MHBl2uOXLRdaO i5e2rXY3+3iQDSJi+kfoAZe6klUPPtHNPyhM0lTjnq+UGkr0aHhi1CpxWfy/QVVbmcJn kbLynmiH6FULOLefcHa08KXIC0YtSCVDMeU9o6EjNMXCkQKRDutez0QtqZnHurronCWb wNfUoPf/nrMrynq4o9q8v5djB8R3Pe3Jjn8rPFKkMJ06mY4jeVNIWeXLgcs3NSNVMDQj XjxYsqmx7/Io2V5+etfIAnT2bJ5EqAjUa0nA0jj4lQ/YUM5bwVNcP9/nGdcHXeE0kjED 8JBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=GhhfCSQ06xgIuS6FMZnfEIFHxtVnzzK/Ge9z2XXgZ18=; b=i32KNpXHEpzv2pm3lF9eAutaqUqh1nckjaIrH2Nw+JaxO1WIANj6IkbyKJjsdEYkHW detxIomBou81I1sonlRUPoBYfwx5+XPtcaKo7dRYi13ezNpFzybr4A1lPmaz5oHcI8fj 0lQf0rBNMswmqy7+6AM71y5Cih94UD9i1DjNDqWEH8jCle9luq+ft3s1dn6+VaIX2l+s wLUoQTP1YARiKF3cbCqLWAs3OUlhSz3svQ2Vae1dt9FXrBga0Ri4C+PRbYDb9UDVmlXz 7DOeVf4F+kVSQxM4Q91TSDd7DPu6idUynNn+o7nV++c7+mS/abwHbxcBOspIh6sOVx7m wBpA== Sender: swupdate@googlegroups.com X-Gm-Message-State: APjAAAX9ym1LjNmMH9D54hRMDSRMrYLeGpoYY9w1CYYHMJOzn7SkCBGE fWsnpq0iYX1MeuUDpZxSlD4= X-Google-Smtp-Source: APXvYqwvEB2/yoX3++KKmrQzLMw5oZQG9gaLuoMrFWQ4FjF8Nul72xhKzxFAvqJ5DhFBp8Nn7AWQnw== X-Received: by 2002:a50:b78a:: with SMTP id h10mr28188547ede.65.1556276818346; Fri, 26 Apr 2019 04:06:58 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a17:906:7b15:: with SMTP id e21ls2362311ejo.4.gmail; Fri, 26 Apr 2019 04:06:57 -0700 (PDT) X-Received: by 2002:a17:906:3ed1:: with SMTP id d17mr22595668ejj.221.1556276817350; Fri, 26 Apr 2019 04:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556276817; cv=none; d=google.com; s=arc-20160816; b=fpk/xyC16PXILgCgYavo2L/iwdpLlP8T1yz41WuwjmplaD15SBN3pbvGla0PsXQ4Cq BG8D8Lr8tbOO3bEsaKBcZy/vGfst0GQyiWrMT2PCzSpxfhpNeTSAuI/dlzCbpJM7jZKe LuVa2B7LCqKJCzjaOCCRl5Ip0F/uZoXLILcQL4xzcIg0vWiIlnUHrHA8Cx4mJeLmfus2 TiZnMxFXOcnVo5V1ahDA5Tw2HJoE8FGx1+jKbsOf/VwuRgIk++FsQrMvyL3aqU2/6QmP l41qGKAbpIrxkLk7eIngT98q4Qb9M7nvfeoAkM7LaLzsm/oZPgNW/DNOzfdNGTogNiSs tqBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=THsi4RVVyqAY0LGJGLeGXCR5utKTYGcA3w2mGtuj/6g=; b=NVK82OHpTOJ64n193SsjNrXsAKo0VDZatnhDETDUXl0TBeVxxnioVqNMHRkb4M6Wad gfrOXN08Z/CjKVj7a3ev7TBMIb1IIKvGwH6TdZlouF4M2wpyAv5AnCwxx3H1WYARi/mq W8E9BeqMpt5NKNdVWNmDN5eYurzPFNA4uGuwLvb/xA0o8kouyDG8XG3Y7J3d0+A7zTmy 9WTZFWXatzY8XSZTbgiEvG73oQXyDXa8pK+QBwt5gkNAVrX7qAFzO4EpbRwpfmRHs1eI LxckHPMPQI1BBVJCt1nOG/sovo6E2blWE4h+O7K9UF6u2us8tXzadG+s6q+0OHiBWMb0 RbOw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=temperror (no key for signature) header.i=@mkio.de header.s=default header.b=Wf0XlY0w; spf=permerror (google.com: permanent error in processing during lookup of markus.klotzbuecher@kistler.com: mx2.kistler.com not found) smtp.mailfrom=markus.klotzbuecher@kistler.com Received: from mail-relay.contabo.net (mail-relay.contabo.net. [213.136.95.143]) by gmr-mx.google.com with ESMTPS id 33si1194678edr.4.2019.04.26.04.06.57 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Apr 2019 04:06:57 -0700 (PDT) Received-SPF: permerror (google.com: permanent error in processing during lookup of markus.klotzbuecher@kistler.com: mx2.kistler.com not found) client-ip=213.136.95.143; Received: by mail-relay.contabo.net (Postfix, from userid 103) id 042E12098B; Fri, 26 Apr 2019 13:06:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on vmd4985.contabo.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=4.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.2 Received: from m2731.contabo.net (m2731.contabo.net [193.34.145.203]) by mail-relay.contabo.net (Postfix) with ESMTPS id 77E0720294 for ; Fri, 26 Apr 2019 13:06:56 +0200 (CEST) Received: from [95.208.211.42] (port=46891 helo=e460.ch.int.kistler.com) by m2731.contabo.net with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1hJygR-0006O8-Er; Fri, 26 Apr 2019 13:06:56 +0200 From: Markus Klotzbuecher To: swupdate@googlegroups.com Cc: Markus Klotzbuecher Subject: [swupdate] [PATCH 1/3] ubivol_handler: use rsvd_bytes instead of data_bytes Date: Fri, 26 Apr 2019 13:05:36 +0200 Message-Id: <20190426110538.11076-2-mk@mkio.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190426110538.11076-1-mk@mkio.de> References: <20190426110538.11076-1-mk@mkio.de> MIME-Version: 1.0 X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - m2731.contabo.net X-AntiAbuse: Original Domain - googlegroups.com X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - kistler.com X-Get-Message-Sender-Via: m2731.contabo.net: authenticated_id: mk@mkio.de X-Authenticated-Sender: m2731.contabo.net: mk@mkio.de X-Source: X-Source-Args: X-Source-Dir: X-Original-Sender: mk@mkio.de X-Original-Authentication-Results: gmr-mx.google.com; dkim=temperror (no key for signature) header.i=@mkio.de header.s=default header.b=Wf0XlY0w; spf=permerror (google.com: permanent error in processing during lookup of markus.klotzbuecher@kistler.com: mx2.kistler.com not found) smtp.mailfrom=markus.klotzbuecher@kistler.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Use vol_info.rsvd_bytes instead of data_bytes. For dynamic volumes both values are equal, but for static volumes, data_bytes is the number of stored bytes and rsvd_bytes is the size of the volume. As a consequence, the check in adjust_volume for whether the volume size has changed is always true for static volumes, and the volume gets unecessarily deleted and recreated. Signed-off-by: Markus Klotzbuecher Acked-by: Stefano Babic --- handlers/ubivol_handler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/ubivol_handler.c b/handlers/ubivol_handler.c index 805e610..62d9aea 100644 --- a/handlers/ubivol_handler.c +++ b/handlers/ubivol_handler.c @@ -203,7 +203,7 @@ static int adjust_volume(struct img_type *cfg, /* Check if size is changed */ requested_lebs = cfg->partsize / mtd_info->dev_info.leb_size + ((cfg->partsize % mtd_info->dev_info.leb_size) ? 1 : 0); - allocated_lebs = ubivol->vol_info.data_bytes / mtd_info->dev_info.leb_size; + allocated_lebs = ubivol->vol_info.rsvd_bytes / mtd_info->dev_info.leb_size; if (requested_lebs == allocated_lebs) return 0; @@ -258,7 +258,7 @@ static int adjust_volume(struct img_type *cfg, } LIST_INSERT_HEAD(&mtd_info->ubi_partitions, ubivol, next); TRACE("Created UBI Volume %s of %lld bytes (requested %lld)", - req.name, ubivol->vol_info.data_bytes, req.bytes); + req.name, ubivol->vol_info.rsvd_bytes, req.bytes); return 0; }