* Some information about direct-io support on ubifs @ 2024-11-11 9:37 Michael Nazzareno Trimarchi 2024-11-11 14:14 ` Zhihao Cheng 0 siblings, 1 reply; 8+ messages in thread From: Michael Nazzareno Trimarchi @ 2024-11-11 9:37 UTC (permalink / raw) To: linux-mtd, Richard Weinberger, Zhihao Cheng Hi all I would like to have some information on how to implement direct-io support in ubifs. I have tried to mount squashfs image as file in ubifs using loopback and direct-io but it seems that loop can not handle when this is on top of ubifs. From what I understand from the code it seems that the requirement is that the direct-io is implemented in the filesystem where the file is stored. I have simulated using nand sim. The idea is to reduce the buffering. I'm open to have other suggestions regarding this too. Michael ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Some information about direct-io support on ubifs 2024-11-11 9:37 Some information about direct-io support on ubifs Michael Nazzareno Trimarchi @ 2024-11-11 14:14 ` Zhihao Cheng 2024-11-11 15:08 ` Michael Nazzareno Trimarchi 0 siblings, 1 reply; 8+ messages in thread From: Zhihao Cheng @ 2024-11-11 14:14 UTC (permalink / raw) To: Michael Nazzareno Trimarchi, linux-mtd, Richard Weinberger 在 2024/11/11 17:37, Michael Nazzareno Trimarchi 写道: > Hi all > > I would like to have some information on how to implement direct-io > support in ubifs. I have tried to mount squashfs image as file in > ubifs using loopback and direct-io but it seems that loop can not > handle when this is on top of ubifs. From what I understand from the > code it seems that the requirement is that the direct-io is > implemented in the filesystem where the file is stored. I have > simulated using nand sim. The idea is to reduce the buffering. I'm > open to have other suggestions regarding this too. > > Michael > . > Hi Michael, There is a discussion(9 years ago) about ubifs dio[1], of course we cannot implement it as a fake interface now. Before talking about adding dio support for UBIFS, let me know some background information. What's the purpose of using dio for opening squashfs image file? What's the goal of reducing buffer you mentioned above, Better performance? Less memory usage? [1] https://lore.kernel.org/lkml/1440016553-26481-2-git-send-email-richard@nod.at/ ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Some information about direct-io support on ubifs 2024-11-11 14:14 ` Zhihao Cheng @ 2024-11-11 15:08 ` Michael Nazzareno Trimarchi 2024-11-14 14:10 ` Zhihao Cheng 0 siblings, 1 reply; 8+ messages in thread From: Michael Nazzareno Trimarchi @ 2024-11-11 15:08 UTC (permalink / raw) To: Zhihao Cheng; +Cc: linux-mtd, Richard Weinberger Hi On Mon, Nov 11, 2024 at 3:15 PM Zhihao Cheng <chengzhihao1@huawei.com> wrote: > > 在 2024/11/11 17:37, Michael Nazzareno Trimarchi 写道: > > Hi all > > > > I would like to have some information on how to implement direct-io > > support in ubifs. I have tried to mount squashfs image as file in > > ubifs using loopback and direct-io but it seems that loop can not > > handle when this is on top of ubifs. From what I understand from the > > code it seems that the requirement is that the direct-io is > > implemented in the filesystem where the file is stored. I have > > simulated using nand sim. The idea is to reduce the buffering. I'm > > open to have other suggestions regarding this too. > > > > Michael > > . > > > Hi Michael, > There is a discussion(9 years ago) about ubifs dio[1], of course we > cannot implement it as a fake interface now. > Before talking about adding dio support for UBIFS, let me know some > background information. What's the purpose of using dio for opening > squashfs image file? What's the goal of reducing buffer you mentioned > above, Better performance? Less memory usage? > > > [1] > https://lore.kernel.org/lkml/1440016553-26481-2-git-send-email-richard@nod.at/ The goal is less memory usage. Each squashfs is mounted using loopback device, so according to some thread on direct-io, I understand that we then not have buffering two times on ubifs level and loop level, but the thread was not clear to me. The device has very limited capability and memory. I have done some test with fuse but I did not have numbers to compare them Michael ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Some information about direct-io support on ubifs 2024-11-11 15:08 ` Michael Nazzareno Trimarchi @ 2024-11-14 14:10 ` Zhihao Cheng 2024-11-18 9:43 ` Michael Nazzareno Trimarchi 0 siblings, 1 reply; 8+ messages in thread From: Zhihao Cheng @ 2024-11-14 14:10 UTC (permalink / raw) To: Michael Nazzareno Trimarchi; +Cc: linux-mtd, Richard Weinberger 在 2024/11/11 23:08, Michael Nazzareno Trimarchi 写道: > Hi > > On Mon, Nov 11, 2024 at 3:15 PM Zhihao Cheng <chengzhihao1@huawei.com> wrote: >> >> 在 2024/11/11 17:37, Michael Nazzareno Trimarchi 写道: >>> Hi all >>> >>> I would like to have some information on how to implement direct-io >>> support in ubifs. I have tried to mount squashfs image as file in >>> ubifs using loopback and direct-io but it seems that loop can not >>> handle when this is on top of ubifs. From what I understand from the >>> code it seems that the requirement is that the direct-io is >>> implemented in the filesystem where the file is stored. I have >>> simulated using nand sim. The idea is to reduce the buffering. I'm >>> open to have other suggestions regarding this too. >>> >>> Michael >>> . >>> >> Hi Michael, >> There is a discussion(9 years ago) about ubifs dio[1], of course we >> cannot implement it as a fake interface now. >> Before talking about adding dio support for UBIFS, let me know some >> background information. What's the purpose of using dio for opening >> squashfs image file? What's the goal of reducing buffer you mentioned >> above, Better performance? Less memory usage? >> >> >> [1] >> https://lore.kernel.org/lkml/1440016553-26481-2-git-send-email-richard@nod.at/ > > > The goal is less memory usage. Each squashfs is mounted using loopback > device, so according > to some thread on direct-io, I understand that we then not have > buffering two times on ubifs level and loop > level, but the thread was not clear to me. The device has very limited > capability and memory. I have done some > test with fuse but I did not have numbers to compare them > Hi Michael, I think it is possible to support DIO for UBIFS in theory, but it is not an easy task. We need to imeplement read/write functions, and we should iterate user data bytes by UBIFS_BLOCK_SIZE unit. 1. Things should be done in write function: 1) Do space reservation, refer to ubifs_write_begin -> allocate_budget, of cource the origin 'req.new_page' cannot be used and we should define a new budget type based on UBIFS_BLOCK_SIZE. 2) record user data in data node, refer to do_writepage -> ubifs_jnl_write_data 3) invalidate page cache after io complete, refer to dio_complete -> kiocb_invalidate_post_direct_write 4) release budget, refer to do_writepage -> release_new_page_budget/release_existing_page_budget 2. Things should be done in read function: 1) sync page cache data to disk, make sure that dio reading get the latest user data, refer to __blockdev_direct_IO -> filemap_write_and_wait_range 2) read data from UHIFS, refer to do_readpage -> read_block Maybe there are many trivial details during developing. > > Michael > . > ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Some information about direct-io support on ubifs 2024-11-14 14:10 ` Zhihao Cheng @ 2024-11-18 9:43 ` Michael Nazzareno Trimarchi 2024-11-18 10:02 ` Richard Weinberger 0 siblings, 1 reply; 8+ messages in thread From: Michael Nazzareno Trimarchi @ 2024-11-18 9:43 UTC (permalink / raw) To: Zhihao Cheng; +Cc: linux-mtd, Richard Weinberger Hi On Thu, Nov 14, 2024 at 3:10 PM Zhihao Cheng <chengzhihao1@huawei.com> wrote: > > 在 2024/11/11 23:08, Michael Nazzareno Trimarchi 写道: > > Hi > > > > On Mon, Nov 11, 2024 at 3:15 PM Zhihao Cheng <chengzhihao1@huawei.com> wrote: > >> > >> 在 2024/11/11 17:37, Michael Nazzareno Trimarchi 写道: > >>> Hi all > >>> First of all, thank you very much. > >>> I would like to have some information on how to implement direct-io > >>> support in ubifs. I have tried to mount squashfs image as file in > >>> ubifs using loopback and direct-io but it seems that loop can not > >>> handle when this is on top of ubifs. From what I understand from the > >>> code it seems that the requirement is that the direct-io is > >>> implemented in the filesystem where the file is stored. I have > >>> simulated using nand sim. The idea is to reduce the buffering. I'm > >>> open to have other suggestions regarding this too. > >>> > >>> Michael > >>> . > >>> > >> Hi Michael, > >> There is a discussion(9 years ago) about ubifs dio[1], of course we > >> cannot implement it as a fake interface now. > >> Before talking about adding dio support for UBIFS, let me know some > >> background information. What's the purpose of using dio for opening > >> squashfs image file? What's the goal of reducing buffer you mentioned > >> above, Better performance? Less memory usage? > >> > >> > >> [1] > >> https://lore.kernel.org/lkml/1440016553-26481-2-git-send-email-richard@nod.at/ > > > > > > The goal is less memory usage. Each squashfs is mounted using loopback > > device, so according > > to some thread on direct-io, I understand that we then not have > > buffering two times on ubifs level and loop > > level, but the thread was not clear to me. The device has very limited > > capability and memory. I have done some > > test with fuse but I did not have numbers to compare them > > > > Hi Michael, > > I think it is possible to support DIO for UBIFS in theory, but it is not > an easy task. We need to imeplement read/write functions, and we should > iterate user data bytes by UBIFS_BLOCK_SIZE unit. > 1. Things should be done in write function: > 1) Do space reservation, refer to ubifs_write_begin -> > allocate_budget, of cource the origin 'req.new_page' cannot be used and > we should define a new budget type based on UBIFS_BLOCK_SIZE. I have seen that allocate a budget using an allocated request. Here you mean to change the interface a bit to require the allocated budget that must be multiple of BLOCK_SIZE? If the question looks silly, sorry for that. > 2) record user data in data node, refer to do_writepage -> > ubifs_jnl_write_data > 3) invalidate page cache after io complete, refer to dio_complete -> > kiocb_invalidate_post_direct_write > 4) release budget, refer to do_writepage -> > release_new_page_budget/release_existing_page_budget Ok. Let me give myself a few days to study. > 2. Things should be done in read function: > 1) sync page cache data to disk, make sure that dio reading get the > latest user data, refer to __blockdev_direct_IO -> > filemap_write_and_wait_range > 2) read data from UHIFS, refer to do_readpage -> read_block > Maybe there are many trivial details during developing. Here the nice thing is to know how you test at the moment the ubifs and easy way to development it. Michael > > > > Michael > > . > > > -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Some information about direct-io support on ubifs 2024-11-18 9:43 ` Michael Nazzareno Trimarchi @ 2024-11-18 10:02 ` Richard Weinberger 2024-11-18 10:05 ` Michael Nazzareno Trimarchi 0 siblings, 1 reply; 8+ messages in thread From: Richard Weinberger @ 2024-11-18 10:02 UTC (permalink / raw) To: Michael Nazzareno Trimarchi; +Cc: chengzhihao1, linux-mtd ----- Ursprüngliche Mail ----- > Von: "Michael Nazzareno Trimarchi" <michael@amarulasolutions.com> >> >>> I would like to have some information on how to implement direct-io >> >>> support in ubifs. I have tried to mount squashfs image as file in >> >>> ubifs using loopback and direct-io but it seems that loop can not >> >>> handle when this is on top of ubifs. From what I understand from the >> >>> code it seems that the requirement is that the direct-io is >> >>> implemented in the filesystem where the file is stored. I have >> >>> simulated using nand sim. The idea is to reduce the buffering. I'm >> >>> open to have other suggestions regarding this too. Why are you using UBIFS anyway for this? Just place the squashfs inside an UBI volume. Thanks, //richard ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Some information about direct-io support on ubifs 2024-11-18 10:02 ` Richard Weinberger @ 2024-11-18 10:05 ` Michael Nazzareno Trimarchi 2024-11-18 10:20 ` Richard Weinberger 0 siblings, 1 reply; 8+ messages in thread From: Michael Nazzareno Trimarchi @ 2024-11-18 10:05 UTC (permalink / raw) To: Richard Weinberger; +Cc: chengzhihao1, linux-mtd Hi Richard On Mon, Nov 18, 2024 at 11:02 AM Richard Weinberger <richard@nod.at> wrote: > > ----- Ursprüngliche Mail ----- > > Von: "Michael Nazzareno Trimarchi" <michael@amarulasolutions.com> > >> >>> I would like to have some information on how to implement direct-io > >> >>> support in ubifs. I have tried to mount squashfs image as file in > >> >>> ubifs using loopback and direct-io but it seems that loop can not > >> >>> handle when this is on top of ubifs. From what I understand from the > >> >>> code it seems that the requirement is that the direct-io is > >> >>> implemented in the filesystem where the file is stored. I have > >> >>> simulated using nand sim. The idea is to reduce the buffering. I'm > >> >>> open to have other suggestions regarding this too. > > Why are you using UBIFS anyway for this? Just place the squashfs inside > an UBI volume. Yes this is one of the solutions I have proposed, but the idea is to update a single squashfs container and not bound the limit in the beginning of the device life. Does it make sense to you? <rootfs ubifs> you can create any size/number of containers if they fit inside the device. Michael > > Thanks, > //richard -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@amarulasolutions.com __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@amarulasolutions.com www.amarulasolutions.com ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Some information about direct-io support on ubifs 2024-11-18 10:05 ` Michael Nazzareno Trimarchi @ 2024-11-18 10:20 ` Richard Weinberger 0 siblings, 0 replies; 8+ messages in thread From: Richard Weinberger @ 2024-11-18 10:20 UTC (permalink / raw) To: Michael Nazzareno Trimarchi; +Cc: chengzhihao1, linux-mtd ----- Ursprüngliche Mail ----- > Von: "Michael Nazzareno Trimarchi" <michael@amarulasolutions.com> >> Why are you using UBIFS anyway for this? Just place the squashfs inside >> an UBI volume. > > Yes this is one of the solutions I have proposed, but the idea is to > update a single squashfs > container and not bound the limit in the beginning of the device life. > Does it make sense to you? Not really because you can add/resize UBI volumes at runtime. So, let UBI be the container. You can eben give them names. Thanks, //richard ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-11-18 10:20 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-11-11 9:37 Some information about direct-io support on ubifs Michael Nazzareno Trimarchi 2024-11-11 14:14 ` Zhihao Cheng 2024-11-11 15:08 ` Michael Nazzareno Trimarchi 2024-11-14 14:10 ` Zhihao Cheng 2024-11-18 9:43 ` Michael Nazzareno Trimarchi 2024-11-18 10:02 ` Richard Weinberger 2024-11-18 10:05 ` Michael Nazzareno Trimarchi 2024-11-18 10:20 ` Richard Weinberger
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.