mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
Merge patch series "iomap: cleanups ahead of adding fuse support"
Darrick J. Wong <djwong@kernel.org> says: In preparation for making fuse use the fs/iomap code for regular file data IO, fix a few bugs in fuse and apply a couple of tweaks to iomap. These patches can go in immediately. * patches from https://lore.kernel.org/175803480273.966383.16598493355913871794.stgit@frogsfrogsfrogs: iomap: error out on file IO when there is no inline_data buffer iomap: trace iomap_zero_iter zeroing activities Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
commit
c59c965292
|
|
@ -304,6 +304,9 @@ static int iomap_read_inline_data(const struct iomap_iter *iter,
|
|||
size_t size = i_size_read(iter->inode) - iomap->offset;
|
||||
size_t offset = offset_in_folio(folio, iomap->offset);
|
||||
|
||||
if (WARN_ON_ONCE(!iomap->inline_data))
|
||||
return -EIO;
|
||||
|
||||
if (folio_test_uptodate(folio))
|
||||
return 0;
|
||||
|
||||
|
|
@ -894,7 +897,7 @@ static bool __iomap_write_end(struct inode *inode, loff_t pos, size_t len,
|
|||
return true;
|
||||
}
|
||||
|
||||
static void iomap_write_end_inline(const struct iomap_iter *iter,
|
||||
static bool iomap_write_end_inline(const struct iomap_iter *iter,
|
||||
struct folio *folio, loff_t pos, size_t copied)
|
||||
{
|
||||
const struct iomap *iomap = &iter->iomap;
|
||||
|
|
@ -903,12 +906,16 @@ static void iomap_write_end_inline(const struct iomap_iter *iter,
|
|||
WARN_ON_ONCE(!folio_test_uptodate(folio));
|
||||
BUG_ON(!iomap_inline_data_valid(iomap));
|
||||
|
||||
if (WARN_ON_ONCE(!iomap->inline_data))
|
||||
return false;
|
||||
|
||||
flush_dcache_folio(folio);
|
||||
addr = kmap_local_folio(folio, pos);
|
||||
memcpy(iomap_inline_data(iomap, pos), addr, copied);
|
||||
kunmap_local(addr);
|
||||
|
||||
mark_inode_dirty(iter->inode);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -921,10 +928,8 @@ static bool iomap_write_end(struct iomap_iter *iter, size_t len, size_t copied,
|
|||
const struct iomap *srcmap = iomap_iter_srcmap(iter);
|
||||
loff_t pos = iter->pos;
|
||||
|
||||
if (srcmap->type == IOMAP_INLINE) {
|
||||
iomap_write_end_inline(iter, folio, pos, copied);
|
||||
return true;
|
||||
}
|
||||
if (srcmap->type == IOMAP_INLINE)
|
||||
return iomap_write_end_inline(iter, folio, pos, copied);
|
||||
|
||||
if (srcmap->flags & IOMAP_F_BUFFER_HEAD) {
|
||||
size_t bh_written;
|
||||
|
|
@ -1396,6 +1401,9 @@ static int iomap_zero_iter(struct iomap_iter *iter, bool *did_zero,
|
|||
/* warn about zeroing folios beyond eof that won't write back */
|
||||
WARN_ON_ONCE(folio_pos(folio) > iter->inode->i_size);
|
||||
|
||||
trace_iomap_zero_iter(iter->inode, folio_pos(folio) + offset,
|
||||
bytes);
|
||||
|
||||
folio_zero_range(folio, offset, bytes);
|
||||
folio_mark_accessed(folio);
|
||||
|
||||
|
|
|
|||
|
|
@ -519,6 +519,9 @@ static int iomap_dio_inline_iter(struct iomap_iter *iomi, struct iomap_dio *dio)
|
|||
loff_t pos = iomi->pos;
|
||||
u64 copied;
|
||||
|
||||
if (WARN_ON_ONCE(!inline_data))
|
||||
return -EIO;
|
||||
|
||||
if (WARN_ON_ONCE(!iomap_inline_data_valid(iomap)))
|
||||
return -EIO;
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ DEFINE_RANGE_EVENT(iomap_release_folio);
|
|||
DEFINE_RANGE_EVENT(iomap_invalidate_folio);
|
||||
DEFINE_RANGE_EVENT(iomap_dio_invalidate_fail);
|
||||
DEFINE_RANGE_EVENT(iomap_dio_rw_queued);
|
||||
DEFINE_RANGE_EVENT(iomap_zero_iter);
|
||||
|
||||
#define IOMAP_TYPE_STRINGS \
|
||||
{ IOMAP_HOLE, "HOLE" }, \
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user