Received: by 10.223.185.116 with SMTP id b49csp842226wrg; Sat, 10 Feb 2018 21:48:18 -0800 (PST) X-Google-Smtp-Source: AH8x227Vbi6nyGdOg5Npjg94RQGcvZvGjWvbWxOBM+DCRXHLJ0J3+cDpneIBaSboGGFDsndX1hwi X-Received: by 10.98.110.202 with SMTP id j193mr7871907pfc.19.1518328098003; Sat, 10 Feb 2018 21:48:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518328097; cv=none; d=google.com; s=arc-20160816; b=lwp/e6UUMvbrjExhIXWPXfo0fPN19U3uldC2y0HUgUWGfRLSZ1K8Twco8EsL7DNKgp X12O1XrKAzuChP8pVORXzsGMgPJsj0/feST4boEkEhoea80+R5fsUt4Ni6HDRc490KBM us6V+qf/S6DyNs0VKCIXpmKqOTsXsi3wboUGhAVlBRnEk7cUWdlyfP4XSvPHwA0aaxiL X/ihtAOmVNLMrJ4NaPUzO1dhTn8kap33QhlMceugR54VsENc2jl3efuIudM9xZ++RZfq c138gRbaEhqqzHxKmVOM9Gqq0YoDRjsXQi7hNodkrkZCou1vNaiayKQ2/8asm3zsMLbN G68A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=y8l0GM718EwhJYJEvsF5scg6AyWSKuwo45ML7EfUjys=; b=cBxP9dCvVsmfl42TOHHELeRfmvZwQbfuZZo0odAsvoE11fXX9mjeuzYSmnYjdw+DLG Vl6oH22+BJqVnvU/DjHEZqfw5bymu6D42NatVYxypUoVMQ3x8ql+7KCtCK33/LEL2fIb oLhfuL+2diDPA4N19tMKMS6+0UelG39BpkbjloBN7L6cgjURIn8DKcZLOso178BF7VJU utTbw2cR68n5ldpYD+3pDUMlqPHqFJHIauHofoxXfpRk2JdCTGxTuaBgp4JYGFxnbUYi ZZBVWkzZ9/oDKktRp6gY/1iwAjBqsOs9+Qotc2yzdk7NFxY/Pa8N7ZOmH788a6zPmlRN JEhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=en50sAYe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si2044708pgq.11.2018.02.10.21.48.04; Sat, 10 Feb 2018 21:48:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=en50sAYe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752662AbeBKFqp (ORCPT + 99 others); Sun, 11 Feb 2018 00:46:45 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:44156 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750787AbeBKFqn (ORCPT ); Sun, 11 Feb 2018 00:46:43 -0500 Received: by mail-qt0-f195.google.com with SMTP id f18so15280513qth.11; Sat, 10 Feb 2018 21:46:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=y8l0GM718EwhJYJEvsF5scg6AyWSKuwo45ML7EfUjys=; b=en50sAYe7kPVm/Wbgxm7Q3pca193VVV+h/R+fAaMjVSgVznmQ34SiRwCTe/xw/UUIB 5soBQlnpkKveCHXSSSKtddc2C8KQNlaVDdfWyoJ7NX8MrmVj94i5ah4rUVbS6h+CoXjV KIy6b8DCESmlVNvbbLl4dfOrgSHZ1Pq0c7wj5wXoLMyZiNKm2jZ06GuMAh+FF/mZPvAn 5PgiOq2xMuCw23nZGmHlO80FCm2alUSZS7unM/Fl1nHsM6UMXKpm8ZBKyKaMg1HLEPYW P8krq3qdYJUwSkaypqXSzXOp02vi1uatAUikOd/XkNh5lr6hscuRn61tzxU73i4EBLot 2lkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=y8l0GM718EwhJYJEvsF5scg6AyWSKuwo45ML7EfUjys=; b=KIwcCBmSLPl1BpPIOx/nNrhPjI0t7NHEix/swF64fenRv9ILr94yOugsDwz3eyGws0 2kU9HBppFSaKZZCpfNSxIVkn/m2O6sE1XClvpNwQN8t5+S0Nh/YaIWvU2XHW/Ccdr9sy pjpzNsW3+tCs2fLQV1oxAPY8oDZrmDILyZfmOq6oPxgTzByDgXGegdEc5YZaVgLVlD+S Gra9JF03/EDWc0OLFNaWThEkjzZbPZG41dirFjgitSy3FBjczIIHoINBkcgUZtXdubKk VA0Y7+TXVJo9tMro8opbImuswx1UNDbmzcQHm1B0ax2+9EElesAkIhU/cs+QilGRSZFd hIFg== X-Gm-Message-State: APf1xPAN6tt+5FpjkLK6I5D32ThPkINLVYfDnPQAX/AOqbmKzCZLkStM pSxbC9MdI+fzkuF340zxKi4wqRZts2BkZAMHzP0= X-Received: by 10.200.15.164 with SMTP id b33mr12467772qtk.301.1518328002956; Sat, 10 Feb 2018 21:46:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.153.45 with HTTP; Sat, 10 Feb 2018 21:46:22 -0800 (PST) In-Reply-To: <20180211010201.GA14719@bombadil.infradead.org> References: <1518285863.16865.17.camel@perches.com> <20180211010201.GA14719@bombadil.infradead.org> From: Donglin Peng Date: Sun, 11 Feb 2018 13:46:22 +0800 Message-ID: Subject: Re: [PATCH] seq_file: remove redundant assignment of index to m->index To: Matthew Wilcox Cc: Joe Perches , viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 11, 2018 at 9:02 AM, Matthew Wilcox wrote: > On Sat, Feb 10, 2018 at 10:04:23AM -0800, Joe Perches wrote: >> > @@ -120,14 +120,12 @@ static int traverse(struct seq_file *m, loff_t offset) >> > if (pos + m->count > offset) { >> > m->from = offset - pos; >> > m->count -= m->from; >> > - m->index = index; >> > break; >> > } >> > pos += m->count; >> > m->count = 0; >> > if (pos == offset) { >> > index++; >> > - m->index = index; >> > break; >> > } >> > p = m->op->next(m, p, &index); >> >> Of course this looks correct, but how >> are you _absolutely sure_ about this? >> >> Perhaps the m->op->stop(m, p) call below >> the break, which takes m as an argument, >> needs an updated m->index. > > Not only that, but ->next might also look at m->index. I think there is no chance to call op->next, because the loop will break immediately after the assignment.