From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3A4FC47258 for ; Sun, 28 Jan 2024 16:55:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C0926B0075; Sun, 28 Jan 2024 11:55:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 349B16B007B; Sun, 28 Jan 2024 11:55:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1EB5E6B0080; Sun, 28 Jan 2024 11:55:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0C5566B0075 for ; Sun, 28 Jan 2024 11:55:55 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A0E2C1A080D for ; Sun, 28 Jan 2024 16:55:54 +0000 (UTC) X-FDA: 81729321828.05.4F4ED8F Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf07.hostedemail.com (Postfix) with ESMTP id 20D5340011 for ; Sun, 28 Jan 2024 16:55:52 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf07.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706460953; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xpqQKM0ed1rCeoiPpOguWxeDc98jzIb3mj7T4W3a6w4=; b=H4RzHcECRe7SoDkGF6A3Bz/1hT7Vmc6IeDXIO3APxUHFIswfc7eEO7LpxuTz7/Sp0hAbDg dkYAWNkud6WS5zqhNSpUIoq+NnHFIIhZMdL0V23/cA27EC0FJbA9V79Ja9DEHODrseT2fZ aoZX8V3NyFO6Np/bjtGlNlZNI6D0rWQ= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf07.hostedemail.com: domain of hch@lst.de designates 213.95.11.211 as permitted sender) smtp.mailfrom=hch@lst.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706460953; a=rsa-sha256; cv=none; b=ydjgu86tQQWNV4s04+gg++pG41A+aC57BGwa/TX+WzT1sXMrfh2Ch/QcOvaGCx/W8T/ll9 AavsXsYH1mSijMYIG/imkdTYcF93ePSz7xI1MSiwpXs+7Na+/xjwOA+i8sATBgG87bC194 9Ong9KUg8GK0VL41VMGleEypYlKX4gQ= Received: by verein.lst.de (Postfix, from userid 2407) id A706E68B05; Sun, 28 Jan 2024 17:55:49 +0100 (CET) Date: Sun, 28 Jan 2024 17:55:49 +0100 From: Christoph Hellwig To: Matthew Wilcox Cc: Christoph Hellwig , Chandan Babu R , "Darrick J. Wong" , Hugh Dickins , Andrew Morton , linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 16/21] xfs: improve detection of lost xfile contents Message-ID: <20240128165549.GA5727@lst.de> References: <20240126132903.2700077-1-hch@lst.de> <20240126132903.2700077-17-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 20D5340011 X-Stat-Signature: 39oowm9myrf35kh1pzhw6zud7hxp4nym X-HE-Tag: 1706460952-930659 X-HE-Meta: U2FsdGVkX19BVQxHOiIdLrzJL57OUBQGKl5yRmK8oss2uLQBHq/GMGn2bEhl7Pglc1HWfhnhtdnknlXwWtxCK7i2EsUfKeYBgvi4mYdkoLgv7fZY5i2VjvNTa9/hUQo3Xfbbv0vzf2kWesAWtGWRh4WN36C/a4KKUihOjP+MkMIzrAoyvRGHWTLmX1BGKnGZAUuBSjDO9zBfZUqzhCp4GRp1awd95sz3TkUEBjbrFzskNw4CKbRioXs8hNLamH6Hee6/K5l9Vc7h/M3pd0wdIOmQHYbjkRdajgHERj4CRnU1FuAkbrNn9D+HXIAiB75OCDjDevnLnAN7WkouqWp/EaFwb975Zsi4nm1t7+5r1oPzwo0kZxHXp1E7MAesNzwoVSv1jgVpFN04BWuuEc5/Kd+KWptHKRFzSk9PeKOlC7d+Ux2jTozb4QabVv4A5SdbQyHOnYpWlm93ukFu1qsvVLwA2N1g94cuJ9XJSHOxS5snzlvpEExsyxBMGczyIS8Ur2Xq041Oahzu2JdtcjOLzzo8kRJMRYKnRVzxpetUw44CKoLxKz2mK78Ddf85rUdWqb65BHDWDP5/n6+OGjPWcG8QG0U9DkOETd9Af0PL/2GBR/wpvtZzyxs2kCEH+/uyK6ry3pAh3aVBWaA2aMPiR+F1jBwyBIvk9i7H3vQnhqPnKLP8YNFKiCHUHK8b5Wk3BTVf3Jv/i40fahRfw4FQAQhL3JI9/7Qu3W+E7bGdQEQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Jan 26, 2024 at 04:33:40PM +0000, Matthew Wilcox wrote: > > +static inline bool > > +xfile_has_lost_data( > > + struct inode *inode, > > + struct folio *folio) > > +{ > > + struct address_space *mapping = inode->i_mapping; > > + > > + /* This folio itself has been poisoned. */ > > + if (folio_test_hwpoison(folio)) > > + return true; > > + > > + /* A base page under this large folio has been poisoned. */ > > + if (folio_test_large(folio) && folio_test_has_hwpoisoned(folio)) > > + return true; > > + > > + /* Data loss has occurred anywhere in this shmem file. */ > > + if (test_bit(AS_EIO, &mapping->flags)) > > + return true; > > + if (filemap_check_wb_err(mapping, 0)) > > + return true; > > + > > + return false; > > +} > > This is too much. filemap_check_wb_err() will do just fine for your > needs unless you really want to get fine-grained and perhaps try to > reconstruct the contents of the file. As in only call filemap_check_wb_err and do away with all the hwpoisoned checks and the extra AS_EIO check?