GFS2: Make gfs2_dir_del update link count when required
authorSteven Whitehouse <swhiteho@redhat.com>
Mon, 9 May 2011 15:42:37 +0000 (16:42 +0100)
committerSteven Whitehouse <swhiteho@redhat.com>
Mon, 9 May 2011 15:42:37 +0000 (16:42 +0100)
commit855d23ce2665c56437bd88fa6a0d45b6713bd194
tree0678f8d0e93dfafd783bf9782f457bc7235b2128
parent2baee03fb916563d7cc597e5460e4cb938815c52
GFS2: Make gfs2_dir_del update link count when required

When we remove an entry from a directory, we can save ourselves
some trouble if we know the type of the entry in question, since
if it is itself a directory, we can update the link count of the
parent at the same time as removing the directory entry.

In addition this patch also merges the rmdir and unlink code which
was almost identical anyway. This eliminates the calls to remove
the . and .. directory entries on each rmdir (not needed since the
directory will be deallocated, anyway) which was the only thing preventing
passing the dentry to gfs2_dir_del(). The passing of the dentry
rather than just the name allows us to figure out the type of the entry
which is being removed, and thus adjust the link count when required.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/dir.c
fs/gfs2/dir.h
fs/gfs2/ops_inode.c