Skip to content

Commit

Permalink
shmem: SGP_QUICK and SGP_FAULT redundant
Browse files Browse the repository at this point in the history
Remove SGP_QUICK from the sgp_type enum: it was for shmem_populate and has no
users now.  Remove SGP_FAULT from the enum: SGP_CACHE does just as well (and
shmem_getpage is about to return with page always locked).

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Feb 5, 2008
1 parent 02098fe commit 27d54b3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@

/* Flag allocation requirements to shmem_getpage and shmem_swp_alloc */
enum sgp_type {
SGP_QUICK, /* don't try more than file page cache lookup */
SGP_READ, /* don't exceed i_size, don't allocate page */
SGP_CACHE, /* don't exceed i_size, may allocate page */
SGP_WRITE, /* may exceed i_size, may allocate page */
SGP_FAULT, /* same as SGP_CACHE, return with page locked */
};

static int shmem_getpage(struct inode *inode, unsigned long idx,
Expand Down Expand Up @@ -1116,8 +1114,6 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,
if (filepage && PageUptodate(filepage))
goto done;
error = 0;
if (sgp == SGP_QUICK)
goto failed;
gfp = mapping_gfp_mask(mapping);

spin_lock(&info->lock);
Expand Down Expand Up @@ -1292,7 +1288,7 @@ static int shmem_getpage(struct inode *inode, unsigned long idx,
done:
if (*pagep != filepage) {
*pagep = filepage;
if (sgp != SGP_FAULT)
if (sgp != SGP_CACHE)
unlock_page(filepage);

}
Expand All @@ -1315,7 +1311,7 @@ static int shmem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
if (((loff_t)vmf->pgoff << PAGE_CACHE_SHIFT) >= i_size_read(inode))
return VM_FAULT_SIGBUS;

error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_FAULT, &ret);
error = shmem_getpage(inode, vmf->pgoff, &vmf->page, SGP_CACHE, &ret);
if (error)
return ((error == -ENOMEM) ? VM_FAULT_OOM : VM_FAULT_SIGBUS);

Expand Down

0 comments on commit 27d54b3

Please sign in to comment.