Bcache writeback_percent max value












1














I'm tryng to set



writeback_percent


at a value > 40 but it only accept value between 0 and 40.



If i set



echo 50 >   /sys/block/bcache0/bcache/writeback_percent 


then when i read the value



more  /sys/block/bcache0/bcache/writeback_percent


i have 40.
For value<=40 the settings work fine.



My setting for cache type are



more  /sys/block/bcache0/bcache/cache_mode 
writethrough [writeback] writearound none


I know this is dangerous but this is not a problem for me.



As far as i understand writeback_percent is the % used from dirty data in cache, why i can't use 90% or 100% of available space?
May be i dont' understand quite well this settings?










share|improve this question






















  • Thank you @sourcedj, but may be i'm wrong but previously i was able to use a value > 40. This are file systems in use only for automatic test purpose so data are copied from a source that is not cached , backupped and so on so no problem if i lost this data. Anyway i understand that probability of data loss increase but i can't find any info about this limit, so i ask here about some clarification. And anyway my English is not perfect :)
    – Antimo
    Sep 10 '17 at 19:36










  • Sorry, I was criticizing only a small detail. Don't worry about it. It sounds like I wasn't very helpful! I don't know why bcache is not accepting a value > 40. It's a perfectly reasonable question to have, hopefully someone who knows more will see your post.
    – sourcejedi
    Sep 10 '17 at 19:44
















1














I'm tryng to set



writeback_percent


at a value > 40 but it only accept value between 0 and 40.



If i set



echo 50 >   /sys/block/bcache0/bcache/writeback_percent 


then when i read the value



more  /sys/block/bcache0/bcache/writeback_percent


i have 40.
For value<=40 the settings work fine.



My setting for cache type are



more  /sys/block/bcache0/bcache/cache_mode 
writethrough [writeback] writearound none


I know this is dangerous but this is not a problem for me.



As far as i understand writeback_percent is the % used from dirty data in cache, why i can't use 90% or 100% of available space?
May be i dont' understand quite well this settings?










share|improve this question






















  • Thank you @sourcedj, but may be i'm wrong but previously i was able to use a value > 40. This are file systems in use only for automatic test purpose so data are copied from a source that is not cached , backupped and so on so no problem if i lost this data. Anyway i understand that probability of data loss increase but i can't find any info about this limit, so i ask here about some clarification. And anyway my English is not perfect :)
    – Antimo
    Sep 10 '17 at 19:36










  • Sorry, I was criticizing only a small detail. Don't worry about it. It sounds like I wasn't very helpful! I don't know why bcache is not accepting a value > 40. It's a perfectly reasonable question to have, hopefully someone who knows more will see your post.
    – sourcejedi
    Sep 10 '17 at 19:44














1












1








1







I'm tryng to set



writeback_percent


at a value > 40 but it only accept value between 0 and 40.



If i set



echo 50 >   /sys/block/bcache0/bcache/writeback_percent 


then when i read the value



more  /sys/block/bcache0/bcache/writeback_percent


i have 40.
For value<=40 the settings work fine.



My setting for cache type are



more  /sys/block/bcache0/bcache/cache_mode 
writethrough [writeback] writearound none


I know this is dangerous but this is not a problem for me.



As far as i understand writeback_percent is the % used from dirty data in cache, why i can't use 90% or 100% of available space?
May be i dont' understand quite well this settings?










share|improve this question













I'm tryng to set



writeback_percent


at a value > 40 but it only accept value between 0 and 40.



If i set



echo 50 >   /sys/block/bcache0/bcache/writeback_percent 


then when i read the value



more  /sys/block/bcache0/bcache/writeback_percent


i have 40.
For value<=40 the settings work fine.



My setting for cache type are



more  /sys/block/bcache0/bcache/cache_mode 
writethrough [writeback] writearound none


I know this is dangerous but this is not a problem for me.



As far as i understand writeback_percent is the % used from dirty data in cache, why i can't use 90% or 100% of available space?
May be i dont' understand quite well this settings?







bcache






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 10 '17 at 13:06









Antimo

82




82












  • Thank you @sourcedj, but may be i'm wrong but previously i was able to use a value > 40. This are file systems in use only for automatic test purpose so data are copied from a source that is not cached , backupped and so on so no problem if i lost this data. Anyway i understand that probability of data loss increase but i can't find any info about this limit, so i ask here about some clarification. And anyway my English is not perfect :)
    – Antimo
    Sep 10 '17 at 19:36










  • Sorry, I was criticizing only a small detail. Don't worry about it. It sounds like I wasn't very helpful! I don't know why bcache is not accepting a value > 40. It's a perfectly reasonable question to have, hopefully someone who knows more will see your post.
    – sourcejedi
    Sep 10 '17 at 19:44


















  • Thank you @sourcedj, but may be i'm wrong but previously i was able to use a value > 40. This are file systems in use only for automatic test purpose so data are copied from a source that is not cached , backupped and so on so no problem if i lost this data. Anyway i understand that probability of data loss increase but i can't find any info about this limit, so i ask here about some clarification. And anyway my English is not perfect :)
    – Antimo
    Sep 10 '17 at 19:36










  • Sorry, I was criticizing only a small detail. Don't worry about it. It sounds like I wasn't very helpful! I don't know why bcache is not accepting a value > 40. It's a perfectly reasonable question to have, hopefully someone who knows more will see your post.
    – sourcejedi
    Sep 10 '17 at 19:44
















Thank you @sourcedj, but may be i'm wrong but previously i was able to use a value > 40. This are file systems in use only for automatic test purpose so data are copied from a source that is not cached , backupped and so on so no problem if i lost this data. Anyway i understand that probability of data loss increase but i can't find any info about this limit, so i ask here about some clarification. And anyway my English is not perfect :)
– Antimo
Sep 10 '17 at 19:36




Thank you @sourcedj, but may be i'm wrong but previously i was able to use a value > 40. This are file systems in use only for automatic test purpose so data are copied from a source that is not cached , backupped and so on so no problem if i lost this data. Anyway i understand that probability of data loss increase but i can't find any info about this limit, so i ask here about some clarification. And anyway my English is not perfect :)
– Antimo
Sep 10 '17 at 19:36












Sorry, I was criticizing only a small detail. Don't worry about it. It sounds like I wasn't very helpful! I don't know why bcache is not accepting a value > 40. It's a perfectly reasonable question to have, hopefully someone who knows more will see your post.
– sourcejedi
Sep 10 '17 at 19:44




Sorry, I was criticizing only a small detail. Don't worry about it. It sounds like I wasn't very helpful! I don't know why bcache is not accepting a value > 40. It's a perfectly reasonable question to have, hopefully someone who knows more will see your post.
– sourcejedi
Sep 10 '17 at 19:44










2 Answers
2






active

oldest

votes


















1














This is hardcoded value in the bcache drive code - linux/drivers/md/bcache/writeback.h. The only way to change this limit is to rebuild the driver from source.






share|improve this answer





















  • True, except wrong source file, at least in v4.19. It's in sysfs.c: elixir.bootlin.com/linux/v4.19.9/source/drivers/md/bcache/… . I don't know the relation between the two values.
    – sourcejedi
    Dec 16 at 13:53





















0














According to
https://evilpiepirate.org/git/linux-bcache.git/tree/Documentation/bcache.txt
writeback_percent
If nonzero, bcache tries to keep around this percentage of the cache dirty by throttling background writeback and using a PD controller to smoothly adjust the rate.



So this is a target objective for the amount of dirty cache. In that sense I would rather set it to 0%. And a value of 100% means "wait until the cache is full to start writing it to the backing device".



Since the dirty data is potentially at risk if you lose the cache SSD, why would you set such high amounts? I guess this is the reason why the developer hardcoded an upper boundary






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f391435%2fbcache-writeback-percent-max-value%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    This is hardcoded value in the bcache drive code - linux/drivers/md/bcache/writeback.h. The only way to change this limit is to rebuild the driver from source.






    share|improve this answer





















    • True, except wrong source file, at least in v4.19. It's in sysfs.c: elixir.bootlin.com/linux/v4.19.9/source/drivers/md/bcache/… . I don't know the relation between the two values.
      – sourcejedi
      Dec 16 at 13:53


















    1














    This is hardcoded value in the bcache drive code - linux/drivers/md/bcache/writeback.h. The only way to change this limit is to rebuild the driver from source.






    share|improve this answer





















    • True, except wrong source file, at least in v4.19. It's in sysfs.c: elixir.bootlin.com/linux/v4.19.9/source/drivers/md/bcache/… . I don't know the relation between the two values.
      – sourcejedi
      Dec 16 at 13:53
















    1












    1








    1






    This is hardcoded value in the bcache drive code - linux/drivers/md/bcache/writeback.h. The only way to change this limit is to rebuild the driver from source.






    share|improve this answer












    This is hardcoded value in the bcache drive code - linux/drivers/md/bcache/writeback.h. The only way to change this limit is to rebuild the driver from source.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Oct 19 at 20:38









    V.Gorbunov

    261




    261












    • True, except wrong source file, at least in v4.19. It's in sysfs.c: elixir.bootlin.com/linux/v4.19.9/source/drivers/md/bcache/… . I don't know the relation between the two values.
      – sourcejedi
      Dec 16 at 13:53




















    • True, except wrong source file, at least in v4.19. It's in sysfs.c: elixir.bootlin.com/linux/v4.19.9/source/drivers/md/bcache/… . I don't know the relation between the two values.
      – sourcejedi
      Dec 16 at 13:53


















    True, except wrong source file, at least in v4.19. It's in sysfs.c: elixir.bootlin.com/linux/v4.19.9/source/drivers/md/bcache/… . I don't know the relation between the two values.
    – sourcejedi
    Dec 16 at 13:53






    True, except wrong source file, at least in v4.19. It's in sysfs.c: elixir.bootlin.com/linux/v4.19.9/source/drivers/md/bcache/… . I don't know the relation between the two values.
    – sourcejedi
    Dec 16 at 13:53















    0














    According to
    https://evilpiepirate.org/git/linux-bcache.git/tree/Documentation/bcache.txt
    writeback_percent
    If nonzero, bcache tries to keep around this percentage of the cache dirty by throttling background writeback and using a PD controller to smoothly adjust the rate.



    So this is a target objective for the amount of dirty cache. In that sense I would rather set it to 0%. And a value of 100% means "wait until the cache is full to start writing it to the backing device".



    Since the dirty data is potentially at risk if you lose the cache SSD, why would you set such high amounts? I guess this is the reason why the developer hardcoded an upper boundary






    share|improve this answer




























      0














      According to
      https://evilpiepirate.org/git/linux-bcache.git/tree/Documentation/bcache.txt
      writeback_percent
      If nonzero, bcache tries to keep around this percentage of the cache dirty by throttling background writeback and using a PD controller to smoothly adjust the rate.



      So this is a target objective for the amount of dirty cache. In that sense I would rather set it to 0%. And a value of 100% means "wait until the cache is full to start writing it to the backing device".



      Since the dirty data is potentially at risk if you lose the cache SSD, why would you set such high amounts? I guess this is the reason why the developer hardcoded an upper boundary






      share|improve this answer


























        0












        0








        0






        According to
        https://evilpiepirate.org/git/linux-bcache.git/tree/Documentation/bcache.txt
        writeback_percent
        If nonzero, bcache tries to keep around this percentage of the cache dirty by throttling background writeback and using a PD controller to smoothly adjust the rate.



        So this is a target objective for the amount of dirty cache. In that sense I would rather set it to 0%. And a value of 100% means "wait until the cache is full to start writing it to the backing device".



        Since the dirty data is potentially at risk if you lose the cache SSD, why would you set such high amounts? I guess this is the reason why the developer hardcoded an upper boundary






        share|improve this answer














        According to
        https://evilpiepirate.org/git/linux-bcache.git/tree/Documentation/bcache.txt
        writeback_percent
        If nonzero, bcache tries to keep around this percentage of the cache dirty by throttling background writeback and using a PD controller to smoothly adjust the rate.



        So this is a target objective for the amount of dirty cache. In that sense I would rather set it to 0%. And a value of 100% means "wait until the cache is full to start writing it to the backing device".



        Since the dirty data is potentially at risk if you lose the cache SSD, why would you set such high amounts? I guess this is the reason why the developer hardcoded an upper boundary







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 16 at 11:56









        Rui F Ribeiro

        38.9k1479129




        38.9k1479129










        answered Oct 27 at 9:11









        hjohanns

        1




        1






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f391435%2fbcache-writeback-percent-max-value%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Morgemoulin

            Scott Moir

            Souastre