提交 48d546a8 编写于 作者: J Johannes Thumshirn 提交者: Damien Le Moal

zonefs: provide no-lock zonefs_io_error variant

Subsequent patches need to call zonefs_io_error() with the i_truncate_mutex
already held, so factor out the body of zonefs_io_error() into
__zonefs_io_error() which can be called from with the i_truncate_mutex
held.
Signed-off-by: NJohannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: NDamien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: NDamien Le Moal <damien.lemoal@wdc.com>
上级 5498d5f9
...@@ -348,7 +348,7 @@ static int zonefs_io_error_cb(struct blk_zone *zone, unsigned int idx, ...@@ -348,7 +348,7 @@ static int zonefs_io_error_cb(struct blk_zone *zone, unsigned int idx,
* eventually correct the file size and zonefs inode write pointer offset * eventually correct the file size and zonefs inode write pointer offset
* (which can be out of sync with the drive due to partial write failures). * (which can be out of sync with the drive due to partial write failures).
*/ */
static void zonefs_io_error(struct inode *inode, bool write) static void __zonefs_io_error(struct inode *inode, bool write)
{ {
struct zonefs_inode_info *zi = ZONEFS_I(inode); struct zonefs_inode_info *zi = ZONEFS_I(inode);
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
...@@ -362,8 +362,6 @@ static void zonefs_io_error(struct inode *inode, bool write) ...@@ -362,8 +362,6 @@ static void zonefs_io_error(struct inode *inode, bool write)
}; };
int ret; int ret;
mutex_lock(&zi->i_truncate_mutex);
/* /*
* Memory allocations in blkdev_report_zones() can trigger a memory * Memory allocations in blkdev_report_zones() can trigger a memory
* reclaim which may in turn cause a recursion into zonefs as well as * reclaim which may in turn cause a recursion into zonefs as well as
...@@ -379,7 +377,14 @@ static void zonefs_io_error(struct inode *inode, bool write) ...@@ -379,7 +377,14 @@ static void zonefs_io_error(struct inode *inode, bool write)
zonefs_err(sb, "Get inode %lu zone information failed %d\n", zonefs_err(sb, "Get inode %lu zone information failed %d\n",
inode->i_ino, ret); inode->i_ino, ret);
memalloc_noio_restore(noio_flag); memalloc_noio_restore(noio_flag);
}
static void zonefs_io_error(struct inode *inode, bool write)
{
struct zonefs_inode_info *zi = ZONEFS_I(inode);
mutex_lock(&zi->i_truncate_mutex);
__zonefs_io_error(inode, write);
mutex_unlock(&zi->i_truncate_mutex); mutex_unlock(&zi->i_truncate_mutex);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册