Skip to contentSkip to conversation

tmpfs: ZERO_RANGE and COLLAPSE_RANGE not currently supported

PATCH In review Hugh Dickins 2 participants 2 messages Jun 16, 2014 – Jun 17, 2014

Subsystems (2)
lore
Share & tools
lore

Hugh Dickins

author maintainer
#0 lore raw

PATCH 1/1 tmpfs: ZERO_RANGE and COLLAPSE_RANGE not currently supported

I was well aware of FALLOC_FL_ZERO_RANGE and FALLOC_FL_COLLAPSE_RANGE support being added to fallocate(); but didn't realize until now that I had been too stupid to future-proof shmem_fallocate() against new additions. -EOPNOTSUPP instead of going on to ordinary fallocation.

---

 mm/shmem.c |    3 +++
 1 file changed, 3 insertions(+)
mm/shmem.c +3 -0
@@ -1728,6 +1728,9 @@ static long shmem_fallocate(struct file
 	pgoff_t start, index, end;
 	int error;
 
+	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
+		return -EOPNOTSUPP;
+
 	mutex_lock(&inode->i_mutex);
 
 	if (mode & FALLOC_FL_PUNCH_HOLE) {
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Hugh Dickins

Date: Sun, 15 Jun 2014 18:28:00 -0700 (PDT)
From: Hugh Dickins <[email protected]>
To: Andrew Morton <[email protected]>
Cc: Lukas Czerner <[email protected]>,
Namjae Jeon <[email protected]>, [email protected]
Subject: [PATCH] tmpfs: ZERO_RANGE and COLLAPSE_RANGE not currently supported

I was well aware of FALLOC_FL_ZERO_RANGE and FALLOC_FL_COLLAPSE_RANGE support being added to fallocate(); but didn't realize until now that I had been too stupid to future-proof shmem_fallocate() against new additions. -EOPNOTSUPP instead of going on to ordinary fallocation.

Looks good.

Quoted 21 lines

---

 mm/shmem.c |    3 +++
 1 file changed, 3 insertions(+)
mm/shmem.c +3 -0
@@ -1728,6 +1728,9 @@ static long shmem_fallocate(struct file
 	pgoff_t start, index, end;
 	int error;
 
+	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
+		return -EOPNOTSUPP;
+
 	mutex_lock(&inode->i_mutex);
 
 	if (mode & FALLOC_FL_PUNCH_HOLE) {