Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite2ec512

Browse files
jankaradjbw
authored andcommitted
dm: Call proper helper to determine dax support
DM was calling generic_fsdax_supported() to determine whether a devicereferenced in the DM table supports DAX. However this is a helper for "leaf" device drivers so thatthey don't have to duplicate common generic checks. High level codeshould call dax_supported() helper which that calls into appropriatehelper for the particular device. This problem manifested itself askernel messages:dm-3: error: dax access failed (-95)when lvm2-testsuite run in cases where a DM device was stacked on top ofanother DM device.Fixes:7bf7eac ("dax: Arrange for dax_supported check to span multiple devices")Cc: <stable@vger.kernel.org>Tested-by: Adrian Huang <ahuang12@lenovo.com>Signed-off-by: Jan Kara <jack@suse.cz>Acked-by: Mike Snitzer <snitzer@redhat.com>Reported-by: kernel test robot <lkp@intel.com>Link:https://lore.kernel.org/r/160061715195.13131.5503173247632041975.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent02186d8 commite2ec512

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed

‎drivers/dax/super.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,15 @@ EXPORT_SYMBOL_GPL(dax_direct_access);
325325
booldax_supported(structdax_device*dax_dev,structblock_device*bdev,
326326
intblocksize,sector_tstart,sector_tlen)
327327
{
328+
if (!dax_dev)
329+
return false;
330+
328331
if (!dax_alive(dax_dev))
329332
return false;
330333

331334
returndax_dev->ops->dax_supported(dax_dev,bdev,blocksize,start,len);
332335
}
336+
EXPORT_SYMBOL_GPL(dax_supported);
333337

334338
size_tdax_copy_from_iter(structdax_device*dax_dev,pgoff_tpgoff,void*addr,
335339
size_tbytes,structiov_iter*i)

‎drivers/md/dm-table.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -860,10 +860,14 @@ EXPORT_SYMBOL_GPL(dm_table_set_type);
860860
intdevice_supports_dax(structdm_target*ti,structdm_dev*dev,
861861
sector_tstart,sector_tlen,void*data)
862862
{
863-
intblocksize=*(int*)data;
863+
intblocksize=*(int*)data,id;
864+
boolrc;
864865

865-
returngeneric_fsdax_supported(dev->dax_dev,dev->bdev,blocksize,
866-
start,len);
866+
id=dax_read_lock();
867+
rc=dax_supported(dev->dax_dev,dev->bdev,blocksize,start,len);
868+
dax_read_unlock(id);
869+
870+
returnrc;
867871
}
868872

869873
/* Check devices support synchronous DAX */

‎include/linux/dax.h‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ static inline bool generic_fsdax_supported(struct dax_device *dax_dev,
130130
return__generic_fsdax_supported(dax_dev,bdev,blocksize,start,
131131
sectors);
132132
}
133+
booldax_supported(structdax_device*dax_dev,structblock_device*bdev,
134+
intblocksize,sector_tstart,sector_tlen);
133135

134136
staticinlinevoidfs_put_dax(structdax_device*dax_dev)
135137
{
@@ -157,6 +159,13 @@ static inline bool generic_fsdax_supported(struct dax_device *dax_dev,
157159
return false;
158160
}
159161

162+
staticinlinebooldax_supported(structdax_device*dax_dev,
163+
structblock_device*bdev,intblocksize,sector_tstart,
164+
sector_tlen)
165+
{
166+
return false;
167+
}
168+
160169
staticinlinevoidfs_put_dax(structdax_device*dax_dev)
161170
{
162171
}
@@ -189,14 +198,23 @@ static inline void dax_unlock_page(struct page *page, dax_entry_t cookie)
189198
}
190199
#endif
191200

201+
#ifIS_ENABLED(CONFIG_DAX)
192202
intdax_read_lock(void);
193203
voiddax_read_unlock(intid);
204+
#else
205+
staticinlineintdax_read_lock(void)
206+
{
207+
return0;
208+
}
209+
210+
staticinlinevoiddax_read_unlock(intid)
211+
{
212+
}
213+
#endif/* CONFIG_DAX */
194214
booldax_alive(structdax_device*dax_dev);
195215
void*dax_get_private(structdax_device*dax_dev);
196216
longdax_direct_access(structdax_device*dax_dev,pgoff_tpgoff,longnr_pages,
197217
void**kaddr,pfn_t*pfn);
198-
booldax_supported(structdax_device*dax_dev,structblock_device*bdev,
199-
intblocksize,sector_tstart,sector_tlen);
200218
size_tdax_copy_from_iter(structdax_device*dax_dev,pgoff_tpgoff,void*addr,
201219
size_tbytes,structiov_iter*i);
202220
size_tdax_copy_to_iter(structdax_device*dax_dev,pgoff_tpgoff,void*addr,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp