From patchwork Tue Jan 1 21:07:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Blagodarenko X-Patchwork-Id: 1019808 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ln9V54Oh"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43Tmwz6zxLz9rxp for ; Wed, 2 Jan 2019 08:08:03 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726020AbfAAVIC (ORCPT ); Tue, 1 Jan 2019 16:08:02 -0500 Received: from mail-io1-f67.google.com ([209.85.166.67]:46489 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfAAVIC (ORCPT ); Tue, 1 Jan 2019 16:08:02 -0500 Received: by mail-io1-f67.google.com with SMTP id v10so23264307ios.13 for ; Tue, 01 Jan 2019 13:08:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=F0hAuES3d5xtXeNRTmTSM7SMfm18H8nvikEiHecdQ+w=; b=ln9V54OhukRv7OrH4SkvnSpweTjdF3fndODG3hyfwI45k50OB90/7vH5mo4454UtoX IOjqGKb7WJBfxAGPuwGLvBWrG5pZhEu9+v4QNyuQyRKaQdTAK1if8WKeIboTEV/ZXk4V 6sOnEcrnu7/ejM7ActRUmxzKikCuy49DCovBoRshVkImxxq2Er2G9en754myiog9TYDZ WKxnh3y/VVYkU1Sj5DUoB5E9+GFzDlPeyY69d/P6QXpdjAcswtjEa/BOkpj1O8nztZXU qKMCYqZivKEss/tiOqY7DDuQ+iY9oxHXXFr62sZSTwTDiNRxp7paVmaIkLrqgEhc3I45 yUpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=F0hAuES3d5xtXeNRTmTSM7SMfm18H8nvikEiHecdQ+w=; b=kF0bLaudpqeXt/fRwUQNZU0RBGKErNuw/CM1citsFTVqDWKvvLxfmC2JgfoOnvN0ks YsNKBZNF92ddxMS8t0Vu2Iuv7s7K70B8BI1yWO1+wguK3GmiahDRKrCNbl1FUTa4kM8j faW4oHCpVGPOrxTkRjm81ciYkzmwtolb7cGBF5PsZVEpEFQ3N1+xkDeCRq1a+FUxDe0p uJ5tqgM6iVt2lvpPNpesc2ScOTLer6zBlMASupj8hn0w81aAfCuNexPyD6+HogcFZz9u h3mGup2GTYf97AXyaX7+3aPGDDGD0U52kmbOx3bxzsiUXvaNFr5brJZZE5chl9azp3Ed xN2Q== X-Gm-Message-State: AJcUukchBnNGn+AEQokYBT68+LbUmZVOwe7ziCPVhyl4A/fWCXGPAdaA qSO1+Jn4U6Q8WId5IsqnWLJtdLgUXqA= X-Google-Smtp-Source: ALg8bN7X14iwTEzZlfYBDxqoUi1P+jsjxry8Q7adjihqOkYIhpVSrn67I7u4dGfSTv050F0wgbVRcw== X-Received: by 2002:a6b:2c0c:: with SMTP id s12mr27897660ios.276.1546376881184; Tue, 01 Jan 2019 13:08:01 -0800 (PST) Received: from C02TN4C6HTD6.us.cray.com (seattle-nat.cray.com. [136.162.66.1]) by smtp.gmail.com with ESMTPSA id 137sm22289659itm.21.2019.01.01.13.07.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Jan 2019 13:08:00 -0800 (PST) From: Artem Blagodarenko X-Google-Original-From: Artem Blagodarenko To: linux-ext4@vger.kernel.org Cc: adilger.kernel@dilger.ca Subject: [PATCH v6 0/4] e2image -b option to pass superblock number Date: Tue, 1 Jan 2019 22:07:33 +0100 Message-Id: <20190101210737.87248-1-c17828@cray.com> X-Mailer: git-send-email 2.14.3 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org There was a discussion about possibility of using superblock backup for creating images with e2image. https://www.spinics.net/lists/linux-ext4/msg30583.html Now our customer faced with situation then it would be useful to have image file from partition with broken superblock. Here is set of patches that adds this functionality. This is 6th version of the patch set. * If last superblock backup reading is finished with error of accesing outside the disk, return previous error code. Some minor code style and comments issues are fixed. Artem Blagodarenko (4): ext2fs: opening filesystem code refactoring e2image: add -b and -B options to use supperblock backup tests: add test for e2image -b option ext2fs: automaticlly open backup superblocks e2fsck/e2fsck.h | 2 - e2fsck/message.c | 3 +- e2fsck/unix.c | 42 ++++--------- e2fsck/util.c | 73 ----------------------- lib/ext2fs/openfs.c | 41 +++++++++++-- lib/support/Makefile.in | 8 ++- lib/support/sb_backup.c | 140 ++++++++++++++++++++++++++++++++++++++++++++ lib/support/sb_backup.h | 20 +++++++ misc/dumpe2fs.c | 17 +----- misc/e2image.8.in | 33 +++++++++++ misc/e2image.c | 50 ++++++++++++++-- tests/i_zero_super/expect.1 | 22 +++++++ tests/i_zero_super/image.gz | Bin 0 -> 13262 bytes tests/i_zero_super/script | 11 ++++ 14 files changed, 330 insertions(+), 132 deletions(-) create mode 100644 lib/support/sb_backup.c create mode 100644 lib/support/sb_backup.h create mode 100644 tests/i_zero_super/expect.1 create mode 100644 tests/i_zero_super/image.gz create mode 100644 tests/i_zero_super/script