Skip to content

Commit 5def53c

Browse files
sbashirogregkh
authored andcommitted
nfsd: Drop dprintk in blocklayout xdr functions
[ Upstream commit e339967 ] Minor clean up. Instead of dprintk there are appropriate error codes. Signed-off-by: Sergey Bashirov <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Chuck Lever <[email protected]> Stable-dep-of: d68886b ("NFSD: Fix last write offset handling in layoutcommit") Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 434b399 commit 5def53c

File tree

1 file changed

+7
-33
lines changed

1 file changed

+7
-33
lines changed

fs/nfsd/blocklayoutxdr.c

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -139,28 +139,19 @@ nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
139139
struct iomap *iomaps;
140140
u32 nr_iomaps, i;
141141

142-
if (len < sizeof(u32)) {
143-
dprintk("%s: extent array too small: %u\n", __func__, len);
142+
if (len < sizeof(u32))
144143
return nfserr_bad_xdr;
145-
}
146144
len -= sizeof(u32);
147-
if (len % PNFS_BLOCK_EXTENT_SIZE) {
148-
dprintk("%s: extent array invalid: %u\n", __func__, len);
145+
if (len % PNFS_BLOCK_EXTENT_SIZE)
149146
return nfserr_bad_xdr;
150-
}
151147

152148
nr_iomaps = be32_to_cpup(p++);
153-
if (nr_iomaps != len / PNFS_BLOCK_EXTENT_SIZE) {
154-
dprintk("%s: extent array size mismatch: %u/%u\n",
155-
__func__, len, nr_iomaps);
149+
if (nr_iomaps != len / PNFS_BLOCK_EXTENT_SIZE)
156150
return nfserr_bad_xdr;
157-
}
158151

159152
iomaps = kcalloc(nr_iomaps, sizeof(*iomaps), GFP_KERNEL);
160-
if (!iomaps) {
161-
dprintk("%s: failed to allocate extent array\n", __func__);
153+
if (!iomaps)
162154
return nfserr_delay;
163-
}
164155

165156
for (i = 0; i < nr_iomaps; i++) {
166157
struct pnfs_block_extent bex;
@@ -170,26 +161,18 @@ nfsd4_block_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
170161

171162
p = xdr_decode_hyper(p, &bex.foff);
172163
if (bex.foff & (block_size - 1)) {
173-
dprintk("%s: unaligned offset 0x%llx\n",
174-
__func__, bex.foff);
175164
goto fail;
176165
}
177166
p = xdr_decode_hyper(p, &bex.len);
178167
if (bex.len & (block_size - 1)) {
179-
dprintk("%s: unaligned length 0x%llx\n",
180-
__func__, bex.foff);
181168
goto fail;
182169
}
183170
p = xdr_decode_hyper(p, &bex.soff);
184171
if (bex.soff & (block_size - 1)) {
185-
dprintk("%s: unaligned disk offset 0x%llx\n",
186-
__func__, bex.soff);
187172
goto fail;
188173
}
189174
bex.es = be32_to_cpup(p++);
190175
if (bex.es != PNFS_BLOCK_READWRITE_DATA) {
191-
dprintk("%s: incorrect extent state %d\n",
192-
__func__, bex.es);
193176
goto fail;
194177
}
195178

@@ -231,38 +214,29 @@ nfsd4_scsi_decode_layoutupdate(__be32 *p, u32 len, struct iomap **iomapp,
231214
struct iomap *iomaps;
232215
u32 nr_iomaps, expected, i;
233216

234-
if (len < sizeof(u32)) {
235-
dprintk("%s: extent array too small: %u\n", __func__, len);
217+
if (len < sizeof(u32))
236218
return nfserr_bad_xdr;
237-
}
238219

239220
nr_iomaps = be32_to_cpup(p++);
240221
expected = sizeof(__be32) + nr_iomaps * PNFS_SCSI_RANGE_SIZE;
241-
if (len != expected) {
242-
dprintk("%s: extent array size mismatch: %u/%u\n",
243-
__func__, len, expected);
222+
if (len != expected)
244223
return nfserr_bad_xdr;
245-
}
246224

247225
iomaps = kcalloc(nr_iomaps, sizeof(*iomaps), GFP_KERNEL);
248-
if (!iomaps) {
249-
dprintk("%s: failed to allocate extent array\n", __func__);
226+
if (!iomaps)
250227
return nfserr_delay;
251-
}
252228

253229
for (i = 0; i < nr_iomaps; i++) {
254230
u64 val;
255231

256232
p = xdr_decode_hyper(p, &val);
257233
if (val & (block_size - 1)) {
258-
dprintk("%s: unaligned offset 0x%llx\n", __func__, val);
259234
goto fail;
260235
}
261236
iomaps[i].offset = val;
262237

263238
p = xdr_decode_hyper(p, &val);
264239
if (val & (block_size - 1)) {
265-
dprintk("%s: unaligned length 0x%llx\n", __func__, val);
266240
goto fail;
267241
}
268242
iomaps[i].length = val;

0 commit comments

Comments
 (0)