Commit 3f32d335 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Improve the previous transparent union removal.

Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent de8ea577
...@@ -1013,9 +1013,8 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname, ...@@ -1013,9 +1013,8 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
* Convert the Unicode @name to the loaded NLS and pass it to the @filldir * Convert the Unicode @name to the loaded NLS and pass it to the @filldir
* callback. * callback.
* *
* If @index_type is INDEX_TYPE_ALLOCATION, @ia_page is the locked page * If @ia_page is not NULL it is the locked page containing the index
* containing the index allocation block containing the index entry @ie. * allocation block containing the index entry @ie.
* Otherwise, @ia_page is NULL.
* *
* Note, we drop (and then reacquire) the page lock on @ia_page across the * Note, we drop (and then reacquire) the page lock on @ia_page across the
* @filldir() call otherwise we would deadlock with NFSd when it calls ->lookup * @filldir() call otherwise we would deadlock with NFSd when it calls ->lookup
...@@ -1023,7 +1022,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname, ...@@ -1023,7 +1022,7 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
* retake the lock if we are returning a non-zero value as ntfs_readdir() * retake the lock if we are returning a non-zero value as ntfs_readdir()
* would need to drop the lock immediately anyway. * would need to drop the lock immediately anyway.
*/ */
static inline int ntfs_filldir(ntfs_volume *vol, loff_t *fpos, static inline int ntfs_filldir(ntfs_volume *vol, loff_t fpos,
ntfs_inode *ndir, struct page *ia_page, INDEX_ENTRY *ie, ntfs_inode *ndir, struct page *ia_page, INDEX_ENTRY *ie,
u8 *name, void *dirent, filldir_t filldir) u8 *name, void *dirent, filldir_t filldir)
{ {
...@@ -1066,9 +1065,9 @@ static inline int ntfs_filldir(ntfs_volume *vol, loff_t *fpos, ...@@ -1066,9 +1065,9 @@ static inline int ntfs_filldir(ntfs_volume *vol, loff_t *fpos,
if (ia_page) if (ia_page)
unlock_page(ia_page); unlock_page(ia_page);
ntfs_debug("Calling filldir for %s with len %i, fpos 0x%llx, inode " ntfs_debug("Calling filldir for %s with len %i, fpos 0x%llx, inode "
"0x%lx, DT_%s.", name, name_len, *fpos, mref, "0x%lx, DT_%s.", name, name_len, fpos, mref,
dt_type == DT_DIR ? "DIR" : "REG"); dt_type == DT_DIR ? "DIR" : "REG");
rc = filldir(dirent, name, name_len, *fpos, mref, dt_type); rc = filldir(dirent, name, name_len, fpos, mref, dt_type);
/* Relock the page but not if we are aborting ->readdir. */ /* Relock the page but not if we are aborting ->readdir. */
if (!rc && ia_page) if (!rc && ia_page)
lock_page(ia_page); lock_page(ia_page);
...@@ -1226,7 +1225,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -1226,7 +1225,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
/* Advance the position even if going to skip the entry. */ /* Advance the position even if going to skip the entry. */
fpos = (u8*)ie - (u8*)ir; fpos = (u8*)ie - (u8*)ir;
/* Submit the name to the filldir callback. */ /* Submit the name to the filldir callback. */
rc = ntfs_filldir(vol, &fpos, ndir, NULL, ie, name, dirent, rc = ntfs_filldir(vol, fpos, ndir, NULL, ie, name, dirent,
filldir); filldir);
if (rc) { if (rc) {
kfree(ir); kfree(ir);
...@@ -1412,7 +1411,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir) ...@@ -1412,7 +1411,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
* before returning, unless a non-zero value is returned in * before returning, unless a non-zero value is returned in
* which case the page is left unlocked. * which case the page is left unlocked.
*/ */
rc = ntfs_filldir(vol, &fpos, ndir, ia_page, ie, name, dirent, rc = ntfs_filldir(vol, fpos, ndir, ia_page, ie, name, dirent,
filldir); filldir);
if (rc) { if (rc) {
/* @ia_page is already unlocked in this case. */ /* @ia_page is already unlocked in this case. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment