From owner-freebsd-fs@FreeBSD.ORG Sat Feb 25 14:25:58 2006 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9AE9016A420 for ; Sat, 25 Feb 2006 14:25:58 +0000 (GMT) (envelope-from weilei84@gmail.com) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.201]) by mx1.FreeBSD.org (Postfix) with ESMTP id ABC0743D62 for ; Sat, 25 Feb 2006 14:25:46 +0000 (GMT) (envelope-from weilei84@gmail.com) Received: by zproxy.gmail.com with SMTP id z31so535984nzd for ; Sat, 25 Feb 2006 06:25:46 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:mime-version:content-type; b=mUtsfTMMksKB5v1MRX/tf4e24VT8mf5fczGtpuEmNYJoExcI6eEOPh+MHF1UxVqzUGxzGf6uWlikaUeqjWInRB8q6uXKh/9gQtmd2VEXXAZRRtyIxvoaD6Zgi1PW2yBOAaBmEaOXWJOpIGbP9myMH8gk2ibiuSxqz2wQ67KLpdQ= Received: by 10.36.9.17 with SMTP id 17mr1805150nzi; Sat, 25 Feb 2006 06:25:46 -0800 (PST) Received: by 10.36.12.11 with HTTP; Sat, 25 Feb 2006 06:25:46 -0800 (PST) Message-ID: <36fee7420602250625h7271d694i7bfc9e69eda8ade7@mail.gmail.com> Date: Sat, 25 Feb 2006 22:25:46 +0800 From: "Wei Lei" To: freebsd-fs@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Manish Rai Jain Subject: Doubt about ntfs code: lockmgr with LK_INTERLOCK flag X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Feb 2006 14:25:58 -0000 Hi list, Nice to be here =3D) I am new here so just hope my first post doesn't mismatch the topic. I have a doubt when understanding the ntfs code with freebsd 5.4: ntfs_subr.c, function ntfs_ntget(). I understand that lockmgr() here is trying to get an exclusive lock and release the mutex ip->i_interlock, so that the protection can expand from use_count to the whole ntnode. But what's the significance of having such a mechanism? What could possibly happen if I do a mtx_unlock first then acquire the exclusive lock? This is the code in ntfs_subr.c 352 int 353 ntfs_ntget(ip) 354 struct ntnode *ip; 355 { 356 dprintf((*"ntfs_ntget: get ntnode %d: %p, usecount: %d\n"*, 357 ip->i_number, ip, ip->i_usecount)); 358 359 mtx_lock(&ip->i_interlock); 360 ip->i_usecount++; 361 lockmgr(&ip->i_lock, LK_EXCLUSIVE | LK_INTERLOCK, &ip->i_interlock, 362 NULL); 363 364 return 0; 365 } Regards, Wei Lei