From owner-freebsd-fs@freebsd.org Sun Jan 3 21:08:38 2016 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9E30A6027E for ; Sun, 3 Jan 2016 21:08:38 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B6E51003 for ; Sun, 3 Jan 2016 21:08:38 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 74CA420493 for ; Sun, 3 Jan 2016 16:08:37 -0500 (EST) Received: from web3 ([10.202.2.213]) by compute3.internal (MEProxy); Sun, 03 Jan 2016 16:08:37 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=omzDUqN1AzlbHUg ZOijNkC1r0uM=; b=H+SqUA1ZaHdLLDk7dTEq/rzVnlXkmYzTAuqhN4FqZ6HmB22 fLTyEtdS4NY2Tv7QltMAS9O+Ueu4oMjyoazTGFcTjTNZt7y09crPCYU5ov9gGZYx Vjy8YHlZx137XW0aMccfGVeBKVSeQBZuuLhYuKSAzKvL40JxfcNXumiQCDb4= Received: by web3.nyi.internal (Postfix, from userid 99) id 4015A105C30; Sun, 3 Jan 2016 16:08:37 -0500 (EST) Message-Id: <1451855317.3739776.481776018.64F6C4D9@webmail.messagingengine.com> X-Sasl-Enc: AFcM3jcWGpOnnhEHU5pi0eRQXSZUMSQTk+FsI9Kr7C5h 1451855317 From: Mark Felder To: Chris Stankevitz , FreeBSD Filesystems MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-42cc5299 Subject: Re: Monitoring FS changes Date: Sun, 03 Jan 2016 15:08:37 -0600 In-Reply-To: <5684D810.6070700@stankevitz.com> References: <5684D810.6070700@stankevitz.com> X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2016 21:08:38 -0000 On Thu, Dec 31, 2015, at 01:24, Chris Stankevitz wrote: > Hi, > > I have a directory /foo that recursively contain ~250,000 > files/directories. > > I would like my application to know when a file is added, removed, or > modified under /foo. Is there a way to do that with FreeBSD? > > I believe on linux a facility called iNotify accomplishes this. > > On OSX a facility called FSEvents accomplishes this. > > kqueue apparently requires me to open every file and/or directory in my > tree... which won't work because I have so many. > > Is there any other option? Perhaps > > i=0 > while (true) > { > zfs snapshot pool/foo@${i} > zfs diff pool/foo@${i-1} pool/foo@${i} > ++i > } > Yes, Linux has inotify (just be aware it doesn't actually work on inodes like it indicates: changes to alternative hard links are ignored if they're not in the file path you're monitoring), OSX has fsevents, Solaris derivatives have File Events Notification, and we're stuck with kqueue which doesn't scale. I'm not aware of anything else being available for us. If someone, anyone out there is capable of bringing us something that does scale it would be greatly appreciated. Lots of nice Linux software uses this, but when they do port to FreeBSD we have to do full filesystem scans. It's such a waste. -- Mark Felder ports-secteam member feld@FreeBSD.org