Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S265900AbUITDZg (ORCPT ); Sun, 19 Sep 2004 23:25:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S265909AbUITDZf (ORCPT ); Sun, 19 Sep 2004 23:25:35 -0400 Received: from zeus.kernel.org ([204.152.189.113]:58081 "EHLO zeus.kernel.org") by vger.kernel.org with ESMTP id S265900AbUITDXn (ORCPT ); Sun, 19 Sep 2004 23:23:43 -0400 Subject: [RFC][PATCH] inotify 0.9.2 From: John McCutchan To: linux-kernel@vger.kernel.org, nautilus-list@gnome.org, gamin-list@gnome.org, rml@ximian.com, viro@parcelfarce.linux.theplanet.co.uk Content-Type: multipart/mixed; boundary="=-M5YDSgOjhrUVewswyQF8" Message-Id: <1095652572.23128.2.camel@vertex> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sun, 19 Sep 2004 23:56:12 -0400 X-PMX-Version-Mac: 4.7.0.111621, Antispam-Engine: 2.0.0.0, Antispam-Data: 2004.9.19.1 X-PerlMx-Spam: Gauge=IIIIIII, Probability=7%, Report='__CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __MIME_VERSION 0, __SANE_MSGID 0' X-Spam-Flag: NO Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 54719 Lines: 794 --=-M5YDSgOjhrUVewswyQF8 Content-Type: text/plain Content-Transfer-Encoding: 7bit Hello, Here is release 0.9.2 of inotify. Attached is a patch to 2.6.8.1 --New in this version-- Works with 4K stack kernels Stops timers properly when using SMP A couple of things to note, The memory usage analysis below is worst case, when inotify is watching 65536 inodes. Inotify does pin inodes, but this is no different than dnotify. Inotify is designed as a replacement for dnotify. The key difference's are: Inotify does not require the file to be opened to watch it When a path you are watching is unmounted you will recieve an UNMOUNT event. Events are devilered over a FD that is select()-able not with signals. --COMPLEXITY-- I have been asked what the complexity of inotify is. Inotify has 2 path codes where complexity could be an issue: Adding a watcher to a device This code has to check if the inode is already being watched by the device, this is O(1) since the maximum number of devices is limited to 8. Removing a watch from a device This code has to do a search of all watches on the device to find the watch descriptor that is being asked to remove. This involves a linear search, but should not really be an issue because it is limited to 8192 entries. If this does turn in to a concern, I would replace the list of watches on the device with a sorted binary tree, so that the search could be done very quickly. The calls to inotify from the VFS code has a complexity of O(1) so inotify does not affect the speed of VFS operations. --MEMORY USAGE-- The inotify data structures are light weight: inotify watch is 40 bytes inotify device is 68 bytes inotify event is 272 bytes So assuming a device has 8192 watches, the structures are only going to consume 320KB of memory. With a maximum number of 8 devices allowed to exist at a time, this is still only 2.5 MB Each device can also have 256 events queued at a time, which sums to 68KB per device. And only .5 MB if all devices are opened and have a full event queue. So approximately 3 MB of memory are used in the rare case of everything open and full. Each inotify watch pins the inode of a directory/file in memory, the size of an inode is different per file system but lets assume that it is 512 byes. So assuming the maximum number of global watches are active, this would pin down 32 MB of inodes in the inode cache. Again not a problem on a modern system. On smaller systems, the maximum watches / events could be lowered to provide a smaller foot print. Older release notes: I am resubmitting inotify for comments and review. Inotify has changed drastically from the earlier proposal that Al Viro did not approve of. There is no longer any use of (device number, inode number) pairs. Please give this version of inotify a fresh view. Inotify is a character device that when opened offers 2 IOCTL's. (It actually has 4 but the other 2 are used for debugging) INOTIFY_WATCH: Which takes a path and event mask and returns a unique (to the instance of the driver) integer (wd [watch descriptor] from here on) that is a 1:1 mapping to the path passed. What happens is inotify gets the inode (and ref's the inode) for the path and adds a inotify_watcher structure to the inodes list of watchers. If this instance of the driver is already watching the path, the event mask will be updated and the original wd will be returned. INOTIFY_IGNORE: Which takes an integer (that you got from INOTIFY_WATCH) representing a wd that you are not interested in watching anymore. This will: send an IGNORE event to the device remove the inotify_watcher structure from the device and from the inode and unref the inode. After you are watching 1 or more paths, you can read from the fd and get events. The events are struct inotify_event. If you are watching a directory and something happens to a file in the directory the event will contain the filename (just the filename not the full path). Aside from the inotify character device driver. The changes to the kernel are very minor. The first change is adding calls to inotify_inode_queue_event and inotify_dentry_parent_queue_event from the various vfs functions. This is identical to dnotify. The second change is more serious, it adds a call to inotify_super_block_umount inside generic_shutdown_superblock. What inotify_super_block_umount does is: find all of the inodes that are on the super block being shut down, sends each watcher on each inode the UNMOUNT and IGNORED event removes the watcher structures from each instance of the device driver and each inode. unref's the inode. I would appreciate design review, code review and testing. John --=-M5YDSgOjhrUVewswyQF8 Content-Disposition: attachment; filename=inotify-0.9.2.diff Content-Type: text/x-patch; name=inotify-0.9.2.diff; charset=UTF-8 Content-Transfer-Encoding: base64 ZGlmZiAtdXJOIGxpbnV4LTIuNi44LjEvZHJpdmVycy9jaGFyL2lub3RpZnkuYyAuLi9saW51eC9k cml2ZXJzL2NoYXIvaW5vdGlmeS5jDQotLS0gbGludXgtMi42LjguMS9kcml2ZXJzL2NoYXIvaW5v dGlmeS5jCTE5NjktMTItMzEgMTk6MDA6MDAuMDAwMDAwMDAwIC0wNTAwDQorKysgLi4vbGludXgv ZHJpdmVycy9jaGFyL2lub3RpZnkuYwkyMDA0LTA5LTE4IDAzOjAzOjE1LjAwMDAwMDAwMCAtMDQw MA0KQEAgLTAsMCArMSw5NzcgQEANCisvKg0KKyAqIElub2RlIGJhc2VkIGRpcmVjdG9yeSBub3Rp ZmljYXRpb25zIGZvciBMaW51eC4NCisgKg0KKyAqIENvcHlyaWdodCAoQykgMjAwNCBKb2huIE1j Q3V0Y2hhbg0KKyAqDQorICogVGhpcyBwcm9ncmFtIGlzIGZyZWUgc29mdHdhcmU7IHlvdSBjYW4g cmVkaXN0cmlidXRlIGl0IGFuZC9vciBtb2RpZnkgaXQNCisgKiB1bmRlciB0aGUgdGVybXMgb2Yg dGhlIEdOVSBHZW5lcmFsIFB1YmxpYyBMaWNlbnNlIGFzIHB1Ymxpc2hlZCBieSB0aGUNCisgKiBG cmVlIFNvZnR3YXJlIEZvdW5kYXRpb247IGVpdGhlciB2ZXJzaW9uIDIsIG9yIChhdC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fREVCVUdfRklMRU4gIDB4MDAwMDAwMTANCisjZGVmaW5lIElOT1RJRllfREVCVUdfQUxM ICAgIDB4ZmZmZmZmZmYNCisNCisvKiBLZXJuZWwgQVBJICovDQorLyogQWRkcyBldmVudHMgdG8g YWxsIHdhdGNoZXJzIG9uIGlub2RlIHRoYXQgYXJlIGludGVyZXN0ZWQgaW4gbWFzayAqLw0KK3Zv aWQgaW5vdGlmeV9pbm9kZV9xdWV1ZV9ldmVudCAoc3RydWN0IGlub2RlICppbm9kZSwgdW5zaWdu ZWQgbG9uZyBtYXNrLCBjb25zdCBjaGFyICpmaWxlbmFtZSk7DQorLyogU2FtZSBhcyBhYm92ZSBi dXQgdXNlcyBkZW50cnkncyBpbm9kZSAqLw0KK3ZvaWQgaW5vdGlmeV9kZW50cnlfcGFyZW50X3F1 ZXVlX2V2ZW50IChzdHJ1Y3QgZGVudHJ5ICpkZW50cnksIHVuc2lnbmVkIGxvbmcgbWFzaywgY29u c3QgY2hhciAqZmlsZW5hbWUpOw0KKy8qIFRoaXMgd2lsbCByZW1vdmUgYWxsIHdhdGNoZXJzIGZy b20gYWxsIGlub2RlcyBvbiB0aGUgc3VwZXJibG9jayAqLw0KK3ZvaWQgaW5vdGlmeV9zdXBlcl9i bG9ja191bW91bnQgKHN0cnVjdCBzdXBlcl9ibG9jayAqc2IpOw0KKw0KKyNlbmRpZg0KKw0K --=-M5YDSgOjhrUVewswyQF8-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/