
{"id":6319,"date":"2011-11-30T15:43:39","date_gmt":"2011-11-30T15:43:39","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=6319"},"modified":"2011-11-30T15:43:39","modified_gmt":"2011-11-30T15:43:39","slug":"dirtied-inode","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2011\/11\/30\/dirtied-inode\/","title":{"rendered":"What is a dirty inode  and  what are dirty bytes ?"},"content":{"rendered":"<h4><u>What is a Dirtied inode<\/u><\/h4>\n<pre>\nIt is a  common computer term that data in a  cache is \"clean\" when it  has been  synchronized, and  \"dirty\" when  it is  different.  A dirty inode  has had new data written  into it but it  has not been\nwritten to disk.\n\nsource : http:\/\/serverfault.com\/questions\/56374\/dirtied-inode<\/pre>\n<h5><u>dirty_inode: this method is called by the VFS to mark an inode dirty.<\/u><\/h5>\n<h4><u>What are dirty_bytes<\/u><\/h4>\n<pre>\nContains the amount  of dirty memory at which  a process generating disk writes will itself  start writeback.  Note: dirty_bytes is the counterpart of dirty_ratio. Only one  of them may be specified\nat a time.  When one  sysctl is  written  it is  immediately taken  into account to evaluate  the dirty\nmemory limits and  the other appears as 0 when read.  Note: the minimum value allowed for dirty_bytes is\ntwo  pages (in  bytes); any  value lower  than this  limit  will be ignored and the old configuration\nwill be retained.\n\nsource: http:\/\/kernel.org\/doc\/Documentation\/sysctl\/vm.txt\n<\/pre>\n<p><u>RELATED SHELL SESSION EXPOSURE<\/u><br \/>\n[bash light=&#8221;true&#8221;]<br \/>\n$cat \/proc\/sys\/vm\/dirty_background_bytes<br \/>\n0<br \/>\n$echo 1 &amp;amp;gt;  \/proc\/sys\/vm\/dirty_background_bytes<br \/>\n$cat \/proc\/sys\/vm\/dirty_background_bytes<br \/>\n1<br \/>\n$echo 1 &amp;amp;gt;  \/proc\/sys\/vm\/dirty_<br \/>\ndirty_background_bytes     dirty_bytes                dirty_ratio<br \/>\ndirty_background_ratio     dirty_expire_centisecs     dirty_writeback_centisecs<br \/>\n$echo 1 &amp;amp;gt;  \/proc\/sys\/vm\/dirty_background_ratio<\/p>\n<p>$echo 1 &amp;amp;gt;  \/proc\/sys\/vm\/dirty_background_ratio<br \/>\n$echo 0 &amp;amp;gt;  \/proc\/sys\/vm\/dirty_background_ratio<br \/>\n$cat \/proc\/sys\/vm\/dirty_bytes<br \/>\n0<br \/>\n$echo 1 &amp;amp;gt;  \/proc\/sys\/vm\/dirty_bytes<br \/>\n$echo 1 &amp;amp;gt;  \/proc\/sys\/vm\/<br \/>\nblock_dump                  legacy_va_layout            numa_zonelist_order<br \/>\ncompact_memory              lowmem_reserve_ratio        oom_dump_tasks<br \/>\ndirty_background_bytes      max_map_count               oom_kill_allocating_task<br \/>\ndirty_background_ratio      memory_failure_early_kill   overcommit_memory<br \/>\ndirty_bytes                 memory_failure_recovery     overcommit_ratio<br \/>\ndirty_expire_centisecs      min_free_kbytes             page-cluster<br \/>\ndirty_ratio                 min_slab_ratio              panic_on_oom<br \/>\ndirty_writeback_centisecs   min_unmapped_ratio          percpu_pagelist_fraction<br \/>\ndrop_caches                 mmap_min_addr               scan_unevictable_pages<br \/>\nextfrag_threshold           nr_hugepages                stat_interval<br \/>\nhugepages_treat_as_movable  nr_hugepages_mempolicy      swappiness<br \/>\nhugetlb_shm_group           nr_overcommit_hugepages     vfs_cache_pressure<br \/>\nlaptop_mode                 nr_pdflush_threads          zone_reclaim_mode<br \/>\n$echo 1 &amp;amp;gt;  \/proc\/sys\/vm\/dirty_expire_centisecs<br \/>\n$echo 1 &amp;amp;gt;  \/proc\/sys\/vm\/dirty_writeback_centisecs<br \/>\n$<\/p>\n<p>[\/bash]<br \/>\n<u>RELATED SOURCE CODE EXPOSURE<\/u><br \/>\n[c light=&#8221;true&#8221;]<br \/>\n\/*<br \/>\n * ext4_dirty_inode() is called from __mark_inode_dirty()<br \/>\n *<br \/>\n * We&#8217;re really interested in the case where a file is being extended.<br \/>\n * i_size has been changed by generic_commit_write() and we thus need<br \/>\n * to include the updated inode in the current transaction.<br \/>\n *<br \/>\n * Also, dquot_alloc_block() will always dirty the inode when blocks<br \/>\n * are allocated to the file.<br \/>\n *<br \/>\n * If the inode is marked synchronous, we don&#8217;t honour that here &#8211; doing<br \/>\n * so would cause a commit on atime updates, which we don&#8217;t bother doing.<br \/>\n * We handle synchronous inodes at the highest possible level.<br \/>\n *<br \/>\n * If only the I_DIRTY_TIME flag is set, we can skip everything.  If<br \/>\n * I_DIRTY_TIME and I_DIRTY_SYNC is set, the only inode fields we need<br \/>\n * to copy into the on-disk inode structure are the timestamp files.<br \/>\n *\/<br \/>\nvoid ext4_dirty_inode(struct inode *inode, int flags)<br \/>\n{<br \/>\n\thandle_t *handle;<\/p>\n<p>\tif (flags == I_DIRTY_TIME)<br \/>\n\t\treturn;<br \/>\n\thandle = ext4_journal_start(inode, EXT4_HT_INODE, 2);<br \/>\n\tif (IS_ERR(handle))<br \/>\n\t\tgoto out;<\/p>\n<p>\text4_mark_inode_dirty(handle, inode);<\/p>\n<p>\text4_journal_stop(handle);<br \/>\nout:<br \/>\n\treturn;<br \/>\n}<br \/>\n[\/c]<br \/>\nSOURCE CODE TAKEN FROM OFFICIAL LINUX KERNEL<br \/>\n<u>LINKS<\/u><br \/>\n<a href=\"https:\/\/www.kernel.org\/doc\/Documentation\/filesystems\/vfs.txt\">https:\/\/www.kernel.org\/doc\/Documentation\/filesystems\/vfs.txt<\/a><br \/>\n<a href=\"https:\/\/git.kernel.org\/pub\/scm\/linux\/kernel\/git\/torvalds\/linux.git\/tree\/fs\/ext4\/inode.c?h=v4.20-rc3\">https:\/\/git.kernel.org\/pub\/scm\/linux\/kernel\/git\/torvalds\/linux.git\/tree\/fs\/ext4\/inode.c?h=v4.20-rc3<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is a Dirtied inode It is a common computer term that data in a cache is &#8220;clean&#8221; when it has been synchronized, and &#8220;dirty&#8221; when it is different. A dirty inode has had new data written into it but it has not been written to disk. source : http:\/\/serverfault.com\/questions\/56374\/dirtied-inode dirty_inode: this method is called &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2011\/11\/30\/dirtied-inode\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;What is a dirty inode  and  what are dirty bytes ?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[43,83],"tags":[667,938],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/6319"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=6319"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/6319\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=6319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=6319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=6319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}