X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=fs%2Fgfs2%2Fbmap.c;h=93ea1d529aa398e68937f3d10fd84b7d2ff7fbdc;hb=4066524401724babc5710b0a6be88021a081874a;hp=f42718dd292f445c0bfe9da0b5e8703facb24d3b;hpb=88f76bc31b93cc228f5a43d5b565dc53615970ae;p=linux-block.git diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index f42718dd292f..93ea1d529aa3 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -1,10 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved. - * - * This copyrighted material is made available to anyone wishing to use, - * modify, copy, or redistribute it subject to the terms and conditions - * of the GNU General Public License version 2. */ #include @@ -994,9 +991,12 @@ static void gfs2_write_unlock(struct inode *inode) static int gfs2_iomap_page_prepare(struct inode *inode, loff_t pos, unsigned len, struct iomap *iomap) { + unsigned int blockmask = i_blocksize(inode) - 1; struct gfs2_sbd *sdp = GFS2_SB(inode); + unsigned int blocks; - return gfs2_trans_begin(sdp, RES_DINODE + (len >> inode->i_blkbits), 0); + blocks = ((pos & blockmask) + len + blockmask) >> inode->i_blkbits; + return gfs2_trans_begin(sdp, RES_DINODE + blocks, 0); } static void gfs2_iomap_page_done(struct inode *inode, loff_t pos,