mbox series

[0/3] Replace direct ->bmap calls by bmap() with error support

Message ID 20180912122536.31977-1-cmaiolino@redhat.com (mailing list archive)
Headers show
Series Replace direct ->bmap calls by bmap() with error support | expand

Message

Carlos Maiolino Sept. 12, 2018, 12:25 p.m. UTC
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(-)