Skip to content

Commit 99fe6e6

Browse files
Brian Fosterbrauner
authored andcommitted
iomap: drop unnecessary pos param from iomap_write_[begin|end]
iomap_write_begin() and iomap_write_end() both take the iter and iter->pos as parameters. Drop the unnecessary pos parameter and sample iter->pos within each function. Signed-off-by: Brian Foster <[email protected]> Link: https://lore.kernel.org/[email protected] Reviewed-by: "Darrick J. Wong" <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent e356c5d commit 99fe6e6

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

fs/iomap/buffered-io.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -774,11 +774,12 @@ static int iomap_write_begin_inline(const struct iomap_iter *iter,
774774
return iomap_read_inline_data(iter, folio);
775775
}
776776

777-
static int iomap_write_begin(struct iomap_iter *iter, loff_t pos,
778-
size_t len, struct folio **foliop)
777+
static int iomap_write_begin(struct iomap_iter *iter, size_t len,
778+
struct folio **foliop)
779779
{
780780
const struct iomap_folio_ops *folio_ops = iter->iomap.folio_ops;
781781
const struct iomap *srcmap = iomap_iter_srcmap(iter);
782+
loff_t pos = iter->pos;
782783
struct folio *folio;
783784
int status = 0;
784785

@@ -883,10 +884,11 @@ static void iomap_write_end_inline(const struct iomap_iter *iter,
883884
* Returns true if all copied bytes have been written to the pagecache,
884885
* otherwise return false.
885886
*/
886-
static bool iomap_write_end(struct iomap_iter *iter, loff_t pos, size_t len,
887-
size_t copied, struct folio *folio)
887+
static bool iomap_write_end(struct iomap_iter *iter, size_t len, size_t copied,
888+
struct folio *folio)
888889
{
889890
const struct iomap *srcmap = iomap_iter_srcmap(iter);
891+
loff_t pos = iter->pos;
890892

891893
if (srcmap->type == IOMAP_INLINE) {
892894
iomap_write_end_inline(iter, folio, pos, copied);
@@ -949,7 +951,7 @@ static int iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i)
949951
break;
950952
}
951953

952-
status = iomap_write_begin(iter, iter->pos, bytes, &folio);
954+
status = iomap_write_begin(iter, bytes, &folio);
953955
if (unlikely(status)) {
954956
iomap_write_failed(iter->inode, iter->pos, bytes);
955957
break;
@@ -966,7 +968,7 @@ static int iomap_write_iter(struct iomap_iter *iter, struct iov_iter *i)
966968
flush_dcache_folio(folio);
967969

968970
copied = copy_folio_from_iter_atomic(folio, offset, bytes, i);
969-
written = iomap_write_end(iter, pos, bytes, copied, folio) ?
971+
written = iomap_write_end(iter, bytes, copied, folio) ?
970972
copied : 0;
971973

972974
/*
@@ -1281,7 +1283,7 @@ static int iomap_unshare_iter(struct iomap_iter *iter)
12811283
bool ret;
12821284

12831285
bytes = min_t(u64, SIZE_MAX, bytes);
1284-
status = iomap_write_begin(iter, iter->pos, bytes, &folio);
1286+
status = iomap_write_begin(iter, bytes, &folio);
12851287
if (unlikely(status))
12861288
return status;
12871289
if (iomap->flags & IOMAP_F_STALE)
@@ -1292,7 +1294,7 @@ static int iomap_unshare_iter(struct iomap_iter *iter)
12921294
if (bytes > folio_size(folio) - offset)
12931295
bytes = folio_size(folio) - offset;
12941296

1295-
ret = iomap_write_end(iter, pos, bytes, bytes, folio);
1297+
ret = iomap_write_end(iter, bytes, bytes, folio);
12961298
__iomap_put_folio(iter, pos, bytes, folio);
12971299
if (WARN_ON_ONCE(!ret))
12981300
return -EIO;
@@ -1357,7 +1359,7 @@ static int iomap_zero_iter(struct iomap_iter *iter, bool *did_zero)
13571359
bool ret;
13581360

13591361
bytes = min_t(u64, SIZE_MAX, bytes);
1360-
status = iomap_write_begin(iter, iter->pos, bytes, &folio);
1362+
status = iomap_write_begin(iter, bytes, &folio);
13611363
if (status)
13621364
return status;
13631365
if (iter->iomap.flags & IOMAP_F_STALE)
@@ -1373,7 +1375,7 @@ static int iomap_zero_iter(struct iomap_iter *iter, bool *did_zero)
13731375
folio_zero_range(folio, offset, bytes);
13741376
folio_mark_accessed(folio);
13751377

1376-
ret = iomap_write_end(iter, pos, bytes, bytes, folio);
1378+
ret = iomap_write_end(iter, bytes, bytes, folio);
13771379
__iomap_put_folio(iter, pos, bytes, folio);
13781380
if (WARN_ON_ONCE(!ret))
13791381
return -EIO;

0 commit comments

Comments
 (0)