Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7373681imm; Tue, 28 Aug 2018 10:51:00 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdalqp8uI4Lyvi7sXld3ZLmMlzYYb/98UElrEzDuSYHsT4/E0+EgQomsfT0Ufh5rEyrY94SK X-Received: by 2002:a62:20f:: with SMTP id 15-v6mr2630741pfc.100.1535478660723; Tue, 28 Aug 2018 10:51:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535478660; cv=none; d=google.com; s=arc-20160816; b=XgS2tA6VjqjCpwRcCgp+crwzH4uAgDDRPlHMSDkf5GqjOlJ1Z+2sOqQJfYsvy3NTtt lpj1pqmezFpmNbjDVzB+0jVM4JNMdaIulX0d03e+G2115ggE8UXTy6pTEspuDEQmS1hF K5kFFMhIAJoMx0TzXbJuuAGShYwpRcEt/gOCyeuHZWjwrrrndrWE/C/MxKZbq/AGfa5p Uodd6mu91sfKRYDJRpILzuoDbH4q6JyB3BM8OEA3QXRnFh/fTqeAupf9vmvNaAl1Q5V3 ZATbjRu8p0k8ZOn5cJIfAPu4pVfZhkd2bealWHE0UuLSjylLx9aPJ5ZR7gFVVJM6iqj3 u97w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=fkLBf0mt6rIUOjKi+HyEd3CtJE9o4jMq+rTZDSd//zs=; b=qb7NqarMR8cNRefDJNuv2kaTSiC2ENq/UBMM89R35cJn298MBqBGIF3uyz1ZXpk+9C ahSCvczJvf/a77yvzcPBQAj4lBJ9DBjQIZ5U/R7CtuplHYVGdaP5t0qUkKJysaLiyw0u bs8Od6w6N5jzMw6gE8NHYS+BGUj6Z8v24M99KS6g0KHt0ZJaeiRRVgdxQVfMpEKV/fSU KHnHCHEs+/orDMPjgpac+ERtna8qIskdw8CwGXkiZ9iD8hnoEtrlIYhkR4Ka65jcHIYb K5DcD+afZ+X/zgTRMxDDirAzhFGaMv3uThIUBNJ4i8IbimrHKctXBMFh4f7jHVF7x/mj IDaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="TkuS7n/x"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u10-v6si1402512plu.506.2018.08.28.10.50.45; Tue, 28 Aug 2018 10:51:00 -0700 (PDT) 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=@linaro.org header.s=google header.b="TkuS7n/x"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727385AbeH1VmM (ORCPT + 99 others); Tue, 28 Aug 2018 17:42:12 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:44051 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1VmM (ORCPT ); Tue, 28 Aug 2018 17:42:12 -0400 Received: by mail-qt0-f193.google.com with SMTP id k38-v6so2680773qtk.11 for ; Tue, 28 Aug 2018 10:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=fkLBf0mt6rIUOjKi+HyEd3CtJE9o4jMq+rTZDSd//zs=; b=TkuS7n/x4pGRXb/Xvy51eyXadOFdycKF6X3V8ce31ypZg1SzA1cKPT5e9SQQIGN/gl ykibjzaFqAYkedS9Il/Az2/uteGVseUuis0Q9LWJJ6k9J0BOh5VnQvbFX8l6qEav5z0m lx5sU9OKJB5k1OXhQwrwskFGxaSn/sgsb0X6k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=fkLBf0mt6rIUOjKi+HyEd3CtJE9o4jMq+rTZDSd//zs=; b=iPRSiZtg0KkLf6yhNPSxkl+kVh3tXZKdi73MwbQPU5wNhke084q3ZX+ad9BxCmDjCf aXPXkwWr0JMsh3f4udBiT4W8ZVstbbOvcT6KkA3fEKYbWEv64yvfu1Vxs8xqmhOC75M1 /b9V/7JzgGWfpH2m56VLBaGnPv6oGguvSePbUUxT9JfJt7S8VboJHByNrH1InUh7XSYH MW345T7UsFj7elZnULn2yyJ6gJiEz4B87lY86rTuitTpyULCYXbTFKgFYQ2ST2G1R0zS pg+CNGPPlHV+yKSm8+uPfUG/c0CH/DfPCEUhkPL8a3HfviVfbgmgkc2Q/OHEDNvbgCO5 WVEw== X-Gm-Message-State: APzg51Boaz9HG94uAKgGjiZEe3YBhYhRDdg8D2XFvlFQgkyV+0shAGSk ll+xfPn7a6o3N3q8D5xAdghfpr1qEgU= X-Received: by 2002:ac8:7311:: with SMTP id x17-v6mr2877274qto.204.1535478567127; Tue, 28 Aug 2018 10:49:27 -0700 (PDT) Received: from xanadu.home (modemcable228.104-82-70.mc.videotron.ca. [70.82.104.228]) by smtp.gmail.com with ESMTPSA id a26-v6sm1023194qtc.74.2018.08.28.10.49.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Aug 2018 10:49:26 -0700 (PDT) Date: Tue, 28 Aug 2018 13:49:25 -0400 (EDT) From: Nicolas Pitre To: Matthew Wilcox cc: Andrew Morton , Souptick Joarder , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/10] cramfs: Convert to use vmf_insert_mixed In-Reply-To: <20180828145728.11873-2-willy@infradead.org> Message-ID: References: <20180828145728.11873-1-willy@infradead.org> <20180828145728.11873-2-willy@infradead.org> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 28 Aug 2018, Matthew Wilcox wrote: > cramfs is the only remaining user of vm_insert_mixed; convert it. > > Signed-off-by: Matthew Wilcox > --- > fs/cramfs/inode.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c > index f408994fc632..b72449c19cd1 100644 > --- a/fs/cramfs/inode.c > +++ b/fs/cramfs/inode.c > @@ -417,10 +417,15 @@ static int cramfs_physmem_mmap(struct file *file, struct vm_area_struct *vma) > */ > int i; > vma->vm_flags |= VM_MIXEDMAP; > - for (i = 0; i < pages && !ret; i++) { > + for (i = 0; i < pages; i++) { > + vm_fault_t vmf; > unsigned long off = i * PAGE_SIZE; > pfn_t pfn = phys_to_pfn_t(address + off, PFN_DEV); > - ret = vm_insert_mixed(vma, vma->vm_start + off, pfn); > + vmf = vmf_insert_mixed(vma, vma->vm_start + off, pfn); > + if (vmf & VM_FAULT_ERROR) { > + pages = i; > + break; > + } I'd suggest this to properly deal with errers instead: diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index f408994fc6..0c35e62f10 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -418,9 +418,12 @@ static int cramfs_physmem_mmap(struct file *file, struct vm_area_struct *vma) int i; vma->vm_flags |= VM_MIXEDMAP; for (i = 0; i < pages && !ret; i++) { + vm_fault_t vmf; unsigned long off = i * PAGE_SIZE; pfn_t pfn = phys_to_pfn_t(address + off, PFN_DEV); - ret = vm_insert_mixed(vma, vma->vm_start + off, pfn); + vmf = vmf_insert_mixed(vma, vma->vm_start + off, pfn); + if (vmf & VM_FAULT_ERROR) + ret = vm_fault_to_errno(vmf, 0); } } Nicolas