€•—OŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ'/translations/zh_CN/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/zh_TW/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/it_IT/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ja_JP/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ko_KR/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/sp_SP/filesystems/inotify”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh£sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1h¡hhhžhhŸŒA/var/lib/git/docbuild/linux/Documentation/filesystems/inotify.rst”h KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ?Inotify - A Powerful yet Simple File Change Notification System”h]”hŒ?Inotify - A Powerful yet Simple File Change Notification System”…””}”(hh»hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hh¶hžhhŸh³h KubhŒ paragraph”“”)”}”(hŒ”h]”(hŒ-Document started 15 Mar 2005 by Robert Love <”…””}”(hhËhžhhŸNh NubhŒ reference”“”)”}”(hŒrml@novell.com”h]”hŒrml@novell.com”…””}”(hhÕhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œmailto:rml@novell.com”uh1hÓhhËubhŒ>”…””}”(hhËhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K hh¶hžhubhÊ)”}”(hŒFDocument updated 4 Jan 2015 by Zhang Zhen ”h]”(hŒ+Document updated 4 Jan 2015 by Zhang Zhen <”…””}”(hhïhžhhŸNh NubhÔ)”}”(hŒzhenzhang.zhang@huawei.com”h]”hŒzhenzhang.zhang@huawei.com”…””}”(hh÷hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”Œrefuri”Œ!mailto:zhenzhang.zhang@huawei.com”uh1hÓhhïubhŒ>”…””}”(hhïhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K hh¶hžhubhŒ block_quote”“”)”}”(hŒJ- Deleted obsoleted interface, just refer to manpages for user interface. ”h]”hŒ bullet_list”“”)”}”(hhh]”hŒ list_item”“”)”}”(hŒHDeleted obsoleted interface, just refer to manpages for user interface. ”h]”hÊ)”}”(hŒGDeleted obsoleted interface, just refer to manpages for user interface.”h]”hŒGDeleted obsoleted interface, just refer to manpages for user interface.”…””}”(hj"hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubah}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1jhŸh³h K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhŸh³h K hh¶hžhubhŒenumerated_list”“”)”}”(hhh]”j)”}”(hŒ Rationale ”h]”hÊ)”}”(hŒ Rationale”h]”hŒ Rationale”…””}”(hjMhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjIubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjFhžhhŸh³h Nubah}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œ lowerroman”Œprefix”Œ(”Œsuffix”Œ)”uh1jDhh¶hžhhŸh³h KubhŒdefinition_list”“”)”}”(hhh]”(hŒdefinition_list_item”“”)”}”(hŒ`Q: What is the design decision behind not tying the watch to the open fd of the watched object? ”h]”(hŒterm”“”)”}”(hŒQ:”h]”hŒQ:”…””}”(hjzhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jxhŸh³h KhjtubhŒ definition”“”)”}”(hhh]”hÊ)”}”(hŒ\What is the design decision behind not tying the watch to the open fd of the watched object?”h]”hŒ\What is the design decision behind not tying the watch to the open fd of the watched object?”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjŠubah}”(h]”h ]”h"]”h$]”h&]”uh1jˆhjtubeh}”(h]”h ]”h"]”h$]”h&]”uh1jrhŸh³h Khjoubjs)”}”(hXeA: Watches are associated with an open inotify device, not an open file. This solves the primary problem with dnotify: keeping the file open pins the file and thus, worse, pins the mount. Dnotify is therefore infeasible for use on a desktop system with removable media as the media cannot be unmounted. Watching a file should not require that it be open. ”h]”(jy)”}”(hŒA:”h]”hŒA:”…””}”(hj«hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jxhŸh³h Khj§ubj‰)”}”(hhh]”hÊ)”}”(hXaWatches are associated with an open inotify device, not an open file. This solves the primary problem with dnotify: keeping the file open pins the file and thus, worse, pins the mount. Dnotify is therefore infeasible for use on a desktop system with removable media as the media cannot be unmounted. Watching a file should not require that it be open.”h]”hXaWatches are associated with an open inotify device, not an open file. This solves the primary problem with dnotify: keeping the file open pins the file and thus, worse, pins the mount. Dnotify is therefore infeasible for use on a desktop system with removable media as the media cannot be unmounted. Watching a file should not require that it be open.”…””}”(hj¼hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khj¹ubah}”(h]”h ]”h"]”h$]”h&]”uh1jˆhj§ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jrhŸh³h Khjohžhubjs)”}”(hŒ^Q: What is the design decision behind using an-fd-per-instance as opposed to an fd-per-watch? ”h]”(jy)”}”(hŒQ:”h]”hŒQ:”…””}”(hjÚhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jxhŸh³h KhjÖubj‰)”}”(hhh]”hÊ)”}”(hŒZWhat is the design decision behind using an-fd-per-instance as opposed to an fd-per-watch?”h]”hŒZWhat is the design decision behind using an-fd-per-instance as opposed to an fd-per-watch?”…””}”(hjëhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khjèubah}”(h]”h ]”h"]”h$]”h&]”uh1jˆhjÖubeh}”(h]”h ]”h"]”h$]”h&]”uh1jrhŸh³h Khjohžhubjs)”}”(hX¥A: An fd-per-watch quickly consumes more file descriptors than are allowed, more fd's than are feasible to manage, and more fd's than are optimally select()-able. Yes, root can bump the per-process fd limit and yes, users can use epoll, but requiring both is a silly and extraneous requirement. A watch consumes less memory than an open file, separating the number spaces is thus sensible. The current design is what user-space developers want: Users initialize inotify, once, and add n watches, requiring but one fd and no twiddling with fd limits. Initializing an inotify instance two thousand times is silly. If we can implement user-space's preferences cleanly--and we can, the idr layer makes stuff like this trivial--then we should. There are other good arguments. With a single fd, there is a single item to block on, which is mapped to a single queue of events. The single fd returns all watch events and also any potential out-of-band data. If every fd was a separate watch, - There would be no way to get event ordering. Events on file foo and file bar would pop poll() on both fd's, but there would be no way to tell which happened first. A single queue trivially gives you ordering. Such ordering is crucial to existing applications such as Beagle. Imagine "mv a b ; mv b a" events without ordering. - We'd have to maintain n fd's and n internal queues with state, versus just one. It is a lot messier in the kernel. A single, linear queue is the data structure that makes sense. - User-space developers prefer the current API. The Beagle guys, for example, love it. Trust me, I asked. It is not a surprise: Who'd want to manage and block on 1000 fd's via select? - No way to get out of band data. - 1024 is still too low. ;-) When you talk about designing a file change notification system that scales to 1000s of directories, juggling 1000s of fd's just does not seem the right interface. It is too heavy. Additionally, it _is_ possible to more than one instance and juggle more than one queue and thus more than one associated fd. There need not be a one-fd-per-process mapping; it is one-fd-per-queue and a process can easily want more than one queue. ”h]”(jy)”}”(hŒA:”h]”hŒA:”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jxhŸh³h KKhjubj‰)”}”(hhh]”(hÊ)”}”(hXãAn fd-per-watch quickly consumes more file descriptors than are allowed, more fd's than are feasible to manage, and more fd's than are optimally select()-able. Yes, root can bump the per-process fd limit and yes, users can use epoll, but requiring both is a silly and extraneous requirement. A watch consumes less memory than an open file, separating the number spaces is thus sensible. The current design is what user-space developers want: Users initialize inotify, once, and add n watches, requiring but one fd and no twiddling with fd limits. Initializing an inotify instance two thousand times is silly. If we can implement user-space's preferences cleanly--and we can, the idr layer makes stuff like this trivial--then we should.”h]”hXéAn fd-per-watch quickly consumes more file descriptors than are allowed, more fd’s than are feasible to manage, and more fd’s than are optimally select()-able. Yes, root can bump the per-process fd limit and yes, users can use epoll, but requiring both is a silly and extraneous requirement. A watch consumes less memory than an open file, separating the number spaces is thus sensible. The current design is what user-space developers want: Users initialize inotify, once, and add n watches, requiring but one fd and no twiddling with fd limits. Initializing an inotify instance two thousand times is silly. If we can implement user-space’s preferences cleanly--and we can, the idr layer makes stuff like this trivial--then we should.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K!hjubhÊ)”}”(hŒ÷There are other good arguments. With a single fd, there is a single item to block on, which is mapped to a single queue of events. The single fd returns all watch events and also any potential out-of-band data. If every fd was a separate watch,”h]”hŒ÷There are other good arguments. With a single fd, there is a single item to block on, which is mapped to a single queue of events. The single fd returns all watch events and also any potential out-of-band data. If every fd was a separate watch,”…””}”(hj(hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K-hjubj)”}”(hhh]”(j)”}”(hXJThere would be no way to get event ordering. Events on file foo and file bar would pop poll() on both fd's, but there would be no way to tell which happened first. A single queue trivially gives you ordering. Such ordering is crucial to existing applications such as Beagle. Imagine "mv a b ; mv b a" events without ordering. ”h]”hÊ)”}”(hXIThere would be no way to get event ordering. Events on file foo and file bar would pop poll() on both fd's, but there would be no way to tell which happened first. A single queue trivially gives you ordering. Such ordering is crucial to existing applications such as Beagle. Imagine "mv a b ; mv b a" events without ordering.”h]”hXOThere would be no way to get event ordering. Events on file foo and file bar would pop poll() on both fd’s, but there would be no way to tell which happened first. A single queue trivially gives you ordering. Such ordering is crucial to existing applications such as Beagle. Imagine “mv a b ; mv b a†events without ordering.”…””}”(hj=hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K2hj9ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj6ubj)”}”(hŒ´We'd have to maintain n fd's and n internal queues with state, versus just one. It is a lot messier in the kernel. A single, linear queue is the data structure that makes sense. ”h]”hÊ)”}”(hŒ³We'd have to maintain n fd's and n internal queues with state, versus just one. It is a lot messier in the kernel. A single, linear queue is the data structure that makes sense.”h]”hŒ·We’d have to maintain n fd’s and n internal queues with state, versus just one. It is a lot messier in the kernel. A single, linear queue is the data structure that makes sense.”…””}”(hjUhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K8hjQubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj6ubj)”}”(hŒ¹User-space developers prefer the current API. The Beagle guys, for example, love it. Trust me, I asked. It is not a surprise: Who'd want to manage and block on 1000 fd's via select? ”h]”hÊ)”}”(hŒ¸User-space developers prefer the current API. The Beagle guys, for example, love it. Trust me, I asked. It is not a surprise: Who'd want to manage and block on 1000 fd's via select?”h]”hŒ¼User-space developers prefer the current API. The Beagle guys, for example, love it. Trust me, I asked. It is not a surprise: Who’d want to manage and block on 1000 fd’s via select?”…””}”(hjmhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K