From patchwork Tue Nov 11 01:42:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhen Lei X-Patchwork-Id: 40547 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 072F8218DE for ; Tue, 11 Nov 2014 01:47:52 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf4750408lbg.1 for ; Mon, 10 Nov 2014 17:47:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=E0+guGPKv8Ap12E0R//BestKCdATie3Z44GVsKSelDI=; b=LkxhmXN7XYUT4Gma/d2n+0UJE8BvfY6ShSw4pUG63YpiXF1/5KQvKgkHzL1B0GhjO+ Nw1amfT2S5yJu/k5U2FeDACN0z9oMWdnLw5U7lEnJrXSFQI63OsUYhRVUkMVOqSkquDZ zdreMCQvEpKmaADIa6j4qjRym0JiHaUcFk4j313QzmMjgZPUdblpfwtN6U+xErIcuLcB xqu1NAGu8iCbLiB5ql3q+a5dwo2p2nlFeEFo2gfqaN8QXcKUp1N7abDoEyK4cJ6FpYHY gNp7wU/yDbBZ8FFjr39YkIDwcI+NULncFKktobKm7jQJY2gLm0stHemrLgHN2rc8GjZ2 R0qw== X-Gm-Message-State: ALoCoQnheA5L0GDWDNrHioDaH8NfP50ppdtlJxE7RK9MQ1W/s10AdoPgzMXDS50AUAZSgZzb+HCq X-Received: by 10.152.42.171 with SMTP id p11mr5987407lal.4.1415670470529; Mon, 10 Nov 2014 17:47:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.129 with SMTP id w1ls500643lal.34.gmail; Mon, 10 Nov 2014 17:47:49 -0800 (PST) X-Received: by 10.112.147.225 with SMTP id tn1mr33279166lbb.37.1415670469830; Mon, 10 Nov 2014 17:47:49 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id pz8si29695334lbb.36.2014.11.10.17.47.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Nov 2014 17:47:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id p9so3639240lbv.19 for ; Mon, 10 Nov 2014 17:47:49 -0800 (PST) X-Received: by 10.152.20.199 with SMTP id p7mr33450459lae.49.1415670469660; Mon, 10 Nov 2014 17:47:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp189214lbc; Mon, 10 Nov 2014 17:47:48 -0800 (PST) X-Received: by 10.68.162.100 with SMTP id xz4mr8294299pbb.138.1415670467563; Mon, 10 Nov 2014 17:47:47 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az16si18433624pdb.218.2014.11.10.17.47.46 for ; Mon, 10 Nov 2014 17:47:47 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751442AbaKKBrh (ORCPT + 25 others); Mon, 10 Nov 2014 20:47:37 -0500 Received: from szxga01-in.huawei.com ([119.145.14.64]:27159 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221AbaKKBrg (ORCPT ); Mon, 10 Nov 2014 20:47:36 -0500 Received: from 172.24.2.119 (EHLO szxeml402-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CEF63989; Tue, 11 Nov 2014 09:47:33 +0800 (CST) Received: from localhost (10.177.27.142) by szxeml402-hub.china.huawei.com (10.82.67.32) with Microsoft SMTP Server id 14.3.158.1; Tue, 11 Nov 2014 09:43:12 +0800 From: Zhen Lei To: Andrew Morton , Yinghai Lu , Mark Rustad , linux-kernel CC: Zefan Li , Xinwei Hu , Zhen Lei Subject: [PATCH 1/1] init:add boot option "initramfs_packnum" Date: Tue, 11 Nov 2014 09:42:14 +0800 Message-ID: <1415670134-8016-1-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.8.4.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.27.142] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: thunder.leizhen@huawei.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , During the development phase, we usually enlarge initrd-end to reserve more memory than the initfs zip exactly occupied. Then we can easily add or delete files in zip package, without generate fdt again and again. But unfortunately, if too many zeros followed initfs zip, it will take a long time to break the loop. while (!message && len) { ... ... if (!*buf) { buf++; ... ... continue; } So, use the boot option "initramfs_packnum" to specify how many zip packages in each initrd area. When the specified number of packages decompressed in one area, immediately terminate the loop. Have no impact on current use by default. Signed-off-by: Zhen Lei --- init/initramfs.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) -- 1.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/init/initramfs.c b/init/initramfs.c index ad1bd77..356764f 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -446,12 +446,24 @@ static unsigned long my_inptr; /* index of next byte to be processed in inbuf */ #include +/* zero and negative means packages number is unlimited */ +static int initramfs_packnum __initdata; + +static __init int setup_initramfs_packnum(char *str) +{ + get_option(&str, &initramfs_packnum); + + return 0; +} +early_param("initramfs_packnum", setup_initramfs_packnum); + static char * __init unpack_to_rootfs(char *buf, unsigned long len) { long written; decompress_fn decompress; const char *compress_name; static __initdata char msg_buf[64]; + int packnum = initramfs_packnum; header_buf = kmalloc(110, GFP_KERNEL); symlink_buf = kmalloc(PATH_MAX + N_ALIGN(PATH_MAX) + 1, GFP_KERNEL); @@ -500,6 +512,9 @@ static char * __init unpack_to_rootfs(char *buf, unsigned long len) this_header = saved_offset + my_inptr; buf += my_inptr; len -= my_inptr; + + if (!(--packnum)) + break; } dir_utime(); kfree(name_buf);