Skip to content

Commit dcd6158

Browse files
Christoph Hellwigdjwong
authored andcommitted
iomap: always use AOP_FLAG_NOFS in iomap_write_begin
All callers pass AOP_FLAG_NOFS, so lift that flag to iomap_write_begin to allow reusing the flags arguments for an internal flags namespace soon. Also remove the local index variable that is only used once. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent c12d6fa commit dcd6158

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

fs/iomap/buffered-io.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,6 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags,
621621
struct page **pagep, struct iomap *iomap)
622622
{
623623
const struct iomap_page_ops *page_ops = iomap->page_ops;
624-
pgoff_t index = pos >> PAGE_SHIFT;
625624
struct page *page;
626625
int status = 0;
627626

@@ -636,7 +635,8 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags,
636635
return status;
637636
}
638637

639-
page = grab_cache_page_write_begin(inode->i_mapping, index, flags);
638+
page = grab_cache_page_write_begin(inode->i_mapping, pos >> PAGE_SHIFT,
639+
AOP_FLAG_NOFS);
640640
if (!page) {
641641
status = -ENOMEM;
642642
goto out_no_page;
@@ -778,7 +778,6 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
778778
struct iov_iter *i = data;
779779
long status = 0;
780780
ssize_t written = 0;
781-
unsigned int flags = AOP_FLAG_NOFS;
782781

783782
do {
784783
struct page *page;
@@ -808,8 +807,7 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
808807
break;
809808
}
810809

811-
status = iomap_write_begin(inode, pos, bytes, flags, &page,
812-
iomap);
810+
status = iomap_write_begin(inode, pos, bytes, 0, &page, iomap);
813811
if (unlikely(status))
814812
break;
815813

@@ -907,8 +905,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
907905
if (IS_ERR(rpage))
908906
return PTR_ERR(rpage);
909907

910-
status = iomap_write_begin(inode, pos, bytes,
911-
AOP_FLAG_NOFS, &page, iomap);
908+
status = iomap_write_begin(inode, pos, bytes, 0, &page, iomap);
912909
put_page(rpage);
913910
if (unlikely(status))
914911
return status;
@@ -959,8 +956,7 @@ static int iomap_zero(struct inode *inode, loff_t pos, unsigned offset,
959956
struct page *page;
960957
int status;
961958

962-
status = iomap_write_begin(inode, pos, bytes, AOP_FLAG_NOFS, &page,
963-
iomap);
959+
status = iomap_write_begin(inode, pos, bytes, 0, &page, iomap);
964960
if (status)
965961
return status;
966962

0 commit comments

Comments
 (0)