/srv/irclogs.ubuntu.com/2018/07/25/#ubuntu-kernel.txt

=== himcesjf_ is now known as him-cesjf
SysMan-OneHello There!10:36
* apw looks up10:36
SysMan-OneI have a question is related to the Block I/O.10:36
SysMan-OneIt's acceptable here or not ?10:36
apwi would ask and see what happens, as without more context i doubt i can tell if it is going to be off topic10:37
SysMan-OneOk.10:37
SysMan-OneI working on filter-driver which is live on top of other block-device.10:38
SysMan-OneI intercept READ/WRITE request to performs modifications of disk sectors before write to disk and before return to kernel.10:39
apwsomething like device-mapper then10:40
SysMan-OneRight!  The first question: I clonning oroginal BIO and  buffers to be written to disk as follows:10:41
SysMan-Oneif ( !(*dst = bio_clone_bioset(src, gfp /* GFP_KERNEL */, src->bi_pool /* NULL*/)) )10:42
SysMan-One{10:42
SysMan-Oneprintk(KERN_ERR  __MODULE__ ": bio_clone_bioset() -> NULL\n");10:42
SysMan-Onereturn-ENOMEM;10:42
SysMan-One}10:42
SysMan-Oneif ( status = bio_alloc_pages(*dst , GFP_KERNEL))10:42
SysMan-One{10:42
SysMan-Oneprintk(KERN_ERR  __MODULE__ ": bio_alloc_pages() -> %d\n", status);10:42
SysMan-Onereturnstatus;10:42
SysMan-One}10:42
SysMan-Onebio_copy_data(*dst, src);10:42
SysMan-OneIs it correct way ?10:42
SysMan-OneSorry, forgot include header:10:43
SysMan-Onestatic int __dua_bio_clone(10:43
SysMan-Onestruct bio*src,10:43
SysMan-Onestruct bio**dst10:43
SysMan-One)10:43
SysMan-One{10:43
SysMan-Oneintstatus;10:43
SysMan-Onegfp_tgfp =  GFP_NOIO; //GFP_KERNEL; // (GFP_NOIO | __GFP_HIGH);10:43
SysMan-OneSo, is there someone who can help me to resolve question ?10:46
apwSysMan-One, i would look at what device-mapper does as it is likley the kind of framework you are becoming10:54
apwthough why would you not make this a device-mapper personality in that case10:54
SysMan-OneThanks for you attention. A some task conditions prevents to use device-mapper way, it's not my choice.10:57
apwbut as it is doing the same kind of things, it is likley got the right ways of doing things in it10:57
apwone of the encryption personalitys sounds closest10:58
SysMan-OneI understand ... I cannot explain more about of the project, but u are right here, it's transparent en/de-cryption.10:59
SysMan-OneCan i  ask  second question ?11:01
apwyep11:01
SysMan-OneOk. Thanks.11:01
SysMan-OneI wrote "my_endio" routine to performs processing of the read disk blocks. I'll past some portions of code follows, ok ?11:04
apwbetter to pastebinit11:04
SysMan-OneHmmm ... It's about of 60-70 lines.11:04
apwright which is about 58 lines too much to paste in irc, as it comes out a one line per second and annoys everyone11:05
SysMan-OneOk. Will use pastebin and post the link.11:06
SysMan-OneThe piece of code which is supposed to process read disk blocks has been placed at the : https://pastebin.com/Pdyf4dNL11:13
SysMan-OneMay be I doing something wrong with iterators ?11:13
apwdoesn't bio_copy_block do the sort of thing you are doing, so how it handles them (which seems different) might help11:23
SysMan-OneI working under 4.4 and 4.15 kernels (Ubuntu 16) . I did not found "bio_copy_block" routine in the headers and sources. Do u mean something other ?11:27
apwin mainline kernel linus' tip it exists and looks like something you could use as a template11:28
SysMan-Onebio_copy_data - works for me, my primary question is related to memory allocation:11:30
SysMan-One bio_clone_bioset(src, GFP_NOIO, src->bi_pool) - it's right usage ?11:30
SysMan-Oneusing GFP_KERNEL in  bio_alloc_pages(*dst , GFP_KERNEL) - is acceptable ?11:31
SysMan-One(yes, bio_copy_data I have used as template) - but why .bv_length is zero ?!11:33
SysMan-OneHello !11:38
SysMan-OneCan we off from main chatting or it will bother u ?11:38
apwsure11:39
apwin both cases you care about whether it is safe to block there12:11
apwwhat locks you have held etc, as to whether it is safe12:12
apwusing NOIO seems logical as you are trying to do IO now, and if you12:12
apwcannot get enough memory to do _this_ io, trying to do io to free memory is no more likely to work12:12
=== SimonNL is now known as SimonNL_Afk
=== SimonNL_Afk is now known as SimonNL
keesapw: can I convince you to enable some kernel options? :) https://bugs.launchpad.net/ubuntu/+source/linux/+bug/178365122:42
ubot5Ubuntu bug 1783651 in linux (Ubuntu) "Please enable CONFIG_PAGE_POISONING" [Undecided,New]22:42
tyhickskees (cc apw): thanks - I left a comment but I'm at my eod at this point so that's all I can do for now :)23:02
keestyhicks: thanks! I don't want the sanity checking -- I think that's too heavy-duty for the general case.23:58

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!