Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1328432 > unrolled thread
| Started by | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| First post | 2016-02-07 08:20 +0100 |
| Last post | 2016-02-08 16:40 +0100 |
| Articles | 9 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH 0/2] DAX bdev fixes - move flushing calls to FS Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-07 08:20 +0100
[PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-07 08:30 +0100
Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() Dan Williams <dan.j.williams@intel.com> - 2016-02-07 19:20 +0100
Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-08 02:50 +0100
Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() Ross Zwisler <zwisler@gmail.com> - 2016-02-08 05:40 +0100
Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() Dave Chinner <david@fromorbit.com> - 2016-02-07 23:10 +0100
Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-08 02:50 +0100
Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() Dave Chinner <david@fromorbit.com> - 2016-02-08 06:20 +0100
Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-02-08 16:40 +0100
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2016-02-07 08:20 +0100 |
| Subject | [PATCH 0/2] DAX bdev fixes - move flushing calls to FS |
| Message-ID | <qZrNv-2K8-9@gated-at.bofh.it> |
The first patch in the series just adds a bdev argument to dax_clear_blocks(), and should be relatively straightforward. The second patch is slightly more controversial. During testing of raw block devices + DAX I noticed that the struct block_device that we were using for DAX operations was incorrect. For the fault handlers, etc. we can just get the correct bdev via get_block(), which is passed in as a function pointer, but for the flushing code we don't have access to get_block(). This is also an issue for XFS real-time devices, whenever we get those working. In short, somehow we need to get dax_writeback_mapping_range() a valid bdev. Right now it is called via filemap_write_and_wait_range(), which can't provide either the bdev nor a get_block() function pointer. So, our options seem to be: a) Move the calls to dax_writeback_mapping_range() into the filesystems. This is implemented by patch 2 in this series. b) Keep the calls to dax_writeback_mapping_range() in the mm code, and provide a generic way to ask a filesystem for an inode's bdev. I did a version of this using a superblock operation here: https://lkml.org/lkml/2016/2/2/941 It has been noted that we may need to expand the coverage of our DAX flushing code to include support for the sync() and syncfs() userspace calls. This is still under discussion, but if we do end up needing to add support for sync(), I don't think that it is v4.5 material for the reasons stated here: https://lkml.org/lkml/2016/2/4/962 I think that for v4.5 we either need patch 2 of this series, or the get_bdev() patch listed in for solution b) above. Ross Zwisler (2): dax: pass bdev argument to dax_clear_blocks() dax: move writeback calls into the filesystems fs/block_dev.c | 7 +++++++ fs/dax.c | 9 ++++----- fs/ext2/file.c | 10 ++++++++++ fs/ext2/inode.c | 5 +++-- fs/ext4/fsync.c | 10 +++++++++- fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_aops.h | 1 + fs/xfs/xfs_bmap_util.c | 4 +++- fs/xfs/xfs_file.c | 12 ++++++++++-- include/linux/dax.h | 7 ++++--- mm/filemap.c | 6 ------ 11 files changed, 52 insertions(+), 21 deletions(-) -- 2.5.0
[toc] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2016-02-07 08:30 +0100 |
| Subject | [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() |
| Message-ID | <qZrXc-2O5-3@gated-at.bofh.it> |
| In reply to | #1328432 |
dax_clear_blocks() needs a valid struct block_device and previously it was
using inode->i_sb->s_bdev in all cases. This is correct for normal inodes
on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw
block devices and for XFS real-time devices.
Instead, have the caller pass in a struct block_device pointer which it
knows to be correct.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
fs/dax.c | 4 ++--
fs/ext2/inode.c | 5 +++--
fs/xfs/xfs_aops.c | 2 +-
fs/xfs/xfs_aops.h | 1 +
fs/xfs/xfs_bmap_util.c | 4 +++-
include/linux/dax.h | 3 ++-
6 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/fs/dax.c b/fs/dax.c
index 227974a..4592241 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -83,9 +83,9 @@ struct page *read_dax_sector(struct block_device *bdev, sector_t n)
* and hence this means the stack from this point must follow GFP_NOFS
* semantics for all operations.
*/
-int dax_clear_blocks(struct inode *inode, sector_t block, long _size)
+int dax_clear_blocks(struct inode *inode, struct block_device *bdev,
+ sector_t block, long _size)
{
- struct block_device *bdev = inode->i_sb->s_bdev;
struct blk_dax_ctl dax = {
.sector = block << (inode->i_blkbits - 9),
.size = _size,
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 338eefd..277a32b 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -737,8 +737,9 @@ static int ext2_get_blocks(struct inode *inode,
* so that it's not found by another thread before it's
* initialised
*/
- err = dax_clear_blocks(inode, le32_to_cpu(chain[depth-1].key),
- 1 << inode->i_blkbits);
+ err = dax_clear_blocks(inode, inode->i_sb->s_bdev,
+ le32_to_cpu(chain[depth-1].key),
+ 1 << inode->i_blkbits);
if (err) {
mutex_unlock(&ei->truncate_mutex);
goto cleanup;
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 379c089..fc20518 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -55,7 +55,7 @@ xfs_count_page_state(
} while ((bh = bh->b_this_page) != head);
}
-STATIC struct block_device *
+struct block_device *
xfs_find_bdev_for_inode(
struct inode *inode)
{
diff --git a/fs/xfs/xfs_aops.h b/fs/xfs/xfs_aops.h
index f6ffc9a..a4343c6 100644
--- a/fs/xfs/xfs_aops.h
+++ b/fs/xfs/xfs_aops.h
@@ -62,5 +62,6 @@ int xfs_get_blocks_dax_fault(struct inode *inode, sector_t offset,
struct buffer_head *map_bh, int create);
extern void xfs_count_page_state(struct page *, int *, int *);
+extern struct block_device *xfs_find_bdev_for_inode(struct inode *);
#endif /* __XFS_AOPS_H__ */
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 07ef29b..f722ba2 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -73,9 +73,11 @@ xfs_zero_extent(
xfs_daddr_t sector = xfs_fsb_to_db(ip, start_fsb);
sector_t block = XFS_BB_TO_FSBT(mp, sector);
ssize_t size = XFS_FSB_TO_B(mp, count_fsb);
+ struct inode *inode = VFS_I(ip);
if (IS_DAX(VFS_I(ip)))
- return dax_clear_blocks(VFS_I(ip), block, size);
+ return dax_clear_blocks(inode, xfs_find_bdev_for_inode(inode),
+ block, size);
/*
* let the block layer decide on the fastest method of
diff --git a/include/linux/dax.h b/include/linux/dax.h
index 8204c3d..bad27b0 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -7,7 +7,8 @@
ssize_t dax_do_io(struct kiocb *, struct inode *, struct iov_iter *, loff_t,
get_block_t, dio_iodone_t, int flags);
-int dax_clear_blocks(struct inode *, sector_t block, long size);
+int dax_clear_blocks(struct inode *inode, struct block_device *bdev,
+ sector_t block, long _size);
int dax_zero_page_range(struct inode *, loff_t from, unsigned len, get_block_t);
int dax_truncate_page(struct inode *, loff_t from, get_block_t);
int dax_fault(struct vm_area_struct *, struct vm_fault *, get_block_t,
--
2.5.0
[toc] | [prev] | [next] | [standalone]
| From | Dan Williams <dan.j.williams@intel.com> |
|---|---|
| Date | 2016-02-07 19:20 +0100 |
| Subject | Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() |
| Message-ID | <qZC6f-1yh-39@gated-at.bofh.it> |
| In reply to | #1328436 |
On Sat, Feb 6, 2016 at 11:19 PM, Ross Zwisler <ross.zwisler@linux.intel.com> wrote: > dax_clear_blocks() needs a valid struct block_device and previously it was > using inode->i_sb->s_bdev in all cases. This is correct for normal inodes > on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw > block devices and for XFS real-time devices. > > Instead, have the caller pass in a struct block_device pointer which it > knows to be correct. > > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> > --- > fs/dax.c | 4 ++-- > fs/ext2/inode.c | 5 +++-- > fs/xfs/xfs_aops.c | 2 +- > fs/xfs/xfs_aops.h | 1 + > fs/xfs/xfs_bmap_util.c | 4 +++- > include/linux/dax.h | 3 ++- > 6 files changed, 12 insertions(+), 7 deletions(-) > > diff --git a/fs/dax.c b/fs/dax.c > index 227974a..4592241 100644 > --- a/fs/dax.c > +++ b/fs/dax.c > @@ -83,9 +83,9 @@ struct page *read_dax_sector(struct block_device *bdev, sector_t n) > * and hence this means the stack from this point must follow GFP_NOFS > * semantics for all operations. > */ > -int dax_clear_blocks(struct inode *inode, sector_t block, long _size) > +int dax_clear_blocks(struct inode *inode, struct block_device *bdev, > + sector_t block, long _size) Since this is a bdev relative routine we should also resolve the sector, i.e. the signature should drop the inode: int dax_clear_sectors(struct block_device *bdev, sector_t sector, long _size)
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2016-02-08 02:50 +0100 |
| Subject | Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() |
| Message-ID | <qZJ7I-6rS-11@gated-at.bofh.it> |
| In reply to | #1328554 |
On Sun, Feb 07, 2016 at 10:19:29AM -0800, Dan Williams wrote: > On Sat, Feb 6, 2016 at 11:19 PM, Ross Zwisler > <ross.zwisler@linux.intel.com> wrote: > > dax_clear_blocks() needs a valid struct block_device and previously it was > > using inode->i_sb->s_bdev in all cases. This is correct for normal inodes > > on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw > > block devices and for XFS real-time devices. > > > > Instead, have the caller pass in a struct block_device pointer which it > > knows to be correct. > > > > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> > > --- > > fs/dax.c | 4 ++-- > > fs/ext2/inode.c | 5 +++-- > > fs/xfs/xfs_aops.c | 2 +- > > fs/xfs/xfs_aops.h | 1 + > > fs/xfs/xfs_bmap_util.c | 4 +++- > > include/linux/dax.h | 3 ++- > > 6 files changed, 12 insertions(+), 7 deletions(-) > > > > diff --git a/fs/dax.c b/fs/dax.c > > index 227974a..4592241 100644 > > --- a/fs/dax.c > > +++ b/fs/dax.c > > @@ -83,9 +83,9 @@ struct page *read_dax_sector(struct block_device *bdev, sector_t n) > > * and hence this means the stack from this point must follow GFP_NOFS > > * semantics for all operations. > > */ > > -int dax_clear_blocks(struct inode *inode, sector_t block, long _size) > > +int dax_clear_blocks(struct inode *inode, struct block_device *bdev, > > + sector_t block, long _size) > > Since this is a bdev relative routine we should also resolve the > sector, i.e. the signature should drop the inode: > > int dax_clear_sectors(struct block_device *bdev, sector_t sector, long _size) The inode is still needed because dax_clear_blocks() needs inode->i_blkbits. Unless there is some easy way to get this from the bdev that I'm not seeing?
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <zwisler@gmail.com> |
|---|---|
| Date | 2016-02-08 05:40 +0100 |
| Subject | Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() |
| Message-ID | <qZLMe-8px-5@gated-at.bofh.it> |
| In reply to | #1328693 |
> On Feb 7, 2016, at 6:46 PM, Ross Zwisler <ross.zwisler@linux.intel.com> wrote: > >> On Sun, Feb 07, 2016 at 10:19:29AM -0800, Dan Williams wrote: >> On Sat, Feb 6, 2016 at 11:19 PM, Ross Zwisler >> <ross.zwisler@linux.intel.com> wrote: >>> dax_clear_blocks() needs a valid struct block_device and previously it was >>> using inode->i_sb->s_bdev in all cases. This is correct for normal inodes >>> on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw >>> block devices and for XFS real-time devices. >>> >>> Instead, have the caller pass in a struct block_device pointer which it >>> knows to be correct. >>> >>> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> >>> --- >>> fs/dax.c | 4 ++-- >>> fs/ext2/inode.c | 5 +++-- >>> fs/xfs/xfs_aops.c | 2 +- >>> fs/xfs/xfs_aops.h | 1 + >>> fs/xfs/xfs_bmap_util.c | 4 +++- >>> include/linux/dax.h | 3 ++- >>> 6 files changed, 12 insertions(+), 7 deletions(-) >>> >>> diff --git a/fs/dax.c b/fs/dax.c >>> index 227974a..4592241 100644 >>> --- a/fs/dax.c >>> +++ b/fs/dax.c >>> @@ -83,9 +83,9 @@ struct page *read_dax_sector(struct block_device *bdev, sector_t n) >>> * and hence this means the stack from this point must follow GFP_NOFS >>> * semantics for all operations. >>> */ >>> -int dax_clear_blocks(struct inode *inode, sector_t block, long _size) >>> +int dax_clear_blocks(struct inode *inode, struct block_device *bdev, >>> + sector_t block, long _size) >> >> Since this is a bdev relative routine we should also resolve the >> sector, i.e. the signature should drop the inode: >> >> int dax_clear_sectors(struct block_device *bdev, sector_t sector, long _size) > > The inode is still needed because dax_clear_blocks() needs inode->i_blkbits. > Unless there is some easy way to get this from the bdev that I'm not seeing? Never mind, you are passing in the sector, not the block. Sure, this seems better - I'll fix this for v2.
[toc] | [prev] | [next] | [standalone]
| From | Dave Chinner <david@fromorbit.com> |
|---|---|
| Date | 2016-02-07 23:10 +0100 |
| Subject | Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() |
| Message-ID | <qZFGO-4aL-17@gated-at.bofh.it> |
| In reply to | #1328436 |
On Sun, Feb 07, 2016 at 12:19:12AM -0700, Ross Zwisler wrote: > dax_clear_blocks() needs a valid struct block_device and previously it was > using inode->i_sb->s_bdev in all cases. This is correct for normal inodes > on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw > block devices and for XFS real-time devices. > > Instead, have the caller pass in a struct block_device pointer which it > knows to be correct. .... > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c > index 07ef29b..f722ba2 100644 > --- a/fs/xfs/xfs_bmap_util.c > +++ b/fs/xfs/xfs_bmap_util.c > @@ -73,9 +73,11 @@ xfs_zero_extent( > xfs_daddr_t sector = xfs_fsb_to_db(ip, start_fsb); > sector_t block = XFS_BB_TO_FSBT(mp, sector); > ssize_t size = XFS_FSB_TO_B(mp, count_fsb); > + struct inode *inode = VFS_I(ip); > > if (IS_DAX(VFS_I(ip))) > - return dax_clear_blocks(VFS_I(ip), block, size); > + return dax_clear_blocks(inode, xfs_find_bdev_for_inode(inode), > + block, size); Get rid of the local inode variable and use VFS_I(ip) like the code originally did. Do not change code that is unrelated to the modifcation being made, especially when it results in making the code an inconsistent mess of mixed pointer constructs.... Cheers, Dave. -- Dave Chinner david@fromorbit.com
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2016-02-08 02:50 +0100 |
| Subject | Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() |
| Message-ID | <qZJ7I-6rS-9@gated-at.bofh.it> |
| In reply to | #1328628 |
On Mon, Feb 08, 2016 at 09:03:29AM +1100, Dave Chinner wrote: > On Sun, Feb 07, 2016 at 12:19:12AM -0700, Ross Zwisler wrote: > > dax_clear_blocks() needs a valid struct block_device and previously it was > > using inode->i_sb->s_bdev in all cases. This is correct for normal inodes > > on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw > > block devices and for XFS real-time devices. > > > > Instead, have the caller pass in a struct block_device pointer which it > > knows to be correct. > .... > > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c > > index 07ef29b..f722ba2 100644 > > --- a/fs/xfs/xfs_bmap_util.c > > +++ b/fs/xfs/xfs_bmap_util.c > > @@ -73,9 +73,11 @@ xfs_zero_extent( > > xfs_daddr_t sector = xfs_fsb_to_db(ip, start_fsb); > > sector_t block = XFS_BB_TO_FSBT(mp, sector); > > ssize_t size = XFS_FSB_TO_B(mp, count_fsb); > > + struct inode *inode = VFS_I(ip); > > > > if (IS_DAX(VFS_I(ip))) > > - return dax_clear_blocks(VFS_I(ip), block, size); > > + return dax_clear_blocks(inode, xfs_find_bdev_for_inode(inode), > > + block, size); > > Get rid of the local inode variable and use VFS_I(ip) like the code > originally did. Do not change code that is unrelated to the > modifcation being made, especially when it results in making > the code an inconsistent mess of mixed pointer constructs.... The local 'inode' variable was added to avoid multiple calls for VFS_I() for the same 'ip'. That said, I'm happy to make the change.
[toc] | [prev] | [next] | [standalone]
| From | Dave Chinner <david@fromorbit.com> |
|---|---|
| Date | 2016-02-08 06:20 +0100 |
| Subject | Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() |
| Message-ID | <qZMoW-vo-3@gated-at.bofh.it> |
| In reply to | #1328692 |
On Sun, Feb 07, 2016 at 06:44:09PM -0700, Ross Zwisler wrote: > On Mon, Feb 08, 2016 at 09:03:29AM +1100, Dave Chinner wrote: > > On Sun, Feb 07, 2016 at 12:19:12AM -0700, Ross Zwisler wrote: > > > dax_clear_blocks() needs a valid struct block_device and previously it was > > > using inode->i_sb->s_bdev in all cases. This is correct for normal inodes > > > on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw > > > block devices and for XFS real-time devices. > > > > > > Instead, have the caller pass in a struct block_device pointer which it > > > knows to be correct. > > .... > > > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c > > > index 07ef29b..f722ba2 100644 > > > --- a/fs/xfs/xfs_bmap_util.c > > > +++ b/fs/xfs/xfs_bmap_util.c > > > @@ -73,9 +73,11 @@ xfs_zero_extent( > > > xfs_daddr_t sector = xfs_fsb_to_db(ip, start_fsb); > > > sector_t block = XFS_BB_TO_FSBT(mp, sector); > > > ssize_t size = XFS_FSB_TO_B(mp, count_fsb); > > > + struct inode *inode = VFS_I(ip); > > > > > > if (IS_DAX(VFS_I(ip))) > > > - return dax_clear_blocks(VFS_I(ip), block, size); > > > + return dax_clear_blocks(inode, xfs_find_bdev_for_inode(inode), > > > + block, size); > > > > Get rid of the local inode variable and use VFS_I(ip) like the code > > originally did. Do not change code that is unrelated to the > > modifcation being made, especially when it results in making > > the code an inconsistent mess of mixed pointer constructs.... > > The local 'inode' variable was added to avoid multiple calls for VFS_I() for > the same 'ip'. My point is you didn't achieve that. The end result of your patch is: struct inode *inode = VFS_I(ip); if (IS_DAX(VFS_I(ip))) return dax_clear_blocks(inode, xfs_find_bdev_for_inode(inode), block, size); So now we have a local variable, but we still have 2 calls to VFS_I(ip). i.e. this makes the code harder to read and understand than before for no benefit. Cheers, Dave. -- Dave Chinner david@fromorbit.com
[toc] | [prev] | [next] | [standalone]
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Date | 2016-02-08 16:40 +0100 |
| Subject | Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() |
| Message-ID | <qZW4W-7bA-9@gated-at.bofh.it> |
| In reply to | #1328767 |
On Mon, Feb 08, 2016 at 04:17:25PM +1100, Dave Chinner wrote: > On Sun, Feb 07, 2016 at 06:44:09PM -0700, Ross Zwisler wrote: > > On Mon, Feb 08, 2016 at 09:03:29AM +1100, Dave Chinner wrote: > > > On Sun, Feb 07, 2016 at 12:19:12AM -0700, Ross Zwisler wrote: > > > > dax_clear_blocks() needs a valid struct block_device and previously it was > > > > using inode->i_sb->s_bdev in all cases. This is correct for normal inodes > > > > on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw > > > > block devices and for XFS real-time devices. > > > > > > > > Instead, have the caller pass in a struct block_device pointer which it > > > > knows to be correct. > > > .... > > > > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c > > > > index 07ef29b..f722ba2 100644 > > > > --- a/fs/xfs/xfs_bmap_util.c > > > > +++ b/fs/xfs/xfs_bmap_util.c > > > > @@ -73,9 +73,11 @@ xfs_zero_extent( > > > > xfs_daddr_t sector = xfs_fsb_to_db(ip, start_fsb); > > > > sector_t block = XFS_BB_TO_FSBT(mp, sector); > > > > ssize_t size = XFS_FSB_TO_B(mp, count_fsb); > > > > + struct inode *inode = VFS_I(ip); > > > > > > > > if (IS_DAX(VFS_I(ip))) > > > > - return dax_clear_blocks(VFS_I(ip), block, size); > > > > + return dax_clear_blocks(inode, xfs_find_bdev_for_inode(inode), > > > > + block, size); > > > > > > Get rid of the local inode variable and use VFS_I(ip) like the code > > > originally did. Do not change code that is unrelated to the > > > modifcation being made, especially when it results in making > > > the code an inconsistent mess of mixed pointer constructs.... > > > > The local 'inode' variable was added to avoid multiple calls for VFS_I() for > > the same 'ip'. > > My point is you didn't achieve that. The end result of your patch > is: > > struct inode *inode = VFS_I(ip); > > if (IS_DAX(VFS_I(ip))) > return dax_clear_blocks(inode, xfs_find_bdev_for_inode(inode), > block, size); > > So now we have a local variable, but we still have 2 calls to > VFS_I(ip). i.e. this makes the code harder to read and understand > than before for no benefit. *facepalm* Yep, thanks for the correction.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web