mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 15:03:52 +08:00
orangefs: adjust counting code to recover from 665575cf
A late commit to 6.14-rc7! broke orangefs.665575cfseems like a good change, but maybe should have been introduced during the merge window. This patch adjusts the counting code associated with writing out pages so that orangefs works in a665575cfworld. Signed-off-by: Mike Marshall <hubcap@omnibond.com>
This commit is contained in:
@@ -32,12 +32,13 @@ static int orangefs_writepage_locked(struct folio *folio,
|
||||
len = i_size_read(inode);
|
||||
if (folio->private) {
|
||||
wr = folio->private;
|
||||
WARN_ON(wr->pos >= len);
|
||||
off = wr->pos;
|
||||
if (off + wr->len > len)
|
||||
if ((off + wr->len > len) && (off <= len))
|
||||
wlen = len - off;
|
||||
else
|
||||
wlen = wr->len;
|
||||
if (wlen == 0)
|
||||
wlen = wr->len;
|
||||
} else {
|
||||
WARN_ON(1);
|
||||
off = folio_pos(folio);
|
||||
@@ -46,8 +47,6 @@ static int orangefs_writepage_locked(struct folio *folio,
|
||||
if (wlen > len - off)
|
||||
wlen = len - off;
|
||||
}
|
||||
/* Should've been handled in orangefs_invalidate_folio. */
|
||||
WARN_ON(off == len || off + wlen > len);
|
||||
|
||||
WARN_ON(wlen == 0);
|
||||
bvec_set_folio(&bv, folio, wlen, offset_in_folio(folio, off));
|
||||
@@ -320,6 +319,8 @@ static int orangefs_write_begin(struct file *file,
|
||||
wr->len += len;
|
||||
goto okay;
|
||||
} else {
|
||||
wr->pos = pos;
|
||||
wr->len = len;
|
||||
ret = orangefs_launder_folio(folio);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user