diff mbox series

block: Export __blk_flush_plug to modules

Message ID 20250410030903.3393536-1-weilongping@oppo.com (mailing list archive)
State New
Headers show
Series block: Export __blk_flush_plug to modules | expand

Commit Message

LongPing Wei April 10, 2025, 3:09 a.m. UTC
Fix the compile error when dm-bufio is built as a module.

1. dm-bufio module use blk_flush_plug();
2. blk_flush_plug is an inline function and it calls __blk_flush_plug.

Signed-off-by: LongPing Wei <weilongping@oppo.com>
---
 block/blk-core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Christoph Hellwig April 10, 2025, 7:36 a.m. UTC | #1
On Thu, Apr 10, 2025 at 11:09:04AM +0800, LongPing Wei wrote:
> Fix the compile error when dm-bufio is built as a module.
> 
> 1. dm-bufio module use blk_flush_plug();
> 2. blk_flush_plug is an inline function and it calls __blk_flush_plug.

Then don't call blk_flush_plug from dm-bufio, as drivers should not
micro-manage plug flushing.

Note that at least in current upstream and linux-next dm-bufio does
not actually call blk_flush_plug, so I'm not sure where your
report comes from.
LongPing Wei April 10, 2025, 8:06 a.m. UTC | #2
On 2025/4/10 15:36, Christoph Hellwig wrote:
> On Thu, Apr 10, 2025 at 11:09:04AM +0800, LongPing Wei wrote:
>> Fix the compile error when dm-bufio is built as a module.
>>
>> 1. dm-bufio module use blk_flush_plug();
>> 2. blk_flush_plug is an inline function and it calls __blk_flush_plug.
> 
> Then don't call blk_flush_plug from dm-bufio, as drivers should not
> micro-manage plug flushing.
> 
> Note that at least in current upstream and linux-next dm-bufio does
> not actually call blk_flush_plug, so I'm not sure where your
> report comes from.
> 
Hi, Christoph

Stephen reported that a compile error happened when he tried merging
device-mapper tree.

> Hi all,
> 
> After merging the device-mapper tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
> 
> ERROR: modpost: "__blk_flush_plug" [drivers/md/dm-bufio.ko] undefined!
> 
> Caused by commit
> 
>   713ff5c782f5 ("dm-bufio: improve the performance of __dm_bufio_prefetch")
> 
> I have used the device-mapper tree from next-20250409 for today.


More details are here.

https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=713ff5c782f5a497bd0e93ca19607daf5bf34005

https://lore.kernel.org/dm-devel/66bf8a8e-0a7d-47b8-9676-dc2e8c596bdb@oppo.com/T/#t

Thanks

LongPing
Yu Kuai April 10, 2025, 9:11 a.m. UTC | #3
Hi,

在 2025/04/10 16:06, LongPing Wei 写道:
> On 2025/4/10 15:36, Christoph Hellwig wrote:
>> On Thu, Apr 10, 2025 at 11:09:04AM +0800, LongPing Wei wrote:
>>> Fix the compile error when dm-bufio is built as a module.
>>>
>>> 1. dm-bufio module use blk_flush_plug();
>>> 2. blk_flush_plug is an inline function and it calls __blk_flush_plug.
>>
>> Then don't call blk_flush_plug from dm-bufio, as drivers should not
>> micro-manage plug flushing.
>>
>> Note that at least in current upstream and linux-next dm-bufio does
>> not actually call blk_flush_plug, so I'm not sure where your
>> report comes from.
>>
> Hi, Christoph
> 
> Stephen reported that a compile error happened when he tried merging
> device-mapper tree.
> 
>> Hi all,
>>
>> After merging the device-mapper tree, today's linux-next build (powerpc
>> ppc64_defconfig) failed like this:
>>
>> ERROR: modpost: "__blk_flush_plug" [drivers/md/dm-bufio.ko] undefined!
>>
>> Caused by commit
>>
>>   713ff5c782f5 ("dm-bufio: improve the performance of 
>> __dm_bufio_prefetch")
>>
>> I have used the device-mapper tree from next-20250409 for today.
> 
> 
> More details are here.
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=713ff5c782f5a497bd0e93ca19607daf5bf34005 

So, this patch has compile problem, I think it should be removed from
dm tree.

BTW, I don't get it from commit message, why you need to flush plug when
bio is not contiguous. Other than bio merge, plug is also benefit from
batch submitting:

__blk_mq_flush_plug_list
  q->mq_ops->queue_rqs(&plug->mq_list)

Thanks,
Kuai

> 
> 
> https://lore.kernel.org/dm-devel/66bf8a8e-0a7d-47b8-9676-dc2e8c596bdb@oppo.com/T/#t 
> 
> 
> Thanks
> 
> LongPing
> 
> .
>
LongPing Wei April 10, 2025, 9:44 a.m. UTC | #4
On 2025/4/10 17:11, Yu Kuai wrote:
> Hi,
> 
> 在 2025/04/10 16:06, LongPing Wei 写道:
>> On 2025/4/10 15:36, Christoph Hellwig wrote:
>>> On Thu, Apr 10, 2025 at 11:09:04AM +0800, LongPing Wei wrote:
>>>> Fix the compile error when dm-bufio is built as a module.
>>>>
>>>> 1. dm-bufio module use blk_flush_plug();
>>>> 2. blk_flush_plug is an inline function and it calls __blk_flush_plug.
>>>
>>> Then don't call blk_flush_plug from dm-bufio, as drivers should not
>>> micro-manage plug flushing.
>>>
>>> Note that at least in current upstream and linux-next dm-bufio does
>>> not actually call blk_flush_plug, so I'm not sure where your
>>> report comes from.
>>>
>> Hi, Christoph
>>
>> Stephen reported that a compile error happened when he tried merging
>> device-mapper tree.
>>
>>> Hi all,
>>>
>>> After merging the device-mapper tree, today's linux-next build (powerpc
>>> ppc64_defconfig) failed like this:
>>>
>>> ERROR: modpost: "__blk_flush_plug" [drivers/md/dm-bufio.ko] undefined!
>>>
>>> Caused by commit
>>>
>>>   713ff5c782f5 ("dm-bufio: improve the performance of 
>>> __dm_bufio_prefetch")
>>>
>>> I have used the device-mapper tree from next-20250409 for today.
>>
>>
>> More details are here.
>>
>> https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux- 
>> dm.git/commit/?h=for-next&id=713ff5c782f5a497bd0e93ca19607daf5bf34005 
> 
> So, this patch has compile problem, I think it should be removed from
> dm tree.
> 

If __blk_flush_plug cannot be exported, this commit need to be removed
at first.

> BTW, I don't get it from commit message, why you need to flush plug when
> bio is not contiguous. Other than bio merge, plug is also benefit from
> batch submitting:
> 
> __blk_mq_flush_plug_list
>   q->mq_ops->queue_rqs(&plug->mq_list)
> 
> Thanks,
> Kuai
> 
>>
>>
>> https://lore.kernel.org/dm-devel/66bf8a8e-0a7d-47b8-9676- 
>> dc2e8c596bdb@oppo.com/T/#t
>>
>> Thanks
>>
>> LongPing
>>
>> .
>>
> 

Previous discussion is here.

https://lore.kernel.org/dm-devel/20250325104942.1170388-1-weilongping@oppo.com/T/#ma327528c69f6fd62e15febb5c94164c8e10c7c0d

> It seems that verity_prefetch_io doesn't work efficiently.
> dm_bufio_prefetch_with_ioprio
>    __dm_bufio_prefetch
>      blk_start_plug
>      for loop
>        __bufio_new
>        submit_io
>        cond_resched
>      blk_finish_plug
> 
> If more than one hash blocks need to be prefetched, cond_resched will
> be called in each loop and blk_finish_plug will be called at the end.
> 
> The requests for hash blocks may have not been dispatched when the
> requests for data blocks have been completed.

The change ("dm-bufio: improve the performance of __dm_bufio_prefetch")
wants to decrease the probability of waiting hash blocks in
verity_end_io.


Thanks

LongPing
Mikulas Patocka April 10, 2025, 10:44 a.m. UTC | #5
On Thu, 10 Apr 2025, Yu Kuai wrote:

> Hi,
> 
> 在 2025/04/10 16:06, LongPing Wei 写道:
> > On 2025/4/10 15:36, Christoph Hellwig wrote:
> > > On Thu, Apr 10, 2025 at 11:09:04AM +0800, LongPing Wei wrote:
> > > > Fix the compile error when dm-bufio is built as a module.
> > > > 
> > > > 1. dm-bufio module use blk_flush_plug();
> > > > 2. blk_flush_plug is an inline function and it calls __blk_flush_plug.
> > > 
> > > Then don't call blk_flush_plug from dm-bufio, as drivers should not
> > > micro-manage plug flushing.
> > > 
> > > Note that at least in current upstream and linux-next dm-bufio does
> > > not actually call blk_flush_plug, so I'm not sure where your
> > > report comes from.
> > > 
> > Hi, Christoph
> > 
> > Stephen reported that a compile error happened when he tried merging
> > device-mapper tree.
> > 
> > > Hi all,
> > > 
> > > After merging the device-mapper tree, today's linux-next build (powerpc
> > > ppc64_defconfig) failed like this:
> > > 
> > > ERROR: modpost: "__blk_flush_plug" [drivers/md/dm-bufio.ko] undefined!
> > > 
> > > Caused by commit
> > > 
> > >   713ff5c782f5 ("dm-bufio: improve the performance of
> > > __dm_bufio_prefetch")
> > > 
> > > I have used the device-mapper tree from next-20250409 for today.
> > 
> > 
> > More details are here.
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=713ff5c782f5a497bd0e93ca19607daf5bf34005 
> 
> So, this patch has compile problem, I think it should be removed from
> dm tree.

OK, I've just removed it.

Mikulas

> BTW, I don't get it from commit message, why you need to flush plug when
> bio is not contiguous. Other than bio merge, plug is also benefit from
> batch submitting:
> 
> __blk_mq_flush_plug_list
>  q->mq_ops->queue_rqs(&plug->mq_list)
> 
> Thanks,
> Kuai
> 
> > 
> > 
> > https://lore.kernel.org/dm-devel/66bf8a8e-0a7d-47b8-9676-dc2e8c596bdb@oppo.com/T/#t 
> > 
> > Thanks
> > 
> > LongPing
> > 
> > .
> > 
>
diff mbox series

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index e8cc270a453f..4d72ebeb18f7 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1230,6 +1230,7 @@  void __blk_flush_plug(struct blk_plug *plug, bool from_schedule)
 	plug->cur_ktime = 0;
 	current->flags &= ~PF_BLOCK_TS;
 }
+EXPORT_SYMBOL(__blk_flush_plug);
 
 /**
  * blk_finish_plug - mark the end of a batch of submitted I/O