=== himcesjf_ is now known as him-cesjf [10:36] Hello There! [10:36] * apw looks up [10:36] I have a question is related to the Block I/O. [10:36] It's acceptable here or not ? [10:37] i would ask and see what happens, as without more context i doubt i can tell if it is going to be off topic [10:37] Ok. [10:38] I working on filter-driver which is live on top of other block-device. [10:39] I intercept READ/WRITE request to performs modifications of disk sectors before write to disk and before return to kernel. [10:40] something like device-mapper then [10:41] Right! The first question: I clonning oroginal BIO and buffers to be written to disk as follows: [10:42] if ( !(*dst = bio_clone_bioset(src, gfp /* GFP_KERNEL */, src->bi_pool /* NULL*/)) ) [10:42] { [10:42] printk(KERN_ERR __MODULE__ ": bio_clone_bioset() -> NULL\n"); [10:42] return -ENOMEM; [10:42] } [10:42] if ( status = bio_alloc_pages(*dst , GFP_KERNEL)) [10:42] { [10:42] printk(KERN_ERR __MODULE__ ": bio_alloc_pages() -> %d\n", status); [10:42] return status; [10:42] } [10:42] bio_copy_data(*dst, src); [10:42] Is it correct way ? [10:43] Sorry, forgot include header: [10:43] static int __dua_bio_clone ( [10:43] struct bio *src, [10:43] struct bio **dst [10:43] ) [10:43] { [10:43] int status; [10:43] gfp_t gfp = GFP_NOIO; //GFP_KERNEL; // (GFP_NOIO | __GFP_HIGH); [10:46] So, is there someone who can help me to resolve question ? [10:54] SysMan-One, i would look at what device-mapper does as it is likley the kind of framework you are becoming [10:54] though why would you not make this a device-mapper personality in that case [10:57] Thanks for you attention. A some task conditions prevents to use device-mapper way, it's not my choice. [10:57] but as it is doing the same kind of things, it is likley got the right ways of doing things in it [10:58] one of the encryption personalitys sounds closest [10:59] I understand ... I cannot explain more about of the project, but u are right here, it's transparent en/de-cryption. [11:01] Can i ask second question ? [11:01] yep [11:01] Ok. Thanks. [11:04] I wrote "my_endio" routine to performs processing of the read disk blocks. I'll past some portions of code follows, ok ? [11:04] better to pastebinit [11:04] Hmmm ... It's about of 60-70 lines. [11:05] right which is about 58 lines too much to paste in irc, as it comes out a one line per second and annoys everyone [11:06] Ok. Will use pastebin and post the link. [11:13] The piece of code which is supposed to process read disk blocks has been placed at the : https://pastebin.com/Pdyf4dNL [11:13] May be I doing something wrong with iterators ? [11:23] doesn't bio_copy_block do the sort of thing you are doing, so how it handles them (which seems different) might help [11:27] I 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:28] in mainline kernel linus' tip it exists and looks like something you could use as a template [11:30] bio_copy_data - works for me, my primary question is related to memory allocation: [11:30] bio_clone_bioset(src, GFP_NOIO, src->bi_pool) - it's right usage ? [11:31] using GFP_KERNEL in bio_alloc_pages(*dst , GFP_KERNEL) - is acceptable ? [11:33] (yes, bio_copy_data I have used as template) - but why .bv_length is zero ?! [11:38] Hello ! [11:38] Can we off from main chatting or it will bother u ? [11:39] sure [12:11] in both cases you care about whether it is safe to block there [12:12] what locks you have held etc, as to whether it is safe [12:12] using NOIO seems logical as you are trying to do IO now, and if you [12:12] cannot get enough memory to do _this_ io, trying to do io to free memory is no more likely to work === SimonNL is now known as SimonNL_Afk === SimonNL_Afk is now known as SimonNL [22:42] apw: can I convince you to enable some kernel options? :) https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1783651 [22:42] Ubuntu bug 1783651 in linux (Ubuntu) "Please enable CONFIG_PAGE_POISONING" [Undecided,New] [23:02] kees (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:58] tyhicks: thanks! I don't want the sanity checking -- I think that's too heavy-duty for the general case.