From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44524 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726491AbeILRaJ (ORCPT ); Wed, 12 Sep 2018 13:30:09 -0400 From: Carlos Maiolino To: linux-fsdevel@vger.kernel.org Cc: hch@lst.de, sandeen@redhat.com, david@fromorbit.com Subject: [PATCH 0/3] Replace direct ->bmap calls by bmap() with error support Date: Wed, 12 Sep 2018 14:25:33 +0200 Message-Id: <20180912122536.31977-1-cmaiolino@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi, this is a non-RFC version of the attempt to replace direct ->bmap() calls by calls to bmap() helper. This is a preparatory work to remove ->bmap() interface in a not so distant future. I decided to send this replacement separated from everything else, because I want to make sure to get the ->bmap replacement correct before doing work which will rely on it. This also enables bmap() helper to properly return an error, as, by now, ->bmap() uses '0' as an error return. With this patchset, the following behavior is set: int bmap(struct inode *, sector_t *); the passed pointer sector_t* will be changed internally and after return, will contain either the physical block number of the requested mapping, or 0, if it falls into a hole. The return value is either a negative in case of error, or 0. The ability of bmap() to return an error, has been suggested by Christoph, and this is based on his suggestion, with small modifications. Also, with the ability to return errors, Eric Sandeen suggested we may actually use it to return -EOVERFLOW in ioctl_fibmap() calls, to signal userspace the requested value has been truncated, since, by now, there is no easy way for it to be detected. Once I can get this patchset properly set, I'll work on needed modifications into ->bmap() itself. I did split the ->bmap() to bmap() replacements into different patches, separated by projects, because I thought it would be easier to review, I do apologize if I should have added everything into a single patch. I also didn't change ioctl_fibmap(), because for me at least, it makes more sense to call ->bmap() there directly by now, so we we avoid copying the userspace data if the method doesn't even exist. Comments are appreciated. Cheers. Carlos Maiolino (3): fs: Enable bmap() function to properly return errors cachefiles: drop direct usage of ->bmap method. ecryptfs: drop direct calls to ->bmap drivers/md/md-bitmap.c | 16 ++++++++++------ fs/cachefiles/rdwr.c | 27 ++++++++++++++------------- fs/ecryptfs/mmap.c | 11 ++++++----- fs/inode.c | 30 +++++++++++++++++------------- fs/jbd2/journal.c | 22 +++++++++++++++------- include/linux/fs.h | 2 +- mm/page_io.c | 11 +++++++---- 7 files changed, 70 insertions(+), 49 deletions(-) -- 2.14.4